OMS执行单开发
This commit is contained in:
+4
@@ -60,6 +60,10 @@ public class ExecuteOrderApplicationService {
|
||||
return executeOrderDomainService.delete(ids);
|
||||
}
|
||||
|
||||
public boolean issueDocuments(Long[] ids) {
|
||||
return executeOrderDomainService.issueDocuments(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
*/
|
||||
|
||||
+34
-1
@@ -13,7 +13,7 @@ import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】对象 business_document_cargo_multi
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2026-01-26
|
||||
*/
|
||||
@@ -63,5 +63,38 @@ public class BusinessDocumentCargoMulti extends BaseVOEntity{
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private BigDecimal cargoWeight;
|
||||
|
||||
@ApiModelProperty("货物名称")
|
||||
private String cargoName;
|
||||
|
||||
@ApiModelProperty("货物单位ID")
|
||||
private String cargoUnitId;
|
||||
|
||||
@ApiModelProperty("货物单位名字")
|
||||
private String cargoUnitName;
|
||||
|
||||
@ApiModelProperty(value = "货物数量")
|
||||
private BigDecimal cargoNum;
|
||||
|
||||
private BigDecimal weight;
|
||||
@ApiModelProperty(value = "重量单位ID")
|
||||
private String weightUnitId;
|
||||
@ApiModelProperty(value = "重量单位名称")
|
||||
private String weightUnit;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "数量单位ID")
|
||||
private String quantityUnitId;
|
||||
@ApiModelProperty(value = "数量单位名称")
|
||||
private String quantityUnit;
|
||||
|
||||
|
||||
@ApiModelProperty("整机表编号")
|
||||
private String machineCode;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private String materialCode;
|
||||
|
||||
@ApiModelProperty("$column.columnComment")
|
||||
@Excel(name = "${comment}", readConverterExp = "$column.readConverterExp()")
|
||||
private String orderId;
|
||||
}
|
||||
|
||||
+4
@@ -44,4 +44,8 @@ public interface IBusinessDocumentOrderService extends IService<BusinessDocument
|
||||
public BusinessDocumentOrderPO getInfo(Long id);
|
||||
|
||||
public BusinessDocumentOrderPO audit( Long id, Long reviewStatus);
|
||||
|
||||
String selectByMakerCodeNc(String salesmanCodeNc);
|
||||
|
||||
String selectByMakerCodeNc1(String salesmanCodeNc);
|
||||
}
|
||||
|
||||
+5
-1
@@ -8,7 +8,7 @@ import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocument
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
/**
|
||||
* 【请填写功能名称】Mapper接口
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2026-01-26
|
||||
*/
|
||||
@@ -19,4 +19,8 @@ public interface BusinessDocumentOrderMapper extends BaseMapper<BusinessDocument
|
||||
*/
|
||||
public List<BusinessDocumentOrderPO> queryList(BusinessDocumentOrderDO businessDocumentOrderDO);
|
||||
|
||||
String selectByMakerCodeNc(@Param("salesmanCodeNc") String salesmanCodeNc);
|
||||
|
||||
String selectByMakerCodeNc1(@Param("salesmanCodeNc") String salesmanCodeNc);
|
||||
|
||||
}
|
||||
|
||||
+17
@@ -141,4 +141,21 @@ public class BusinessDocumentOrderImpl extends ServiceImpl<BusinessDocumentOrder
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String selectByMakerCodeNc(String salesmanCodeNc) {
|
||||
String makerCodeNc = businessDocumentOrderMapper.selectByMakerCodeNc(salesmanCodeNc);
|
||||
if (makerCodeNc == null){
|
||||
return "";
|
||||
}
|
||||
return makerCodeNc;
|
||||
}
|
||||
@Override
|
||||
public String selectByMakerCodeNc1(String salesmanCodeNc) {
|
||||
String makerCodeNc = businessDocumentOrderMapper.selectByMakerCodeNc1(salesmanCodeNc);
|
||||
if (makerCodeNc == null){
|
||||
return "";
|
||||
}
|
||||
return makerCodeNc;
|
||||
}
|
||||
}
|
||||
|
||||
+14
@@ -1,6 +1,9 @@
|
||||
package com.mhd.oms.domain.businessDocumentOrder.repository.todo;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.oms.domain.businessDocumentCargoMulti.entity.BusinessDocumentCargoMulti;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentCargoMulti.BusinessDocumentCargoMultiDTO;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -701,4 +704,15 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty("预约单号")
|
||||
private String reservationOrderNumber;
|
||||
|
||||
@ApiModelProperty("业务单地址集合")
|
||||
private List<BusinessDocumentAddressMultiDTO> businessDocumentAddressMultiDTOList;
|
||||
|
||||
@ApiModelProperty("业务单货物集合")
|
||||
private List<BusinessDocumentCargoMultiDTO> businessDocumentCargoMultiList;
|
||||
|
||||
@ApiModelProperty(value = "装货地址集合")
|
||||
private List<BusinessDocumentAddressMultiDTO> loadingAddressList;
|
||||
@ApiModelProperty(value = "卸货地址集合")
|
||||
private List<BusinessDocumentAddressMultiDTO> unloadAddressList;
|
||||
}
|
||||
|
||||
+630
-3
@@ -1,13 +1,41 @@
|
||||
package com.mhd.oms.domain.businessDocumentOrder.service;
|
||||
|
||||
import cn.hutool.core.lang.Snowflake;
|
||||
import cn.hutool.core.util.IdUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.aliyun.oss.ServiceException;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.mhd.common.core.domain.po.UserShipperPo;
|
||||
import com.mhd.common.core.utils.OrderSequence;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.businessDocumentAddressMulti.entity.BusinessDocumentAddressMulti;
|
||||
import com.mhd.oms.domain.businessDocumentAddressMulti.repository.mapper.BusinessDocumentAddressMultiMapper;
|
||||
import com.mhd.oms.domain.businessDocumentCargoMulti.entity.BusinessDocumentCargoMulti;
|
||||
import com.mhd.oms.domain.businessDocumentCargoMulti.repository.mapper.BusinessDocumentCargoMultiMapper;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.facade.IBusinessDocumentOrderService;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO;
|
||||
import com.mhd.oms.domain.orderType.entity.OrderType;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentCargoMulti.BusinessDocumentCargoMultiDTO;
|
||||
import com.mhd.oms.util.DictDataUtils;
|
||||
import com.mhd.oms.util.DictTypeEnum;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import com.mhd.system.api.model.LoginUser;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import java.util.List;
|
||||
/**
|
||||
* 【请填写功能名称】
|
||||
*
|
||||
@@ -21,7 +49,14 @@ public class BusinessDocumentOrderDomainService {
|
||||
@Autowired
|
||||
private IBusinessDocumentOrderService businessDocumentOrderService;
|
||||
|
||||
@Resource
|
||||
private DictDataUtils dictDataUtils;
|
||||
|
||||
@Resource
|
||||
private BusinessDocumentCargoMultiMapper businessDocumentCargoMultiMapper;
|
||||
|
||||
@Resource
|
||||
private BusinessDocumentAddressMultiMapper businessDocumentAddressMultiMapper;
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
*/
|
||||
@@ -34,17 +69,569 @@ public class BusinessDocumentOrderDomainService {
|
||||
* 新增【请填写功能名称】
|
||||
*/
|
||||
public Boolean insert(BusinessDocumentOrderDO businessDocumentOrderDO) {
|
||||
if (null!=businessDocumentOrderDO.getGoodsQuantity()){
|
||||
businessDocumentOrderDO.setGoodsQuantity(BigDecimal.ZERO);
|
||||
}
|
||||
|
||||
return businessDocumentOrderService.insert(businessDocumentOrderDO);
|
||||
LoginUser u = SecurityUtils.getLoginUser();
|
||||
|
||||
//处理费用默认值
|
||||
handFee(businessDocumentOrderDO);
|
||||
//组织赋值
|
||||
Long organizationId = businessDocumentOrderDO.getOrganizationId();
|
||||
if(ObjectUtil.isNotEmpty(organizationId)){
|
||||
businessDocumentOrderDO.setOrgId(String.valueOf(organizationId));
|
||||
businessDocumentOrderDO.setOrgName(businessDocumentOrderDO.getOrganizationName());
|
||||
}else{
|
||||
businessDocumentOrderDO.setOrgId(String.valueOf(u.getUserPo().getOrganizationId()));
|
||||
businessDocumentOrderDO.setOrgName(String.valueOf(u.getUserPo().getOrganizationName()));
|
||||
}
|
||||
businessDocumentOrderDO.setTopOrganizationId(u.getUserPo().getTopOrganizationId());
|
||||
/* String swzlUserId = businessDocumentOrderDO.getAppointShipperId();
|
||||
// 获取数字物流平台用户Id
|
||||
String appointShipperId = businessDocumentOrderDO.getAppointShipperId();
|
||||
if(StringUtils.isBlank(appointShipperId)){
|
||||
appointShipperId = u.getUserid();
|
||||
businessDocumentOrderDO.setAppointShipperId(appointShipperId);
|
||||
}*/
|
||||
UserShipperPo userShipperPo=u.getUserShipperPo();
|
||||
|
||||
if (userShipperPo == null) {
|
||||
throw new ServiceException("您非货主角色或账号已被删除!");
|
||||
}
|
||||
String orderRemark = businessDocumentOrderDO.getRemarks();
|
||||
businessDocumentOrderDO.setRemarks(orderRemark);
|
||||
|
||||
businessDocumentOrderDO.setAppointShipperId(String.valueOf(userShipperPo.getUserId()));
|
||||
// 分类处理货物列表
|
||||
List<BusinessDocumentCargoMultiDTO> allCargoList = businessDocumentOrderDO.getBusinessDocumentCargoMultiList();
|
||||
businessDocumentOrderDO.setReceivableType(2L);
|
||||
//非企业员工判断个人信息审核状态x
|
||||
if (userShipperPo.getShipperType() != 2 && userShipperPo.getShipperFill() != 3) {
|
||||
throw new ServiceException("未提交个人信息认证或认证未通过,请先认证!");
|
||||
}
|
||||
|
||||
|
||||
//企业员工判断企业货主审核状态
|
||||
if (userShipperPo.getShipperType() == 2) {
|
||||
if (userShipperPo.getShipperEnterpriseFill() != 3) {
|
||||
throw new ServiceException("未提交个人信息认证或认证未通过,请先认证!");
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 生成货源单信息
|
||||
*/
|
||||
BusinessDocumentOrder tmsOrder = new BusinessDocumentOrder();
|
||||
BeanUtils.copyProperties(businessDocumentOrderDO, tmsOrder, "id");
|
||||
tmsOrder.setSettlementStatus(1L);//未出账
|
||||
tmsOrder.setAuditStatus(0L);//未审核
|
||||
tmsOrder.setSzwlUserId(Long.valueOf(u.getUserid()));
|
||||
if (tmsOrder.getLoadingDate() != null && tmsOrder.getUnloadingData() != null) {
|
||||
if (tmsOrder.getUnloadingData().before(tmsOrder.getLoadingDate())) {
|
||||
throw new ServiceException("装货日期不能大于卸货日期!");
|
||||
}
|
||||
}
|
||||
//赋值信息费收款方信息
|
||||
if(businessDocumentOrderDO.getOrderShippingType()==3&&businessDocumentOrderDO.getInfoFeePayeeType()!=null){
|
||||
String infoFeePayee = "";
|
||||
if(businessDocumentOrderDO.getInfoFeePayeeType()==0){
|
||||
infoFeePayee = businessDocumentOrderDO.getAppointShipper();//委托方
|
||||
}else if(businessDocumentOrderDO.getInfoFeePayeeType()==1){
|
||||
infoFeePayee = businessDocumentOrderDO.getRecipientName();//收货方
|
||||
}else if(businessDocumentOrderDO.getInfoFeePayeeType()==2){
|
||||
infoFeePayee = businessDocumentOrderDO.getInfoFeePayee();//第三方
|
||||
if(StringUtils.isBlank(businessDocumentOrderDO.getInfoFeePayee())){
|
||||
throw new ServiceException("请填写信息费第三方收款方信息!");
|
||||
}
|
||||
}
|
||||
tmsOrder.setInfoFeePayeeType(businessDocumentOrderDO.getInfoFeePayeeType());
|
||||
if(infoFeePayee!=""){
|
||||
tmsOrder.setInfoFeePayee(infoFeePayee);
|
||||
}
|
||||
}
|
||||
//根据货物重量大小赋值
|
||||
BigDecimal weightMin = new BigDecimal(0);
|
||||
tmsOrder.setWeightMin(weightMin);
|
||||
tmsOrder.setUncollectedFreight(tmsOrder.getDeliveryFreight());
|
||||
//存入对应创建人
|
||||
tmsOrder.setCreateBy(userShipperPo.getUserId());
|
||||
if ( 2 == userShipperPo.getShipperType()) {
|
||||
tmsOrder.setCreateCompanyId(String.valueOf(userShipperPo.getUserId()));
|
||||
}
|
||||
tmsOrder.setCreateTime(new Date());
|
||||
tmsOrder.setCreaterName(u.getUsername());//保存创建人姓名
|
||||
tmsOrder.setCreaterPhone(u.getUserPo().getUserPhone());//保存创建人电话
|
||||
tmsOrder.setRealCreateBy(String.valueOf(u.getUserid()));
|
||||
tmsOrder.setRealCreateName(u.getUsername());
|
||||
tmsOrder.setAppointShipper(userShipperPo.getShipperEnterpriseName());//20250-07-29修改:订单表委托方保存公司名字,而不是姓名
|
||||
String salesmanCodeNc = businessDocumentOrderDO.getSalesmanId();
|
||||
if (salesmanCodeNc != null){
|
||||
String makerCodeNc = businessDocumentOrderService.selectByMakerCodeNc(salesmanCodeNc);
|
||||
String makerCodeNc1 = businessDocumentOrderService.selectByMakerCodeNc1(salesmanCodeNc);
|
||||
tmsOrder.setMakerCodeNc(makerCodeNc);
|
||||
tmsOrder.setSalesmanCodeNc(makerCodeNc1);
|
||||
}
|
||||
List<String> machineNumberList = new ArrayList<>();
|
||||
List<String> goodsNameList = new ArrayList<>();
|
||||
if (ObjectUtil.isNotEmpty(allCargoList)&&allCargoList.size()>0) {
|
||||
BusinessDocumentCargoMultiDTO tmsCargoInfoDTO1 = allCargoList.get(0);
|
||||
String goodsTypeId = tmsCargoInfoDTO1.getGoodsTypeId();
|
||||
if (ObjectUtil.isNotEmpty(goodsTypeId)) {
|
||||
for (BusinessDocumentCargoMultiDTO tmsCargoInfoDTO : allCargoList) {
|
||||
// 处理货物名称信息
|
||||
String goodsName = buildCargoNameInfo(tmsCargoInfoDTO, businessDocumentOrderDO);
|
||||
if (goodsName != null) {
|
||||
goodsNameList.add(goodsName);
|
||||
}
|
||||
|
||||
// 处理机械编号信息
|
||||
String machineCode = extractMachineCode(tmsCargoInfoDTO);
|
||||
if (machineCode != null) {
|
||||
machineNumberList.add(machineCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//生成货源单号
|
||||
tmsOrder.setGoodsNumber(OrderSequence.getOrderCode());
|
||||
List<BusinessDocumentAddressMultiDTO> loadingAddressList = businessDocumentOrderDO.getLoadingAddressList();//装货地信息集合
|
||||
List<BusinessDocumentAddressMultiDTO> unloadAddressList = businessDocumentOrderDO.getUnloadAddressList();//卸货地信息集合
|
||||
String loadCityCounty="",unloadCityCounty="";
|
||||
//获取第一条装货地址和获取最后一条卸货地址
|
||||
BusinessDocumentAddressMultiDTO firstAddress = loadingAddressList.get(0);
|
||||
BusinessDocumentAddressMultiDTO lastAddress = unloadAddressList.get(unloadAddressList.size() - 1);
|
||||
tmsOrder.setLoadingAreaId(firstAddress.getAreaCode());
|
||||
tmsOrder.setLoadingName(firstAddress.getAreaCode());
|
||||
tmsOrder.setLoadingAddress(firstAddress.getAddress());
|
||||
String area = firstAddress.getAreaCode() + firstAddress.getAddress();
|
||||
tmsOrder.setLineTitleLeft(firstAddress.getAreaCode());
|
||||
tmsOrder.setLineTitleRight(lastAddress.getAreaCode());
|
||||
tmsOrder.setFreighterName(firstAddress.getContactName());
|
||||
tmsOrder.setLoadingPhone(firstAddress.getContactPhone());
|
||||
tmsOrder.setLoadingDate(firstAddress.getLayDate());
|
||||
|
||||
tmsOrder.setUnloadAreaId(lastAddress.getAreaCode());
|
||||
tmsOrder.setUnloadName(lastAddress.getAreaCode());
|
||||
tmsOrder.setUnloadAddress(lastAddress.getAddress());
|
||||
String unarea = lastAddress.getAreaCode() + lastAddress.getAddress();
|
||||
tmsOrder.setDischargerName(lastAddress.getContactName());
|
||||
tmsOrder.setUnloadPhone(lastAddress.getContactPhone());
|
||||
tmsOrder.setUnloadingData(lastAddress.getLayDate());
|
||||
tmsOrder.setMachineNumber(String.join(",", machineNumberList));
|
||||
// 设置货物名称,将所有货物信息用逗号连接
|
||||
tmsOrder.setGoodsName(String.join(",", goodsNameList));
|
||||
//服务要求
|
||||
SysDictData sysDictItem = new SysDictData();
|
||||
if (StringUtils.isNotBlank(businessDocumentOrderDO.getServiceRequireId())) {
|
||||
String[] serviceRequireId = businessDocumentOrderDO.getServiceRequireId().split(",");
|
||||
StringBuilder serviceRequire = new StringBuilder();
|
||||
tmsOrder.setServiceRequire(findName(serviceRequireId, sysDictItem, serviceRequire));
|
||||
}
|
||||
//车长车型
|
||||
if (StringUtils.isNotEmpty(businessDocumentOrderDO.getCarType())) {
|
||||
String[] carType = businessDocumentOrderDO.getCarType().split(",");
|
||||
StringBuilder carTypeName = new StringBuilder();
|
||||
tmsOrder.setCarTypeName(findName(carType, sysDictItem, carTypeName));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(allCargoList)&&allCargoList.size()>0) {
|
||||
BusinessDocumentCargoMultiDTO tmsCargoInfoDTO1 = allCargoList.get(0);
|
||||
String goodsTypeId = tmsCargoInfoDTO1.getGoodsTypeId();
|
||||
if (ObjectUtil.isNotEmpty(goodsTypeId)) {
|
||||
for (BusinessDocumentCargoMultiDTO tmsCargoInfoDTO : allCargoList) {
|
||||
//货物重量单位id
|
||||
if (StringUtils.isNotBlank(tmsCargoInfoDTO.getWeightUnitId())) {
|
||||
SysDictData sysDictItem3 = dictDataUtils.getDictDataByValue(DictTypeEnum.GOODSUNIT.getTypeCode(), tmsCargoInfoDTO.getWeightUnitId());
|
||||
if (sysDictItem3 != null) {
|
||||
tmsOrder.setGoodsUntis(sysDictItem3.getDictLabel());
|
||||
}
|
||||
} else {
|
||||
tmsOrder.setGoodsUntisId("1");
|
||||
tmsOrder.setGoodsUntis("吨");
|
||||
}
|
||||
//货物数量单位id
|
||||
if (StringUtils.isNotBlank(tmsCargoInfoDTO.getQuantityUnitId())) {
|
||||
SysDictData sysDictItem33 = dictDataUtils.getDictDataByValue(DictTypeEnum.GOODSUNIT.getTypeCode(), tmsCargoInfoDTO.getQuantityUnitId());
|
||||
if (sysDictItem33 != null) {
|
||||
tmsCargoInfoDTO.setQuantityUnit(sysDictItem33.getDictLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//配载方式名称
|
||||
if (businessDocumentOrderDO.getTransportationModeId() != null && StringUtils.isNotEmpty(businessDocumentOrderDO.getTransportationModeId() + "")) {
|
||||
if (businessDocumentOrderDO.getTransportationModeId() == 0) {
|
||||
tmsOrder.setTransportationName("数量配载");
|
||||
tmsOrder.setRadioValue(2L);
|
||||
//wxy 23-12-15日修改,数量配载时不重置需求车次为1
|
||||
// tmsOrder.setDemandTrainNumber(1);
|
||||
} else if (businessDocumentOrderDO.getTransportationModeId() == 1) {
|
||||
tmsOrder.setTransportationName("车次配载");
|
||||
tmsOrder.setRadioValue(1L);
|
||||
}
|
||||
}
|
||||
if(businessDocumentOrderDO.getOrderShippingType()==3){
|
||||
tmsOrder.setTransportationName("数量配载");
|
||||
tmsOrder.setRadioValue(2L);
|
||||
tmsOrder.setTransportationModeId(0L);
|
||||
}else{
|
||||
tmsOrder.setTransportationName("车次配载");
|
||||
tmsOrder.setRadioValue(1L);
|
||||
tmsOrder.setTransportationModeId(1L);
|
||||
}
|
||||
//货源单保存
|
||||
tmsOrder.setCreateUserId(String.valueOf(u.getUserid()));
|
||||
tmsOrder.setOrderStatus(0L);
|
||||
//保存付款方
|
||||
if(businessDocumentOrderDO.getPayerType()==0){//委托方
|
||||
tmsOrder.setPayer(tmsOrder.getAppointShipper());
|
||||
}else if(businessDocumentOrderDO.getPayerType()==1){//收货方
|
||||
tmsOrder.setPayer(tmsOrder.getRecipientName());
|
||||
}
|
||||
|
||||
// 设置组织信息
|
||||
if (businessDocumentOrderDO.getOrganizationId() != null) {
|
||||
tmsOrder.setOrganizationId(businessDocumentOrderDO.getOrganizationId());
|
||||
}
|
||||
if (businessDocumentOrderDO.getOrganizationName() != null) {
|
||||
tmsOrder.setOrganizationName(businessDocumentOrderDO.getOrganizationName());
|
||||
}
|
||||
if (businessDocumentOrderDO.getTopOrganizationId() != null) {
|
||||
tmsOrder.setTopOrganizationId(businessDocumentOrderDO.getTopOrganizationId());
|
||||
}
|
||||
boolean istrue=businessDocumentOrderService.insert(businessDocumentOrderDO);
|
||||
//保存货物信息及地址信息
|
||||
|
||||
saveAddress2CargoInfo(tmsOrder.getId(), allCargoList, loadingAddressList, unloadAddressList);
|
||||
return istrue;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
public Boolean update(BusinessDocumentOrderDO businessDocumentOrderDO) {
|
||||
return businessDocumentOrderService.update(businessDocumentOrderDO);
|
||||
LoginUser u = SecurityUtils.getLoginUser();
|
||||
UserShipperPo userShipperPo=u.getUserShipperPo();
|
||||
|
||||
if (userShipperPo == null) {
|
||||
throw new ServiceException("您非货主角色或账号已被删除!");
|
||||
}
|
||||
BusinessDocumentOrder tmsOrder = businessDocumentOrderService.getById(businessDocumentOrderDO.getId());
|
||||
if (tmsOrder.getOrderStatus() == 1){
|
||||
tmsOrder.setOrderStatus(0L);
|
||||
}
|
||||
if (tmsOrder == null) {
|
||||
throw new ServiceException("货源单不存在或已被删除!");
|
||||
}
|
||||
if (tmsOrder.getIsSource() == 1) {
|
||||
throw new ServiceException("运单已被关闭,请确认!");
|
||||
}
|
||||
//处理费用默认值
|
||||
handFee(businessDocumentOrderDO);
|
||||
//组织赋值
|
||||
Long organizationId = businessDocumentOrderDO.getOrganizationId();
|
||||
if(ObjectUtil.isNotEmpty(organizationId)){
|
||||
businessDocumentOrderDO.setOrgId(String.valueOf(organizationId));
|
||||
businessDocumentOrderDO.setOrgName(businessDocumentOrderDO.getOrganizationName());
|
||||
}else{
|
||||
businessDocumentOrderDO.setOrgId(String.valueOf(u.getUserPo().getOrganizationId()));
|
||||
businessDocumentOrderDO.setOrgName(String.valueOf(u.getUserPo().getOrganizationName()));
|
||||
}
|
||||
businessDocumentOrderDO.setTopOrganizationId(u.getUserPo().getTopOrganizationId());
|
||||
BigDecimal deliveryFreight=tmsOrder.getDeliveryFreight();
|
||||
/**
|
||||
* 生成货源单信息
|
||||
*/
|
||||
BeanUtils.copyProperties(businessDocumentOrderDO, tmsOrder);
|
||||
tmsOrder.setSzwlUserId(Long.valueOf(u.getUserid()));
|
||||
if (tmsOrder.getLoadingDate() != null && tmsOrder.getUnloadingData() != null) {
|
||||
if (tmsOrder.getUnloadingData().before(tmsOrder.getLoadingDate())) {
|
||||
throw new ServiceException("装货日期不能大于卸货日期!");
|
||||
}
|
||||
}
|
||||
//赋值信息费收款方信息
|
||||
if(businessDocumentOrderDO.getOrderShippingType()==3&&businessDocumentOrderDO.getInfoFeePayeeType()!=null){
|
||||
String infoFeePayee = "";
|
||||
if(businessDocumentOrderDO.getInfoFeePayeeType()==0){
|
||||
infoFeePayee = businessDocumentOrderDO.getAppointShipper();//委托方
|
||||
}else if(businessDocumentOrderDO.getInfoFeePayeeType()==1){
|
||||
infoFeePayee = businessDocumentOrderDO.getRecipientName();//收货方
|
||||
}else if(businessDocumentOrderDO.getInfoFeePayeeType()==2){
|
||||
infoFeePayee = businessDocumentOrderDO.getInfoFeePayee();//第三方
|
||||
if(StringUtils.isBlank(businessDocumentOrderDO.getInfoFeePayee())){
|
||||
throw new ServiceException("请填写信息费第三方收款方信息!");
|
||||
}
|
||||
}
|
||||
tmsOrder.setInfoFeePayeeType(businessDocumentOrderDO.getInfoFeePayeeType());
|
||||
if(infoFeePayee!=""){
|
||||
tmsOrder.setInfoFeePayee(infoFeePayee);
|
||||
}
|
||||
}
|
||||
//根据货物重量大小赋值
|
||||
BigDecimal weightMin = new BigDecimal(0);
|
||||
tmsOrder.setWeightMin(weightMin);
|
||||
tmsOrder.setUncollectedFreight(tmsOrder.getDeliveryFreight());
|
||||
//存入对应创建人
|
||||
tmsOrder.setCreateBy(userShipperPo.getUserId());
|
||||
if ( 2 == userShipperPo.getShipperType()) {
|
||||
tmsOrder.setCreateCompanyId(String.valueOf(userShipperPo.getUserId()));
|
||||
}
|
||||
tmsOrder.setCreateTime(new Date());
|
||||
tmsOrder.setCreaterName(u.getUsername());//保存创建人姓名
|
||||
tmsOrder.setCreaterPhone(u.getUserPo().getUserPhone());//保存创建人电话
|
||||
tmsOrder.setRealCreateBy(String.valueOf(u.getUserid()));
|
||||
tmsOrder.setRealCreateName(u.getUsername());
|
||||
tmsOrder.setAppointShipper(userShipperPo.getShipperEnterpriseName());//20250-07-29修改:订单表委托方保存公司名字,而不是姓名
|
||||
String salesmanCodeNc = businessDocumentOrderDO.getSalesmanId();
|
||||
if (salesmanCodeNc != null){
|
||||
String makerCodeNc = businessDocumentOrderService.selectByMakerCodeNc(salesmanCodeNc);
|
||||
String makerCodeNc1 = businessDocumentOrderService.selectByMakerCodeNc1(salesmanCodeNc);
|
||||
tmsOrder.setMakerCodeNc(makerCodeNc);
|
||||
tmsOrder.setSalesmanCodeNc(makerCodeNc1);
|
||||
}
|
||||
List<String> machineNumberList = new ArrayList<>();
|
||||
List<String> goodsNameList = new ArrayList<>();
|
||||
// 分类处理货物列表
|
||||
List<BusinessDocumentCargoMultiDTO> allCargoList = businessDocumentOrderDO.getBusinessDocumentCargoMultiList();
|
||||
if (ObjectUtil.isNotEmpty(allCargoList)&&allCargoList.size()>0) {
|
||||
BusinessDocumentCargoMultiDTO tmsCargoInfoDTO1 = allCargoList.get(0);
|
||||
String goodsTypeId = tmsCargoInfoDTO1.getGoodsTypeId();
|
||||
if (ObjectUtil.isNotEmpty(goodsTypeId)) {
|
||||
for (BusinessDocumentCargoMultiDTO tmsCargoInfoDTO : allCargoList) {
|
||||
// 处理货物名称信息
|
||||
String goodsName = buildCargoNameInfo(tmsCargoInfoDTO, businessDocumentOrderDO);
|
||||
if (goodsName != null) {
|
||||
goodsNameList.add(goodsName);
|
||||
}
|
||||
|
||||
// 处理机械编号信息
|
||||
String machineCode = extractMachineCode(tmsCargoInfoDTO);
|
||||
if (machineCode != null) {
|
||||
machineNumberList.add(machineCode);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//生成货源单号
|
||||
tmsOrder.setGoodsNumber(OrderSequence.getOrderCode());
|
||||
List<BusinessDocumentAddressMultiDTO> loadingAddressList = businessDocumentOrderDO.getLoadingAddressList();//装货地信息集合
|
||||
List<BusinessDocumentAddressMultiDTO> unloadAddressList = businessDocumentOrderDO.getUnloadAddressList();//卸货地信息集合
|
||||
String loadCityCounty="",unloadCityCounty="";
|
||||
//获取第一条装货地址和获取最后一条卸货地址
|
||||
BusinessDocumentAddressMultiDTO firstAddress = loadingAddressList.get(0);
|
||||
BusinessDocumentAddressMultiDTO lastAddress = unloadAddressList.get(unloadAddressList.size() - 1);
|
||||
tmsOrder.setLoadingAreaId(firstAddress.getAreaCode());
|
||||
tmsOrder.setLoadingName(firstAddress.getAreaCode());
|
||||
tmsOrder.setLoadingAddress(firstAddress.getAddress());
|
||||
String area = firstAddress.getAreaCode() + firstAddress.getAddress();
|
||||
tmsOrder.setLineTitleLeft(firstAddress.getAreaCode());
|
||||
tmsOrder.setLineTitleRight(lastAddress.getAreaCode());
|
||||
tmsOrder.setFreighterName(firstAddress.getContactName());
|
||||
tmsOrder.setLoadingPhone(firstAddress.getContactPhone());
|
||||
tmsOrder.setLoadingDate(firstAddress.getLayDate());
|
||||
|
||||
tmsOrder.setUnloadAreaId(lastAddress.getAreaCode());
|
||||
tmsOrder.setUnloadName(lastAddress.getAreaCode());
|
||||
tmsOrder.setUnloadAddress(lastAddress.getAddress());
|
||||
String unarea = lastAddress.getAreaCode() + lastAddress.getAddress();
|
||||
tmsOrder.setDischargerName(lastAddress.getContactName());
|
||||
tmsOrder.setUnloadPhone(lastAddress.getContactPhone());
|
||||
tmsOrder.setUnloadingData(lastAddress.getLayDate());
|
||||
tmsOrder.setMachineNumber(String.join(",", machineNumberList));
|
||||
// 设置货物名称,将所有货物信息用逗号连接
|
||||
tmsOrder.setGoodsName(String.join(",", goodsNameList));
|
||||
//服务要求
|
||||
SysDictData sysDictItem = new SysDictData();
|
||||
if (StringUtils.isNotBlank(businessDocumentOrderDO.getServiceRequireId())) {
|
||||
String[] serviceRequireId = businessDocumentOrderDO.getServiceRequireId().split(",");
|
||||
StringBuilder serviceRequire = new StringBuilder();
|
||||
tmsOrder.setServiceRequire(findName(serviceRequireId, sysDictItem, serviceRequire));
|
||||
}
|
||||
//车长车型
|
||||
if (StringUtils.isNotEmpty(businessDocumentOrderDO.getCarType())) {
|
||||
String[] carType = businessDocumentOrderDO.getCarType().split(",");
|
||||
StringBuilder carTypeName = new StringBuilder();
|
||||
tmsOrder.setCarTypeName(findName(carType, sysDictItem, carTypeName));
|
||||
}
|
||||
if (ObjectUtil.isNotEmpty(allCargoList)&&allCargoList.size()>0) {
|
||||
BusinessDocumentCargoMultiDTO tmsCargoInfoDTO1 = allCargoList.get(0);
|
||||
String goodsTypeId = tmsCargoInfoDTO1.getGoodsTypeId();
|
||||
if (ObjectUtil.isNotEmpty(goodsTypeId)) {
|
||||
for (BusinessDocumentCargoMultiDTO tmsCargoInfoDTO : allCargoList) {
|
||||
//货物重量单位id
|
||||
if (StringUtils.isNotBlank(tmsCargoInfoDTO.getWeightUnitId())) {
|
||||
SysDictData sysDictItem3 = dictDataUtils.getDictDataByValue(DictTypeEnum.GOODSUNIT.getTypeCode(), tmsCargoInfoDTO.getWeightUnitId());
|
||||
if (sysDictItem3 != null) {
|
||||
tmsOrder.setGoodsUntis(sysDictItem3.getDictLabel());
|
||||
}
|
||||
} else {
|
||||
tmsOrder.setGoodsUntisId("1");
|
||||
tmsOrder.setGoodsUntis("吨");
|
||||
}
|
||||
//货物数量单位id
|
||||
if (StringUtils.isNotBlank(tmsCargoInfoDTO.getQuantityUnitId())) {
|
||||
SysDictData sysDictItem33 = dictDataUtils.getDictDataByValue(DictTypeEnum.GOODSUNIT.getTypeCode(), tmsCargoInfoDTO.getQuantityUnitId());
|
||||
if (sysDictItem33 != null) {
|
||||
tmsCargoInfoDTO.setQuantityUnit(sysDictItem33.getDictLabel());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//配载方式名称
|
||||
if (businessDocumentOrderDO.getTransportationModeId() != null && StringUtils.isNotEmpty(businessDocumentOrderDO.getTransportationModeId() + "")) {
|
||||
if (businessDocumentOrderDO.getTransportationModeId() == 0) {
|
||||
tmsOrder.setTransportationName("数量配载");
|
||||
tmsOrder.setRadioValue(2L);
|
||||
//wxy 23-12-15日修改,数量配载时不重置需求车次为1
|
||||
// tmsOrder.setDemandTrainNumber(1);
|
||||
} else if (businessDocumentOrderDO.getTransportationModeId() == 1) {
|
||||
tmsOrder.setTransportationName("车次配载");
|
||||
tmsOrder.setRadioValue(1L);
|
||||
}
|
||||
}
|
||||
if(businessDocumentOrderDO.getOrderShippingType()==3){
|
||||
tmsOrder.setTransportationName("数量配载");
|
||||
tmsOrder.setRadioValue(2L);
|
||||
tmsOrder.setTransportationModeId(0L);
|
||||
}else{
|
||||
tmsOrder.setTransportationName("车次配载");
|
||||
tmsOrder.setRadioValue(1L);
|
||||
tmsOrder.setTransportationModeId(1L);
|
||||
}
|
||||
//货源单保存
|
||||
tmsOrder.setCreateUserId(String.valueOf(u.getUserid()));
|
||||
tmsOrder.setOrderStatus(0L);
|
||||
//保存付款方
|
||||
if(businessDocumentOrderDO.getPayerType()==0){//委托方
|
||||
tmsOrder.setPayer(tmsOrder.getAppointShipper());
|
||||
}else if(businessDocumentOrderDO.getPayerType()==1){//收货方
|
||||
tmsOrder.setPayer(tmsOrder.getRecipientName());
|
||||
}
|
||||
|
||||
// 设置组织信息
|
||||
if (businessDocumentOrderDO.getOrganizationId() != null) {
|
||||
tmsOrder.setOrganizationId(businessDocumentOrderDO.getOrganizationId());
|
||||
}
|
||||
if (businessDocumentOrderDO.getOrganizationName() != null) {
|
||||
tmsOrder.setOrganizationName(businessDocumentOrderDO.getOrganizationName());
|
||||
}
|
||||
if (businessDocumentOrderDO.getTopOrganizationId() != null) {
|
||||
tmsOrder.setTopOrganizationId(businessDocumentOrderDO.getTopOrganizationId());
|
||||
}
|
||||
boolean istrue=businessDocumentOrderService.update(businessDocumentOrderDO);
|
||||
//保存货物信息及地址信息
|
||||
|
||||
saveAddress2CargoInfo(tmsOrder.getId(), allCargoList, loadingAddressList, unloadAddressList);
|
||||
return istrue;
|
||||
|
||||
}
|
||||
private void saveAddress2CargoInfo(Long id, List<BusinessDocumentCargoMultiDTO> cargoInfoList, List<BusinessDocumentAddressMultiDTO> loadingAddressList, List<BusinessDocumentAddressMultiDTO> unloadAddressList) {
|
||||
|
||||
//根据ID先删除货物、装卸货信息
|
||||
Snowflake snowflake = IdUtil.createSnowflake(1, 1);
|
||||
if (ObjectUtil.isNotEmpty(cargoInfoList)&&cargoInfoList.size()>0) {
|
||||
BusinessDocumentCargoMultiDTO tmsCargoInfoDTO1 = cargoInfoList.get(0);
|
||||
String goodsTypeId = tmsCargoInfoDTO1.getGoodsTypeId();
|
||||
if (ObjectUtil.isNotEmpty(goodsTypeId)) {
|
||||
businessDocumentCargoMultiMapper.delete(new LambdaQueryWrapper<BusinessDocumentCargoMulti>().eq(BusinessDocumentCargoMulti::getOrderId, id));
|
||||
List<BusinessDocumentCargoMulti> tmsCargoInfoList = new ArrayList<>();
|
||||
for (BusinessDocumentCargoMultiDTO tmsCargoInfoDTO : cargoInfoList) {
|
||||
BusinessDocumentCargoMulti tmsCargoInfo = new BusinessDocumentCargoMulti();
|
||||
BeanUtils.copyProperties(tmsCargoInfoDTO, tmsCargoInfo);
|
||||
tmsCargoInfo.setCreateTime(new Date());
|
||||
tmsCargoInfo.setUpdateTime(new Date());
|
||||
tmsCargoInfo.setOrderId(String.valueOf(id));
|
||||
tmsCargoInfo.setCargoWeight(tmsCargoInfoDTO.getWeight()==null ? BigDecimal.ZERO: tmsCargoInfoDTO.getWeight());
|
||||
tmsCargoInfo.setCargoNum(tmsCargoInfoDTO.getCargoNum()==null ? BigDecimal.ZERO: tmsCargoInfoDTO.getCargoNum());
|
||||
businessDocumentCargoMultiMapper.insert(tmsCargoInfo);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
businessDocumentAddressMultiMapper.delete(new LambdaQueryWrapper<BusinessDocumentAddressMulti>().eq(BusinessDocumentAddressMulti::getOrderId, id));
|
||||
List<BusinessDocumentAddressMulti> addressMultiList = new ArrayList<>();
|
||||
for (BusinessDocumentAddressMultiDTO addressMultiDTO : loadingAddressList) {
|
||||
BusinessDocumentAddressMulti tmsAddressMulti = new BusinessDocumentAddressMulti();
|
||||
BeanUtils.copyProperties(addressMultiDTO, tmsAddressMulti);
|
||||
tmsAddressMulti.setCreateTime(new Date());
|
||||
tmsAddressMulti.setUpdateTime(new Date());
|
||||
tmsAddressMulti.setOrderId(String.valueOf(id));
|
||||
tmsAddressMulti.setLayType(1L);
|
||||
tmsAddressMulti.setSort(addressMultiDTO.getSort());
|
||||
tmsAddressMulti.setShortName(tmsAddressMulti.getAreaName());
|
||||
businessDocumentAddressMultiMapper.insert(tmsAddressMulti);
|
||||
}
|
||||
for (BusinessDocumentAddressMultiDTO addressMultiDTO : unloadAddressList) {
|
||||
BusinessDocumentAddressMulti tmsAddressMulti = new BusinessDocumentAddressMulti();
|
||||
BeanUtils.copyProperties(addressMultiDTO, tmsAddressMulti);
|
||||
tmsAddressMulti.setCreateTime(new Date());
|
||||
tmsAddressMulti.setUpdateTime(new Date());
|
||||
tmsAddressMulti.setOrderId(String.valueOf(id));
|
||||
tmsAddressMulti.setShortName(tmsAddressMulti.getAreaName());
|
||||
businessDocumentAddressMultiMapper.insert(tmsAddressMulti);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理前端费用为null的情况
|
||||
* @param businessDocumentOrderDO
|
||||
*/
|
||||
private void handFee(BusinessDocumentOrderDO businessDocumentOrderDO) {
|
||||
businessDocumentOrderDO.setWeightMin( businessDocumentOrderDO.getWeightMin() == null ? BigDecimal.ZERO : businessDocumentOrderDO.getWeightMin());
|
||||
businessDocumentOrderDO.setWeightMax( businessDocumentOrderDO.getWeightMax() == null ? BigDecimal.ZERO : businessDocumentOrderDO.getWeightMax());
|
||||
businessDocumentOrderDO.setDeliveryFreight( businessDocumentOrderDO.getDeliveryFreight() == null ? BigDecimal.ZERO : businessDocumentOrderDO.getDeliveryFreight());
|
||||
businessDocumentOrderDO.setTransportationUnitPrice( businessDocumentOrderDO.getTransportationUnitPrice() == null ? BigDecimal.ZERO : businessDocumentOrderDO.getTransportationUnitPrice());
|
||||
//businessDocumentOrderDO.setHighestPrice( businessDocumentOrderDO.getHighestPrice() == null ? BigDecimal.ZERO : businessDocumentOrderDO.getHighestPrice());
|
||||
// businessDocumentOrderDO.setMaximumBidPrice( businessDocumentOrderDO.getMaximumBidPrice() == null ? BigDecimal.ZERO : businessDocumentOrderDO.getMaximumBidPrice());
|
||||
|
||||
}
|
||||
/**
|
||||
* 构建货物名称信息
|
||||
* @param tmsCargoInfoDTO 货物信息
|
||||
* @param tmsOrderAddDTO 订单信息
|
||||
* @return 格式化的货物名称字符串,如果货物名称为空则返回null
|
||||
*/
|
||||
private String buildCargoNameInfo(BusinessDocumentCargoMultiDTO tmsCargoInfoDTO, BusinessDocumentOrderDO tmsOrderAddDTO) {
|
||||
// 早期返回:如果货物名称为空,返回null
|
||||
if (tmsCargoInfoDTO.getCargoName() == null || StringUtils.isEmpty(tmsCargoInfoDTO.getCargoName())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
StringBuilder goodsInfo = new StringBuilder();
|
||||
goodsInfo.append(tmsCargoInfoDTO.getCargoName());
|
||||
|
||||
|
||||
// 非罐车运输:使用cargoNum和cargoUnitName
|
||||
if (tmsCargoInfoDTO.getCargoNum() != null) {
|
||||
goodsInfo.append("*").append(tmsCargoInfoDTO.getCargoNum());
|
||||
}
|
||||
|
||||
if (tmsCargoInfoDTO.getCargoUnitName() != null && StringUtils.isNotEmpty(tmsCargoInfoDTO.getCargoUnitName())) {
|
||||
goodsInfo.append(tmsCargoInfoDTO.getCargoUnitName());
|
||||
}
|
||||
|
||||
|
||||
return goodsInfo.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 提取机械编号信息
|
||||
* @param tmsCargoInfoDTO 货物信息
|
||||
* @return 机械编号字符串,如果机械编号为空则返回null
|
||||
*/
|
||||
private String extractMachineCode(BusinessDocumentCargoMultiDTO tmsCargoInfoDTO) {
|
||||
// 早期返回:如果机械编号为空,返回null
|
||||
if (tmsCargoInfoDTO.getMachineCode() == null || StringUtils.isEmpty(tmsCargoInfoDTO.getMachineCode())) {
|
||||
return null;
|
||||
}
|
||||
|
||||
return tmsCargoInfoDTO.getMachineCode();
|
||||
}
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
*/
|
||||
@@ -68,4 +655,44 @@ public class BusinessDocumentOrderDomainService {
|
||||
public Boolean execute(Long[] ids) {
|
||||
return businessDocumentOrderService.execute(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询编码对应名称
|
||||
*
|
||||
* @param serviceRequireId
|
||||
* @param sysDictItem
|
||||
* @param serviceRequire
|
||||
* @return
|
||||
*/
|
||||
private String findName(String[] serviceRequireId, SysDictData sysDictItem, StringBuilder serviceRequire) {
|
||||
List<SysDictData> dictDataList = dictDataUtils.getDictDataList();
|
||||
Map<String, List<SysDictData>> map = dictDataList.stream().collect(Collectors.groupingBy(SysDictData::getDictType));
|
||||
List<SysDictData> dictData = new ArrayList<>();
|
||||
if (map != null){
|
||||
if (map.get(DictTypeEnum.SERVICE_REQUIREMENT.getTypeCode()) != null){
|
||||
dictData.addAll(map.get(DictTypeEnum.SERVICE_REQUIREMENT.getTypeCode()));
|
||||
}
|
||||
if (map.get(DictTypeEnum.VEHICLE_LENGTH.getTypeCode()) != null){
|
||||
dictData.addAll(map.get(DictTypeEnum.VEHICLE_LENGTH.getTypeCode()));
|
||||
}
|
||||
if (map.get(DictTypeEnum.VEHICLE_TYPE.getTypeCode()) != null){
|
||||
dictData.addAll(map.get(DictTypeEnum.VEHICLE_TYPE.getTypeCode()));
|
||||
}
|
||||
}
|
||||
if(dictData != null && dictData.size()>0){
|
||||
for (int i = 0; i < serviceRequireId.length; i++) {
|
||||
if (serviceRequireId[i].length() > 0) {
|
||||
sysDictItem = dictDataUtils.getDictData(dictData, serviceRequireId[i]);
|
||||
if (sysDictItem != null){
|
||||
serviceRequire.append(sysDictItem.getDictLabel());
|
||||
if (i < serviceRequireId.length - 1) {
|
||||
serviceRequire.append(",");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return serviceRequire.toString();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
+3
-1
@@ -9,7 +9,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service接口
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2026-01-27
|
||||
*/
|
||||
@@ -35,6 +35,8 @@ public interface IExecuteOrderService extends IService<ExecuteOrder>
|
||||
*/
|
||||
public Boolean delete(Long[] ids);
|
||||
|
||||
public Boolean issueDocuments(Long[] ids);
|
||||
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
|
||||
+19
-1
@@ -1,5 +1,6 @@
|
||||
package com.mhd.oms.domain.executeOrder.repository.persistence;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.mhd.oms.domain.executeOrder.entity.ExecuteOrder;
|
||||
import com.mhd.oms.domain.executeOrder.repository.facade.IExecuteOrderService;
|
||||
@@ -15,7 +16,7 @@ import java.util.List;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Service业务层处理
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2026-01-27
|
||||
*/
|
||||
@@ -68,6 +69,23 @@ public class ExecuteOrderImpl extends ServiceImpl<ExecuteOrderMapper, ExecuteOrd
|
||||
return this.updateBatchById(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean issueDocuments(Long[] ids) {
|
||||
for (Long id:ids){
|
||||
ExecuteOrder executeOrder=executeOrderMapper.selectById(id);
|
||||
if (ObjectUtil.isNotNull(executeOrder)){
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 修改【请填写功能名称】
|
||||
*/
|
||||
|
||||
+4
-1
@@ -10,7 +10,7 @@ import org.springframework.stereotype.Service;
|
||||
import java.util.List;
|
||||
/**
|
||||
* 【请填写功能名称】
|
||||
*
|
||||
*
|
||||
* @author gen
|
||||
* @date 2026-01-27
|
||||
*/
|
||||
@@ -51,6 +51,9 @@ public class ExecuteOrderDomainService {
|
||||
public Boolean delete(Long[] ids) {
|
||||
return executeOrderService.delete(ids);
|
||||
}
|
||||
public Boolean issueDocuments(Long[] ids) {
|
||||
return executeOrderService.issueDocuments(ids);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
|
||||
+32
@@ -67,4 +67,36 @@ public class BusinessDocumentCargoMultiDTO extends BaseVOEntity{
|
||||
|
||||
@ApiModelProperty(name = "权限菜单ID")
|
||||
private Long permissionMenuId;
|
||||
|
||||
@ApiModelProperty("货物名称")
|
||||
private String cargoName;
|
||||
|
||||
@ApiModelProperty("货物单位ID")
|
||||
private String cargoUnitId;
|
||||
|
||||
@ApiModelProperty("货物单位名字")
|
||||
private String cargoUnitName;
|
||||
|
||||
@ApiModelProperty(value = "货物数量")
|
||||
private BigDecimal cargoNum;
|
||||
|
||||
private BigDecimal weight;
|
||||
@ApiModelProperty(value = "重量单位ID")
|
||||
private String weightUnitId;
|
||||
@ApiModelProperty(value = "重量单位名称")
|
||||
private String weightUnit;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "数量单位ID")
|
||||
private String quantityUnitId;
|
||||
@ApiModelProperty(value = "数量单位名称")
|
||||
private String quantityUnit;
|
||||
|
||||
|
||||
@ApiModelProperty("整机表编号")
|
||||
private String machineCode;
|
||||
|
||||
@ApiModelProperty("")
|
||||
private String materialCode;
|
||||
|
||||
}
|
||||
|
||||
+15
@@ -1,6 +1,10 @@
|
||||
package com.mhd.oms.interfaces.dto.businessDocumentOrder;
|
||||
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.oms.domain.businessDocumentAddressMulti.entity.BusinessDocumentAddressMulti;
|
||||
import com.mhd.oms.domain.businessDocumentAddressMulti.repository.todo.BusinessDocumentAddressMultiDO;
|
||||
import com.mhd.oms.domain.businessDocumentCargoMulti.entity.BusinessDocumentCargoMulti;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO;
|
||||
import lombok.Data;
|
||||
import java.util.Date;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
@@ -702,4 +706,15 @@ public class BusinessDocumentOrderDTO extends BaseVOEntity{
|
||||
@ApiModelProperty("预约单号")
|
||||
private String reservationOrderNumber;
|
||||
|
||||
@ApiModelProperty("业务单地址集合")
|
||||
private List<BusinessDocumentAddressMultiDTO> businessDocumentAddressMultiDTOList;
|
||||
|
||||
@ApiModelProperty("业务单货物集合")
|
||||
private List<BusinessDocumentCargoMulti> businessDocumentCargoMultiList;
|
||||
|
||||
@ApiModelProperty(value = "装货地址集合")
|
||||
private List<BusinessDocumentAddressMultiDTO> loadingAddressList;
|
||||
@ApiModelProperty(value = "卸货地址集合")
|
||||
private List<BusinessDocumentAddressMultiDTO> unloadAddressList;
|
||||
|
||||
}
|
||||
|
||||
+19
-16
@@ -4,13 +4,7 @@ import java.util.List;
|
||||
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import com.mhd.oms.interfaces.dto.executeOrder.ExecuteOrderDTO;
|
||||
import com.mhd.oms.domain.executeOrder.repository.todo.ExecuteOrderDO;
|
||||
import com.mhd.oms.domain.executeOrder.repository.po.ExecuteOrderPO;
|
||||
@@ -22,7 +16,7 @@ import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
|
||||
/**
|
||||
* 【请填写功能名称】Api
|
||||
* 【执行单】Api
|
||||
*
|
||||
* @author gen
|
||||
* @date 2026-01-27
|
||||
@@ -37,9 +31,9 @@ public class ExecuteOrderApi extends BaseController{
|
||||
private ExecuteOrderAssembler executeOrderAssembler;
|
||||
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
* 分页查询【执行单】列表
|
||||
*/
|
||||
@ApiOperation("查询【请填写功能名称】列表")
|
||||
@ApiOperation("查询【执行单】列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(ExecuteOrderDTO executeOrderDTO)
|
||||
{
|
||||
@@ -51,9 +45,9 @@ public class ExecuteOrderApi extends BaseController{
|
||||
}
|
||||
|
||||
/**
|
||||
* 编辑【请填写功能名称】
|
||||
* 编辑【执行单】
|
||||
*/
|
||||
@ApiOperation("编辑【请填写功能名称】")
|
||||
@ApiOperation("编辑【执行单】")
|
||||
@PostMapping("/edit")
|
||||
public AjaxResult edit(@RequestBody ExecuteOrderDTO executeOrderDTO)
|
||||
{
|
||||
@@ -67,9 +61,9 @@ public class ExecuteOrderApi extends BaseController{
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量删除【请填写功能名称】
|
||||
* 批量删除【执行单】
|
||||
*/
|
||||
@ApiOperation("批量删除【请填写功能名称】")
|
||||
@ApiOperation("批量删除【执行单】")
|
||||
@DeleteMapping("/deleteByIds/{ids}")
|
||||
public AjaxResult delete(@PathVariable Long[] ids)
|
||||
{
|
||||
@@ -77,9 +71,9 @@ public class ExecuteOrderApi extends BaseController{
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取【请填写功能名称】详细信息
|
||||
* 获取【执行单】详细信息
|
||||
*/
|
||||
@ApiOperation("获取【请填写功能名称】")
|
||||
@ApiOperation("获取【执行单】")
|
||||
@GetMapping(value = "/getInfo/{id}")
|
||||
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||
{
|
||||
@@ -88,6 +82,15 @@ public class ExecuteOrderApi extends BaseController{
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 批量下发【执行单】
|
||||
*/
|
||||
@ApiOperation("批量下发【执行单】")
|
||||
@PostMapping("/issueDocuments")
|
||||
public AjaxResult issueDocuments(@RequestParam("ids") Long[] ids)
|
||||
{
|
||||
return toAjax(executeOrderApplicationService.issueDocuments(ids));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -0,0 +1,201 @@
|
||||
package com.mhd.oms.util;
|
||||
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import com.mhd.common.core.domain.entity.R;
|
||||
import com.mhd.common.core.utils.StringUtils;
|
||||
import com.mhd.system.api.SystemServiceFeign;
|
||||
import com.mhd.system.api.domain.SysDictData;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 普通字典查询
|
||||
*/
|
||||
@Component
|
||||
public class DictDataUtils {
|
||||
|
||||
@Autowired
|
||||
private SystemServiceFeign systemServiceFeign;
|
||||
|
||||
/**
|
||||
* 获取全部通用字典
|
||||
* @return
|
||||
*/
|
||||
public List<SysDictData> getDictDataList(){
|
||||
List<SysDictData> list = new ArrayList<>();
|
||||
//通过feign调用获取通用数据字典
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setTopOrganizationId(0L);
|
||||
R<List<SysDictData>> result = systemServiceFeign.getDictDataList(sysDictData);
|
||||
if (result.getCode() == 200){
|
||||
list = result.getData();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过字典类别获取list
|
||||
* @param dictTypeCode
|
||||
* @return
|
||||
*/
|
||||
public List<SysDictData> getDictDataList(String dictTypeCode){
|
||||
List<SysDictData> list = new ArrayList<>();
|
||||
//通过feign调用获取通用数据字典
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setTopOrganizationId(0L);
|
||||
sysDictData.setDictType(dictTypeCode);
|
||||
R<List<SysDictData>> result = systemServiceFeign.getDictDataList(sysDictData);
|
||||
if (result.getCode() == 200){
|
||||
list = result.getData();
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过字典类别和编码获取字典
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
public SysDictData getDictDataByValue(String dictType, String dictValue){
|
||||
if (StringUtils.isBlank(dictType) || StringUtils.isBlank(dictValue)){
|
||||
return null;
|
||||
}
|
||||
List<SysDictData> list = new ArrayList<>();
|
||||
//通过feign调用获取通用数据字典
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setTopOrganizationId(0L);
|
||||
sysDictData.setDictType(dictType);
|
||||
sysDictData.setDictValue(dictValue);
|
||||
R<List<SysDictData>> result = systemServiceFeign.getDictDataList(sysDictData);
|
||||
if (result.getCode() == 200){
|
||||
list = result.getData();
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(list) && ! list.isEmpty()){
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过字典类别和名称获取字典
|
||||
* @param dictType
|
||||
* @return
|
||||
*/
|
||||
public SysDictData getDictDataByLable(String dictType, String dictLable){
|
||||
if (StringUtils.isBlank(dictType) || StringUtils.isBlank(dictLable)){
|
||||
return null;
|
||||
}
|
||||
List<SysDictData> list = new ArrayList<>();
|
||||
//通过feign调用获取通用数据字典
|
||||
SysDictData sysDictData = new SysDictData();
|
||||
sysDictData.setTopOrganizationId(0L);
|
||||
sysDictData.setDictType(dictType);
|
||||
sysDictData.setDictLabel(dictLable);
|
||||
R<List<SysDictData>> result = systemServiceFeign.getDictDataList(sysDictData);
|
||||
if (result.getCode() == 200){
|
||||
list = result.getData();
|
||||
}
|
||||
if (CollectionUtil.isNotEmpty(list) && list.size() > 0){
|
||||
return list.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过给定的值和字段类型,获取数据字典
|
||||
* @param list
|
||||
* @param dictValue
|
||||
* @return
|
||||
*/
|
||||
public SysDictData getDictData(List<SysDictData> list, String dictValue){
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
Map<String, SysDictData> menuMap = list.stream().collect(Collectors.toMap(SysDictData::getDictValue, Function.identity(), (key1, key2) -> key2));
|
||||
SysDictData sysDictData = menuMap.get(dictValue);
|
||||
return sysDictData;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* 通过给定的值和字段类型,获取数据字典
|
||||
* @param list
|
||||
* @param dictLable
|
||||
* @return
|
||||
*/
|
||||
public SysDictData getDictDataForLable(List<SysDictData> list, String dictLable){
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
Map<String, SysDictData> menuMap = list.stream().collect(Collectors.toMap(SysDictData::getDictLabel, Function.identity(), (key1, key2) -> key2));
|
||||
SysDictData sysDictData = menuMap.get(dictLable);
|
||||
return sysDictData;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过给定的值和字段类型,获取数据字典
|
||||
* @param list
|
||||
* @param dictValue
|
||||
* @return
|
||||
*/
|
||||
public SysDictData getDictDataByTypeAndValue(List<SysDictData> list, String dictType, String dictValue){
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
Map<String, List<SysDictData>> collect = list.stream().collect(Collectors.groupingBy(SysDictData::getDictType));
|
||||
List<SysDictData> dictDataList = collect.get(dictType);
|
||||
if (CollectionUtil.isNotEmpty(dictDataList)){
|
||||
Map<String, SysDictData> menuMap = dictDataList.stream().collect(Collectors.toMap(SysDictData::getDictValue, Function.identity(), (key1, key2) -> key2));
|
||||
SysDictData sysDictData = menuMap.get(dictValue);
|
||||
return sysDictData;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
/**
|
||||
* 通过给定的值和字段值,获取数据字典
|
||||
* @param list
|
||||
* @param dictLable
|
||||
* @return
|
||||
*/
|
||||
public SysDictData getDictDataByTypeAndLable(List<SysDictData> list, String dictType, String dictLable){
|
||||
if (CollectionUtil.isNotEmpty(list)){
|
||||
Map<String, List<SysDictData>> collect = list.stream().collect(Collectors.groupingBy(SysDictData::getDictType));
|
||||
List<SysDictData> dictDataList = collect.get(dictType);
|
||||
if (CollectionUtil.isNotEmpty(dictDataList)){
|
||||
Map<String, SysDictData> menuMap = dictDataList.stream().collect(Collectors.toMap(SysDictData::getDictLabel, Function.identity(), (key1, key2) -> key2));
|
||||
SysDictData sysDictData = menuMap.get(dictLable);
|
||||
return sysDictData;
|
||||
}else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过类别和编码获取字典名称
|
||||
* @param type
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
public String getSysDictItemValue(String type, String code) {
|
||||
SysDictData dictDataList = this.getDictDataByValue(type, code);
|
||||
if (dictDataList == null)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
return dictDataList.getDictValue();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package com.mhd.oms.util;
|
||||
|
||||
public enum DictTypeEnum {
|
||||
VEHICLE_TYPE("vehicle_type", "车型"),
|
||||
VEHICLE_ENERGY_TYPE("vehicle_energy_type", "车辆能源类型"),
|
||||
LINCESE_COLOR("license_color", "车牌颜色"),
|
||||
ZHENGJIANLEIXING("zhengjianleixing", "证件类型"),
|
||||
ZHUNJIACHEXING("zhunjiachexing", "准驾车型"),
|
||||
MARKER_STATE("marker_state", "标记状态"),
|
||||
ZAIZHONG("zaizhong", "载重"),
|
||||
VEHICLE_LENGTH("vehicle_length", "车长"),
|
||||
AXLENUM("axlenum", "车轴数"),
|
||||
GROSS_MASS("gross_mass", "总质量"),
|
||||
VEHICLE_VOLUME("vehicle_volume", "容积"),
|
||||
BANK("bank", "银行名称"),
|
||||
SHIP_TYPE("ship_type", "船舶类型"),
|
||||
PACK_TYPE("pack_type", "包装方式"),
|
||||
TIMETYPE("time_type", "装卸货时间"),
|
||||
GOODS_TYPE("goods_type", "商品类型"),
|
||||
GOODSUNIT("goods_unit", "货物数量单位(吨、方、件)"),
|
||||
WAYBILL_TYPE("waybill_type", "货单类型"),
|
||||
SERVICE_REQUIREMENT("service_request", "服务要求(发货页面)"),
|
||||
SPECIAL_CHARGES("special_charges", "特殊费用-费用类型"),
|
||||
BUDGET_STATE("budget_state", "特殊费用-收支类型"),
|
||||
SHIPPER_CANCEL_RESON("shipper_cancel_reson", "货主取消运单理由"),
|
||||
UNNATURAL_REASON("abnormal_cause", "异常原因"),
|
||||
PINGAN_FILE_TYPE("pingan_file_type", "平安银行文件类型"),
|
||||
;
|
||||
|
||||
private String typeCode;
|
||||
private String typeValue;
|
||||
|
||||
DictTypeEnum(String typeCode, String typeValue) {
|
||||
this.typeCode = typeCode;
|
||||
this.typeValue = typeValue;
|
||||
}
|
||||
|
||||
public String getTypeCode() {
|
||||
return typeCode;
|
||||
}
|
||||
|
||||
public void setTypeCode(String typeCode) {
|
||||
this.typeCode = typeCode;
|
||||
}
|
||||
|
||||
public String getTypeValue() {
|
||||
return typeValue;
|
||||
}
|
||||
|
||||
public void setVehicleType(String typeValue) {
|
||||
this.typeValue = typeValue;
|
||||
}
|
||||
}
|
||||
+6
-2
@@ -3,7 +3,7 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper">
|
||||
|
||||
|
||||
<resultMap type="com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO" id="BusinessDocumentOrderResult">
|
||||
<result property="id" column="ID" />
|
||||
<result property="realCreateBy" column="REAL_CREATE_BY" />
|
||||
@@ -673,4 +673,8 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectBusinessDocumentOrderPo"/>
|
||||
<include refid="selectBusinessDocumentOrderPo1"/>
|
||||
</select>
|
||||
</mapper>
|
||||
<select id="selectByMakerCodeNc" parameterType="java.lang.String" resultType="java.lang.String">
|
||||
select DOCUMENT_PREPARER_NC_code from NGWL_TEST_USER."USER" where USER_ID = #{salesmanCodeNc}</select>
|
||||
<select id="selectByMakerCodeNc1" resultType="java.lang.String" parameterType="java.lang.String">
|
||||
select SALESPERSON_NC_CODE from NGWL_TEST_USER."USER" where USER_ID = #{salesmanCodeNc}</select>
|
||||
</mapper>
|
||||
|
||||
Reference in New Issue
Block a user