oms预约单修改
This commit is contained in:
+5
@@ -1,6 +1,7 @@
|
||||
package com.mhd.common.core.domain.po;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.common.core.annotation.fieldsetvalue.NeedSetValue;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@@ -12,6 +13,7 @@ import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
||||
public class UserShipperPo {
|
||||
|
||||
private static final long serialVersionUID = 1L;
|
||||
@@ -266,6 +268,9 @@ public class UserShipperPo {
|
||||
|
||||
@ApiModelProperty("结算币种")
|
||||
private String settlementCurrency;
|
||||
|
||||
@ApiModelProperty("货主code")
|
||||
private String roleCodeShipper;
|
||||
}
|
||||
|
||||
|
||||
|
||||
+1
-1
@@ -775,7 +775,7 @@ public class BusinessDocumentOrderDO extends BaseVOEntity{
|
||||
@ApiModelProperty(value = "审核意见")
|
||||
private String reviewOpinion;
|
||||
|
||||
@ApiModelProperty("订单来源")
|
||||
@ApiModelProperty("订单来源 0.运输,1.仓储")
|
||||
private String orderSource;
|
||||
|
||||
@ApiModelProperty(value = "出入库单号")
|
||||
|
||||
+17
@@ -19,6 +19,8 @@ import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOr
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO;
|
||||
import com.mhd.oms.domain.businessOrderAccount.BusinessOrderAccount;
|
||||
import com.mhd.oms.domain.businessOrderAccount.repository.mapper.BusinessOrderAccountMapper;
|
||||
import com.mhd.oms.domain.reservationOrder.entity.ReservationOrder;
|
||||
import com.mhd.oms.domain.reservationOrder.repository.mapper.ReservationOrderMapper;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentCargoMulti.BusinessDocumentCargoMultiDTO;
|
||||
@@ -64,6 +66,9 @@ public class BusinessDocumentOrderDomainService {
|
||||
|
||||
@Resource
|
||||
private BusinessOrderAccountMapper businessOrderAccountMapper;
|
||||
|
||||
@Resource
|
||||
private ReservationOrderMapper reservationOrderMapper;
|
||||
/**
|
||||
* 分页查询【请填写功能名称】列表
|
||||
*/
|
||||
@@ -564,7 +569,19 @@ public class BusinessDocumentOrderDomainService {
|
||||
tmsOrder.setTopOrganizationId(businessDocumentOrderDO.getTopOrganizationId());
|
||||
}
|
||||
// boolean istrue=businessDocumentOrderService.update(businessDocumentOrderDO);
|
||||
|
||||
int i = businessDocumentOrderMapper.updateById(tmsOrder);
|
||||
if (deliveryFreight != null && deliveryFreight.compareTo(BigDecimal.ZERO) > 0){
|
||||
List<ReservationOrder> reservationOrderList = reservationOrderMapper.selectList(new LambdaQueryWrapper<ReservationOrder>().eq(ReservationOrder::getGoodsNumber, businessDocumentOrderDO.getGoodsNumber()));
|
||||
if (ObjectUtil.isNotEmpty(reservationOrderList) && reservationOrderList.size() > 0) {
|
||||
for (ReservationOrder reservationOrder : reservationOrderList){
|
||||
reservationOrder.setDeliveryFreight(deliveryFreight);
|
||||
reservationOrderMapper.updateById(reservationOrder);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
//保存货物信息及地址信息
|
||||
|
||||
saveAddress2CargoInfo(tmsOrder.getId(), allCargoList, loadingAddressList, unloadAddressList);
|
||||
|
||||
+7
-3
@@ -504,9 +504,6 @@ public class ReservationOrder {
|
||||
@ApiModelProperty(value = "订单结算状态:1未出账、2已出账、3部分结算、4已结算")
|
||||
private Integer settlementStatus;
|
||||
|
||||
@ApiModelProperty(value = "订单类型:0-预约单,1-业务单")
|
||||
private Integer orderType;
|
||||
|
||||
@ApiModelProperty(value = "订单运费结算时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@@ -701,9 +698,16 @@ public class ReservationOrder {
|
||||
|
||||
@ApiModelProperty("业务单号")
|
||||
private String businessOrderNumber;
|
||||
@ApiModelProperty("订单状态(0.待确认,1.待提货,2.待补充,3.运输中,4.已完成,5.已取消)")
|
||||
private Integer orderType;
|
||||
|
||||
@ApiModelProperty("起运时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date departureTime;
|
||||
|
||||
@ApiModelProperty("业务主管")
|
||||
private String salesManager;
|
||||
@ApiModelProperty("审核意见")
|
||||
private String reviewOpinion;
|
||||
}
|
||||
|
||||
+20
-2
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO;
|
||||
import com.mhd.oms.domain.reservationOrder.entity.ReservationOrder;
|
||||
import com.mhd.oms.domain.reservationOrder.repository.po.ReservationOrderPO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
|
||||
import com.mhd.oms.interfaces.dto.resevationOrder.OmsOrderAddDTO;
|
||||
import com.mhd.oms.interfaces.dto.resevationOrder.OmsOrderDTO;
|
||||
import com.mhd.common.core.utils.sms.Result;
|
||||
@@ -16,11 +17,18 @@ import java.security.spec.InvalidKeySpecException;
|
||||
import com.mhd.oms.interfaces.facade.resevationOrder.BatchConfirmResult;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
public interface IOmsAddressMultiService {
|
||||
|
||||
void save(OmsOrderAddDTO tmsOrderAddDTO) throws InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException, SignatureException;
|
||||
|
||||
/**
|
||||
* 更新预约单
|
||||
* @param tmsOrderAddDTO 预约单信息
|
||||
*/
|
||||
void update(OmsOrderAddDTO tmsOrderAddDTO) throws InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException, SignatureException;
|
||||
|
||||
List<ReservationOrderPO> queryList(OmsOrderDTO omsOrderDTO);
|
||||
|
||||
/**
|
||||
@@ -28,14 +36,24 @@ public interface IOmsAddressMultiService {
|
||||
* @param goodsNumber 预约单号
|
||||
* @return 业务单信息
|
||||
*/
|
||||
BusinessDocumentOrderPO confirmReservationOrder(String goodsNumber);
|
||||
Boolean confirmReservationOrder(String goodsNumber);
|
||||
|
||||
/**
|
||||
* 批量确认预约单,生成业务单
|
||||
* @param goodsNumbers 预约单号列表
|
||||
* @return 批量处理结果
|
||||
*/
|
||||
Result<?> batchConfirmReservationOrder(List<String> goodsNumbers);
|
||||
Result<?> batchConfirmReservationOrder(BusinessAuditDTO businessAuditDTO);
|
||||
|
||||
Result<?> batchRejectReservationOrder(List<String> goodsNumbers);
|
||||
|
||||
/**
|
||||
* 根据订单状态(orderType)统计各状态的数量
|
||||
* @return Map<Integer, Long> key为orderType值,value为对应数量
|
||||
*/
|
||||
Map<Integer, Long> countByOrderType();
|
||||
|
||||
Integer cancelReserve(List<String> goodsNumbers);
|
||||
|
||||
OmsOrderDTO getResevationOrderInfo(String goodsNumber);
|
||||
}
|
||||
|
||||
+6
-1
@@ -723,7 +723,7 @@ public class ReservationOrderPO {
|
||||
private String executor;
|
||||
|
||||
@ApiModelProperty("业务单id")
|
||||
private Long businesssOrderId ;
|
||||
private Long businessOrderId ;
|
||||
|
||||
@ApiModelProperty("业务单号")
|
||||
private String businessOrderNumber;
|
||||
@@ -735,4 +735,9 @@ public class ReservationOrderPO {
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date departureTime;
|
||||
|
||||
@ApiModelProperty("业务主管")
|
||||
private String salesManager;
|
||||
@ApiModelProperty("审核意见")
|
||||
private String reviewOpinion;
|
||||
}
|
||||
|
||||
+473
-104
@@ -12,6 +12,7 @@ import com.mhd.common.core.utils.sms.Result;
|
||||
import com.mhd.oms.application.service.businessDocumentOrder.BusinessDocumentOrderApplicationService;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.facade.IBusinessDocumentOrderService;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.entity.BusinessDocumentOrder;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.mapper.BusinessDocumentOrderMapper;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO;
|
||||
import com.mhd.oms.domain.businessDocumentCargoMulti.entity.BusinessDocumentCargoMulti;
|
||||
import com.mhd.oms.domain.businessDocumentCargoMulti.repository.mapper.BusinessDocumentCargoMultiMapper;
|
||||
@@ -30,6 +31,9 @@ import com.mhd.oms.domain.reservationOrder.repository.po.ReservationOrderPO;
|
||||
import com.mhd.oms.enums.*;
|
||||
import com.mhd.oms.infrastructure.feign.ThirdPartyServiceFeign;
|
||||
//import com.mhd.oms.infrastructure.feign.TransportServiceFeign;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessDocumentAddressMultiDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentCargoMulti.BusinessDocumentCargoMultiDTO;
|
||||
import com.mhd.oms.interfaces.dto.resevationOrder.*;
|
||||
import com.mhd.oms.interfaces.facade.resevationOrder.BatchConfirmResult;
|
||||
import com.mhd.oms.util.DictDataUtils;
|
||||
@@ -41,12 +45,16 @@ import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
import com.mhd.common.core.domain.po.UserPo;
|
||||
import com.mhd.common.core.domain.po.UserShipperPo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
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.transaction.annotation.Transactional;
|
||||
import org.springframework.util.CollectionUtils;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
@@ -114,6 +122,9 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
@Autowired
|
||||
private IBusinessDocumentOrderService businessDocumentOrderService;
|
||||
|
||||
@Resource
|
||||
private BusinessDocumentOrderMapper businessDocumentOrderMapper;
|
||||
|
||||
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -424,10 +435,10 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
resevationOrder.setLoadingPhone(firstAddress.getContactPhone());
|
||||
resevationOrder.setLoadingDate(firstAddress.getLayDate());
|
||||
|
||||
resevationOrder.setUnloadAreaId(lastAddress.getAreaCode());
|
||||
resevationOrder.setUnloadName(lastAddress.getAreaCode());
|
||||
resevationOrder.setUnloadAddress(lastAddress.getAddress());
|
||||
String unarea = lastAddress.getAreaCode() + lastAddress.getAddress();
|
||||
resevationOrder.setUnloadAreaId(lastAddress.getAreaCode());
|
||||
resevationOrder.setUnloadName(lastAddress.getAreaCode());
|
||||
resevationOrder.setUnloadAddress(lastAddress.getAddress());
|
||||
String unarea = lastAddress.getAreaCode() + lastAddress.getAddress();
|
||||
/*String ungeo = amapService.geo(unarea);
|
||||
String unloadingLatitude = ungeo.substring(ungeo.indexOf(",") + 1);
|
||||
String unloadingLongitude = ungeo.substring(0,ungeo.indexOf(","));
|
||||
@@ -524,11 +535,11 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
resevationOrder.setTransportationModeId(1);
|
||||
}
|
||||
}
|
||||
//设置是否自动审核
|
||||
//自动审核用户信息(0否1是)
|
||||
//设置是否自动审核
|
||||
//自动审核用户信息(0否1是)
|
||||
// SysConfigSwitch configSwitch = sysConfigSwitchService.queryBySysOrgCode();
|
||||
//查询平台业务员
|
||||
// 从UserCenter服务获取平台业务员信息
|
||||
//查询平台业务员
|
||||
// 从UserCenter服务获取平台业务员信息
|
||||
// UserDTO userDTO = new UserDTO();
|
||||
// userDTO.setUserRole("platAuther");
|
||||
// AjaxResult platAutherResult = AjaxResult.success(userServiceFeign.getUserByTopOrganizationUserAccount(userDTO, "oms"));
|
||||
@@ -867,12 +878,272 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
// tmsBidingDocumentLine.setServiceRate(tmsOrderAddDTO.getServiceRate());
|
||||
// tmsBidingDocumentLine.setSingleVehicleWeight(tmsOrderAddDTO.getSingleVehicleWeight());
|
||||
|
||||
// tmsBidingDocumentLineMapper.insert(tmsBidingDocumentLine);
|
||||
// tmsBidingDocumentLineMapper.insert(tmsBidingDocumentLine);
|
||||
// }
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@Override
|
||||
public void update(OmsOrderAddDTO tmsOrderAddDTO) throws InvalidKeySpecException, NoSuchAlgorithmException, InvalidKeyException, SignatureException {
|
||||
if (StringUtils.isBlank(tmsOrderAddDTO.getGoodsQuantity())) {
|
||||
tmsOrderAddDTO.setGoodsQuantity("0");
|
||||
}
|
||||
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
//获取登录人
|
||||
// 从UserCenter服务获取用户信息
|
||||
AjaxResult userInfoResult = userServiceFeign.getInfo(Long.valueOf(loginUser.getUserid()));
|
||||
if (!userInfoResult.get("code").toString().equals("200")) {
|
||||
throw new ServiceException("获取用户信息失败");
|
||||
}
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
UserPo userPo = objectMapper.convertValue(userInfoResult.get("data"), UserPo.class);
|
||||
|
||||
// 从UserCenter服务获取货主信息
|
||||
AjaxResult shipperInfoResult = userServiceFeign.getShipperByUserId(Long.valueOf(loginUser.getUserid()));
|
||||
if (!shipperInfoResult.get("code").toString().equals("200")) {
|
||||
throw new ServiceException("获取货主信息失败");
|
||||
}
|
||||
|
||||
//处理费用默认值
|
||||
handFee(tmsOrderAddDTO);
|
||||
|
||||
//组织赋值
|
||||
Long organizationId = tmsOrderAddDTO.getOrganizationId();
|
||||
if (ObjectUtil.isNotEmpty(organizationId)) {
|
||||
tmsOrderAddDTO.setOrgId(String.valueOf(organizationId));
|
||||
tmsOrderAddDTO.setOrgName(tmsOrderAddDTO.getOrganizationName());
|
||||
}
|
||||
|
||||
// 获取一份副本等一会需要存储到数据库
|
||||
String swzlUserId = String.valueOf(loginUser.getUserid());
|
||||
|
||||
// 从UserCenter服务获取当前登录用户的货主信息
|
||||
AjaxResult shipperResult = userServiceFeign.getShipperByUserId(Long.valueOf(loginUser.getUserid()));
|
||||
if (!shipperResult.get("code").toString().equals("200")) {
|
||||
throw new ServiceException("您非货主角色或账号已被删除!");
|
||||
}
|
||||
UserShipperPo userShipperPoInfo = objectMapper.convertValue(shipperResult.get("data"), UserShipperPo.class);
|
||||
|
||||
if (userShipperPoInfo == null) {
|
||||
throw new ServiceException("您非货主角色或账号已被删除!");
|
||||
}
|
||||
|
||||
String orderRemark = tmsOrderAddDTO.getOrderRemark();
|
||||
tmsOrderAddDTO.setRemarks(orderRemark);
|
||||
|
||||
tmsOrderAddDTO.setAppointShipperId(String.valueOf(userShipperPoInfo.getShipperId()));
|
||||
|
||||
// 分类处理货物列表
|
||||
List<OmsCargoInfoDTO> allCargoList = tmsOrderAddDTO.getCargoInfoList();
|
||||
|
||||
//获取货主月结标识,
|
||||
int receivableType;
|
||||
int autoAuditOrder;
|
||||
if (userShipperPoInfo.getShipperType() == 2) {
|
||||
// 从UserCenter服务获取企业货主信息
|
||||
AjaxResult companyShipperResult = userServiceFeign.getShipperByUserId(userShipperPoInfo.getUserId());
|
||||
if (!companyShipperResult.get("code").toString().equals("200")) {
|
||||
throw new ServiceException("获取企业货主信息失败");
|
||||
}
|
||||
UserShipperPo companyUserShipperPo = objectMapper.convertValue(companyShipperResult.get("data"), UserShipperPo.class);
|
||||
receivableType = companyUserShipperPo.getMonthlySettlementFlag();
|
||||
autoAuditOrder = companyUserShipperPo.getIsAutoAuditOrder();
|
||||
} else {
|
||||
receivableType = userShipperPoInfo.getMonthlySettlementFlag();
|
||||
autoAuditOrder = userShipperPoInfo.getIsAutoAuditOrder();
|
||||
}
|
||||
tmsOrderAddDTO.setReceivableType(receivableType);
|
||||
|
||||
//非企业员工判断个人信息审核状态x
|
||||
if (userShipperPoInfo.getShipperType() != 2 && userShipperPoInfo.getShipperFill() != 3) { // 假设3代表审核通过
|
||||
throw new ServiceException("未提交个人信息认证或认证未通过,请先认证!");
|
||||
}
|
||||
//企业员工判断企业货主审核状态
|
||||
if (userShipperPoInfo.getShipperType() == 2) {
|
||||
// 从UserCenter服务获取企业用户信息
|
||||
AjaxResult companyUserResult = userServiceFeign.getInfo(userShipperPoInfo.getUserId());
|
||||
if (!companyUserResult.get("code").toString().equals("200")) {
|
||||
throw new ServiceException("获取企业用户信息失败");
|
||||
}
|
||||
userPo = objectMapper.convertValue(companyUserResult.get("data"), UserPo.class);
|
||||
}
|
||||
|
||||
//企业员工判断企业货主审核状态
|
||||
if (userShipperPoInfo.getShipperType() == 2) {
|
||||
// 从UserCenter服务获取企业货主信息
|
||||
AjaxResult companyShipperResult = userServiceFeign.getShipperByUserId(userShipperPoInfo.getUserId());
|
||||
if (!companyShipperResult.get("code").toString().equals("200")) {
|
||||
throw new ServiceException("获取企业货主信息失败");
|
||||
}
|
||||
UserShipperPo companyUserShipperPo = objectMapper.convertValue(companyShipperResult.get("data"), UserShipperPo.class);
|
||||
if (companyUserShipperPo.getShipperFill() != 3) { // 假设3代表审核通过
|
||||
throw new ServiceException("未提交个人信息认证或认证未通过,请先认证!");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新货源单信息
|
||||
*/
|
||||
ReservationOrder resevationOrder = new ReservationOrder();
|
||||
BeanUtils.copyProperties(tmsOrderAddDTO, resevationOrder);
|
||||
String id = tmsOrderAddDTO.getId();
|
||||
resevationOrder.setId(Long.valueOf(id));
|
||||
|
||||
// 设置更新时间戳和用户信息
|
||||
resevationOrder.setUpdateTime(new Date());
|
||||
resevationOrder.setUpdateBy(loginUser.getWlhyLoginUser().getRealname());
|
||||
// resevationOrder.setUpdateByName(userPo.getUserName());
|
||||
|
||||
// 检查ID是否为空
|
||||
if (resevationOrder.getId() == null || resevationOrder.getId() <= 0) {
|
||||
throw new ServiceException("预约单ID不能为空,无法执行更新操作");
|
||||
}
|
||||
List<OmsAddressMultiDTO> loadingAddressList = tmsOrderAddDTO.getLoadingAddressList();//装货地信息集合
|
||||
List<OmsAddressMultiDTO> unloadAddressList = tmsOrderAddDTO.getUnloadAddressList();//卸货地信息集合
|
||||
|
||||
/*if (CollUtil.isEmpty(loadingAddressList)) {
|
||||
throw new ServiceException("请传入装货地址!");
|
||||
}
|
||||
|
||||
if (CollUtil.isEmpty(unloadAddressList)) {
|
||||
throw new ServiceException("请传入卸货地址!");
|
||||
}*/
|
||||
|
||||
String loadCityCounty = "", unloadCityCounty = "";
|
||||
//当是短驳的时候不走这个逻辑
|
||||
/*for (int i = 0; i < loadingAddressList.size(); i++) {
|
||||
//根据行政区划代码获取省市县名称
|
||||
String areaName= sysComboService.getLoadOrUnloadName(loadingAddressList.get(i).getAreaCode());
|
||||
loadingAddressList.get(i).setAreaName(areaName);
|
||||
// 简称
|
||||
String shortName= sysComboService.getCityCountyName(loadingAddressList.get(i).getAreaCode());
|
||||
loadingAddressList.get(i).setShortName(shortName);
|
||||
//获取装卸货地经纬度
|
||||
String[] lng2Lat = setLngAndLat(loadingAddressList.get(i).getAreaCode(), loadingAddressList.get(i).getLongitude(),
|
||||
loadingAddressList.get(i).getLatitude(), loadingAddressList.get(i).getAddress());
|
||||
if (null != lng2Lat) {
|
||||
loadingAddressList.get(i).setLongitude(lng2Lat[0]);
|
||||
loadingAddressList.get(i).setLatitude(lng2Lat[1]);
|
||||
}
|
||||
//获取装货时间
|
||||
SysDictData sysDictData = getLayTime(loadingAddressList.get(i).getLayTimeId());
|
||||
if (sysDictData != null) {
|
||||
loadingAddressList.get(i).setLayTimeId(sysDictData.getDictValue());
|
||||
loadingAddressList.get(i).setLayTime(sysDictData.getDictLabel());
|
||||
}
|
||||
|
||||
loadingAddressList.get(i).setSort(i);
|
||||
}
|
||||
for (int i = 0; i < unloadAddressList.size(); i++) {
|
||||
//根据行政区划代码获取省市县名称
|
||||
//String areaName= sysComboService.getLoadOrUnloadName(unloadAddressList.get(i).getAreaCode());
|
||||
//unloadAddressList.get(i).setAreaName(areaName);
|
||||
// 简称
|
||||
//String shortName= sysComboService.getCityCountyName(unloadAddressList.get(i).getAreaCode());
|
||||
//unloadAddressList.get(i).setShortName(shortName);
|
||||
//获取装卸货地经纬度
|
||||
String[] lng2Lat = setLngAndLat(unloadAddressList.get(i).getAreaCode(), unloadAddressList.get(i).getLongitude(),
|
||||
unloadAddressList.get(i).getLatitude(), unloadAddressList.get(i).getAddress());
|
||||
if (null != lng2Lat) {
|
||||
unloadAddressList.get(i).setLongitude(lng2Lat[0]);
|
||||
unloadAddressList.get(i).setLatitude(lng2Lat[1]);
|
||||
}
|
||||
//获取装货时间
|
||||
SysDictData sysDictData = getLayTime(unloadAddressList.get(i).getLayTimeId());
|
||||
if (sysDictData != null) {
|
||||
unloadAddressList.get(i).setLayTimeId(sysDictData.getDictValue());
|
||||
unloadAddressList.get(i).setLayTime(sysDictData.getDictLabel());
|
||||
}
|
||||
|
||||
|
||||
unloadAddressList.get(i).setSort(i);
|
||||
// }
|
||||
//多装多卸获取第一个装货地址和最后一个卸货地址 获取省市县简称
|
||||
loadCityCounty = sysComboService.getCityCountyName(loadingAddressList.get(0).getAreaCode());
|
||||
unloadCityCounty = sysComboService.getCityCountyName(unloadAddressList.get(unloadAddressList.size() - 1).getAreaCode());
|
||||
resevationOrder.setLineTitleLeft(loadCityCounty);
|
||||
resevationOrder.setLineTitleRight(unloadCityCounty);
|
||||
}*/
|
||||
//获取第一条装货地址和获取最后一条卸货地址
|
||||
OmsAddressMultiDTO firstAddress = loadingAddressList.get(0);
|
||||
OmsAddressMultiDTO lastAddress = unloadAddressList.get(unloadAddressList.size() - 1);
|
||||
resevationOrder.setLoadingAreaId(firstAddress.getAreaCode());
|
||||
resevationOrder.setLoadingName(firstAddress.getAreaCode());
|
||||
resevationOrder.setLoadingAddress(firstAddress.getAddress());
|
||||
String area = firstAddress.getAreaCode() + firstAddress.getAddress();
|
||||
/*String geo = amapService.geo(area);
|
||||
String loadingLatitude = geo.substring(geo.indexOf(",") + 1);
|
||||
String loadingLongitude = geo.substring(0,geo.indexOf(","));
|
||||
resevationOrder.setLoadingLongitude(loadingLongitude);
|
||||
resevationOrder.setLoadingLatitude(loadingLatitude);
|
||||
firstAddress.setLatitude(loadingLatitude);
|
||||
firstAddress.setLongitude(loadingLongitude);*/
|
||||
resevationOrder.setLineTitleLeft(firstAddress.getAreaCode());
|
||||
resevationOrder.setLineTitleRight(lastAddress.getAreaCode());
|
||||
resevationOrder.setFreighterName(firstAddress.getContactName());
|
||||
resevationOrder.setLoadingPhone(firstAddress.getContactPhone());
|
||||
resevationOrder.setLoadingDate(firstAddress.getLayDate());
|
||||
|
||||
resevationOrder.setUnloadAreaId(lastAddress.getAreaCode());
|
||||
resevationOrder.setUnloadName(lastAddress.getAreaCode());
|
||||
resevationOrder.setUnloadAddress(lastAddress.getAddress());
|
||||
String unarea = lastAddress.getAreaCode() + lastAddress.getAddress();
|
||||
/*String ungeo = amapService.geo(unarea);
|
||||
String unloadingLatitude = ungeo.substring(ungeo.indexOf(",") + 1);
|
||||
String unloadingLongitude = ungeo.substring(0,ungeo.indexOf(","));
|
||||
lastAddress.setLatitude(unloadingLatitude);
|
||||
lastAddress.setLongitude(unloadingLongitude);
|
||||
resevationOrder.setUnloadLongitude(unloadingLongitude);
|
||||
resevationOrder.setUnloadLatitude(unloadingLatitude);*/
|
||||
resevationOrder.setDischargerName(lastAddress.getContactName());
|
||||
resevationOrder.setUnloadPhone(lastAddress.getContactPhone());
|
||||
resevationOrder.setUnloadingData(lastAddress.getLayDate());
|
||||
// 执行更新操作
|
||||
int result = resevationOrderMapper.updateById(resevationOrder);
|
||||
if (result == 0) {
|
||||
throw new ServiceException("更新失败:未找到对应的预约单记录");
|
||||
}
|
||||
|
||||
// 更新费用科目信息
|
||||
List<OmsOrderAccount> tmsOrderAccountList = tmsOrderAddDTO.getTmsOrderAccountList();
|
||||
if (ObjectUtil.isNotNull(tmsOrderAccountList) && tmsOrderAccountList.size() > 0) {
|
||||
// 先删除旧的费用科目信息
|
||||
tmsOrderAccountMapper.delete(new LambdaQueryWrapper<OmsOrderAccount>().eq(OmsOrderAccount::getOrderId, String.valueOf(resevationOrder.getId())));
|
||||
|
||||
// 插入新的费用科目信息
|
||||
for (OmsOrderAccount tmsOrderAccount : tmsOrderAccountList) {
|
||||
tmsOrderAccount.setIsDelete(0);
|
||||
tmsOrderAccount.setOrderId(String.valueOf(resevationOrder.getId()));
|
||||
tmsOrderAccount.setCreateBy(String.valueOf(userPo.getUserId()));
|
||||
tmsOrderAccount.setCreateTime(new Date());
|
||||
|
||||
// 设置组织信息
|
||||
if (tmsOrderAddDTO.getOrganizationId() != null) {
|
||||
tmsOrderAccount.setOrganizationId(tmsOrderAddDTO.getOrganizationId());
|
||||
}
|
||||
if (tmsOrderAddDTO.getOrganizationName() != null) {
|
||||
tmsOrderAccount.setOrganizationName(tmsOrderAddDTO.getOrganizationName());
|
||||
}
|
||||
if (tmsOrderAddDTO.getTopOrganizationId() != null) {
|
||||
tmsOrderAccount.setTopOrganizationId(tmsOrderAddDTO.getTopOrganizationId());
|
||||
}
|
||||
|
||||
tmsOrderAccountMapper.insert(tmsOrderAccount);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新货物信息及地址信息
|
||||
saveAddress2CargoInfo(String.valueOf(resevationOrder.getId()), allCargoList, tmsOrderAddDTO.getLoadingAddressList(), tmsOrderAddDTO.getUnloadAddressList());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<ReservationOrderPO> queryList(OmsOrderDTO omsOrderDTO) {
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
@@ -882,6 +1153,10 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
omsOrderDTO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
Long organizationId = loginUser.getUserPo().getOrganizationId();
|
||||
if (organizationId !=2827L){
|
||||
omsOrderDTO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
List<ReservationOrderPO> reservationOrderPOS = reservationOrderDomainService.queryList(omsOrderDTO);
|
||||
for (ReservationOrderPO reservationOrderPO : reservationOrderPOS){
|
||||
List<ReservationCargoInfo> reservationCargoInfoList = reservationCargoInfoMapper.selectList(new LambdaQueryWrapper<ReservationCargoInfo>().eq(ReservationCargoInfo::getOrderId, reservationOrderPO.getId()));
|
||||
@@ -1078,7 +1353,7 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
// }
|
||||
|
||||
@Override
|
||||
public BusinessDocumentOrderPO confirmReservationOrder(String goodsNumber) {
|
||||
public Boolean confirmReservationOrder(String goodsNumber) {
|
||||
|
||||
LambdaQueryWrapper<ReservationOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ReservationOrder::getGoodsNumber, goodsNumber);
|
||||
@@ -1102,71 +1377,27 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
|
||||
BusinessDocumentOrderDO businessDocumentOrderDO = new BusinessDocumentOrderDO();
|
||||
|
||||
// 基本信息映射
|
||||
businessDocumentOrderDO.setGoodsNumber(OrderSequence.getOrderCodeByDate(new Date())); // 生成业务单号
|
||||
businessDocumentOrderDO.setGoodsNumber(reservationOrder.getGoodsNumber()); // 生成业务单号
|
||||
businessDocumentOrderDO.setOrderStatus(0L); // 业务单状态:0-待审核
|
||||
businessDocumentOrderDO.setReviewStatus(0L); // 审核状态:0-未审核
|
||||
businessDocumentOrderDO.setExecuteStatus(0L); // 执行状态:0-无状态
|
||||
businessDocumentOrderDO.setExecuteStatus(0L);
|
||||
|
||||
|
||||
businessDocumentOrderDO.setReservationOrderId(reservationOrder.getId());
|
||||
businessDocumentOrderDO.setReservationOrderNumber(reservationOrder.getGoodsNumber());
|
||||
BeanUtils.copyProperties(reservationOrder, businessDocumentOrderDO);
|
||||
|
||||
businessDocumentOrderDO.setGoodsName(reservationOrder.getGoodsName());
|
||||
businessDocumentOrderDO.setGoodsTypeId(reservationOrder.getGoodsTypeId());
|
||||
businessDocumentOrderDO.setWeightMin(reservationOrder.getWeightMin());
|
||||
businessDocumentOrderDO.setWeightMax(reservationOrder.getWeightMax());
|
||||
businessDocumentOrderDO.setGoodsUntis(reservationOrder.getGoodsUntis());
|
||||
businessDocumentOrderDO.setGoodsUntisId(reservationOrder.getGoodsUntisId());
|
||||
businessDocumentOrderDO.setLoadingName(reservationOrder.getLoadingName());
|
||||
businessDocumentOrderDO.setLoadingAreaId(reservationOrder.getLoadingAreaId());
|
||||
businessDocumentOrderDO.setLoadingAddress(reservationOrder.getLoadingAddress());
|
||||
businessDocumentOrderDO.setLoadingLongitude(reservationOrder.getLoadingLongitude());
|
||||
businessDocumentOrderDO.setLoadingLatitude(reservationOrder.getLoadingLatitude());
|
||||
businessDocumentOrderDO.setLoadingPhone(reservationOrder.getLoadingPhone());
|
||||
businessDocumentOrderDO.setLoadingDate(reservationOrder.getLoadingDate());
|
||||
|
||||
businessDocumentOrderDO.setUnloadName(reservationOrder.getUnloadName());
|
||||
businessDocumentOrderDO.setUnloadAreaId(reservationOrder.getUnloadAreaId());
|
||||
businessDocumentOrderDO.setUnloadAddress(reservationOrder.getUnloadAddress());
|
||||
businessDocumentOrderDO.setUnloadLongitude(reservationOrder.getUnloadLongitude());
|
||||
businessDocumentOrderDO.setUnloadLatitude(reservationOrder.getUnloadLatitude());
|
||||
businessDocumentOrderDO.setUnloadPhone(reservationOrder.getUnloadPhone());
|
||||
businessDocumentOrderDO.setUnloadingData(reservationOrder.getUnloadingData());
|
||||
businessDocumentOrderDO.setFreighterName(reservationOrder.getFreighterName());
|
||||
businessDocumentOrderDO.setDischargerName(reservationOrder.getDischargerName());
|
||||
businessDocumentOrderDO.setRemarks(reservationOrder.getRemarks());
|
||||
businessDocumentOrderDO.setTransportationModeId(reservationOrder.getTransportationModeId() != null ?
|
||||
reservationOrder.getTransportationModeId().longValue() : null);
|
||||
businessDocumentOrderDO.setTransportationName(reservationOrder.getTransportationName());
|
||||
businessDocumentOrderDO.setCarType(reservationOrder.getCarType());
|
||||
businessDocumentOrderDO.setCarTypeName(reservationOrder.getCarTypeName());
|
||||
businessDocumentOrderDO.setServiceRequireId(reservationOrder.getServiceRequireId());
|
||||
businessDocumentOrderDO.setServiceRequire(reservationOrder.getServiceRequire());
|
||||
businessDocumentOrderDO.setAppointShipperId(reservationOrder.getAppointShipperId());
|
||||
businessDocumentOrderDO.setAppointShipper(reservationOrder.getAppointShipper());
|
||||
businessDocumentOrderDO.setReceivableType(reservationOrder.getReceivableType() != null ?
|
||||
reservationOrder.getReceivableType().longValue() : 2L);
|
||||
|
||||
businessDocumentOrderDO.setOrderShippingType(reservationOrder.getOrderShippingType() != null ?
|
||||
reservationOrder.getOrderShippingType().longValue() : 1L);
|
||||
|
||||
|
||||
businessDocumentOrderDO.setOrganizationId(reservationOrder.getOrganizationId());
|
||||
businessDocumentOrderDO.setOrganizationName(reservationOrder.getOrganizationName());
|
||||
businessDocumentOrderDO.setTopOrganizationId(reservationOrder.getTopOrganizationId());
|
||||
businessDocumentOrderDO.setOrgId(reservationOrder.getOrgId());
|
||||
businessDocumentOrderDO.setOrgName(reservationOrder.getOrgName());
|
||||
|
||||
|
||||
businessDocumentOrderDO.setRealCreateBy(String.valueOf(loginUser.getUserid()));
|
||||
businessDocumentOrderDO.setRealCreateName(loginUser.getUsername());
|
||||
businessDocumentOrderDO.setCreateBy(loginUser.getUserid());
|
||||
businessDocumentOrderDO.setCreateByName(loginUser.getUsername());
|
||||
|
||||
businessDocumentOrderDO.setCreateTime(new Date());
|
||||
businessDocumentOrderDO.setUpdateTime(new Date());
|
||||
businessDocumentOrderDO.setDocumentDate(new Date());
|
||||
businessDocumentOrderDO.setPayerType(1L);
|
||||
businessDocumentOrderDO.setLayDate(reservationOrder.getDepartureTime());
|
||||
|
||||
if (businessDocumentOrderDO.getOrderShippingType() == null) {
|
||||
businessDocumentOrderDO.setOrderShippingType(1L); // 默认设置为1
|
||||
@@ -1175,53 +1406,103 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
businessDocumentOrderDO.setInfoFeePayeeType(0L); // 默认设置为0
|
||||
}
|
||||
|
||||
BusinessDocumentOrder businessDocumentOrder = new BusinessDocumentOrder();
|
||||
BeanUtils.copyProperties(businessDocumentOrderDO, businessDocumentOrder);
|
||||
businessDocumentOrder.setId(null); // 确保是新记录
|
||||
businessDocumentOrder.setCreateBy(Long.valueOf(loginUser.getUserid()));
|
||||
businessDocumentOrder.setCreateByName(loginUser.getUsername());
|
||||
businessDocumentOrder.setCreateTime(new Date());
|
||||
businessDocumentOrder.setUpdateTime(new Date());
|
||||
businessDocumentOrder.setDelFlag(1);
|
||||
|
||||
boolean insertResult = businessDocumentOrderService.save(businessDocumentOrder);
|
||||
// 组装货物信息 - 从 RESERVATION_CARGO_INFO 表查询
|
||||
List<BusinessDocumentCargoMultiDTO> businessDocumentCargoMultiList = new ArrayList<>();
|
||||
LambdaQueryWrapper<ReservationCargoInfo> cargoQueryWrapper = new LambdaQueryWrapper<>();
|
||||
cargoQueryWrapper.eq(ReservationCargoInfo::getOrderId, reservationOrder.getId());
|
||||
List<ReservationCargoInfo> reservationCargoList = reservationCargoInfoMapper.selectList(cargoQueryWrapper);
|
||||
if (reservationCargoList.size() > 0) {
|
||||
for (ReservationCargoInfo reservationCargo : reservationCargoList) {
|
||||
BusinessDocumentCargoMultiDTO cargoDTO = new BusinessDocumentCargoMultiDTO();
|
||||
cargoDTO.setCargoName(reservationCargo.getCargoName());
|
||||
cargoDTO.setCargoNum(reservationCargo.getCargoNum() != null ? reservationCargo.getCargoNum() : BigDecimal.ZERO);
|
||||
cargoDTO.setCargoWeight(reservationCargo.getCargoWeight() != null ? reservationCargo.getCargoWeight() : BigDecimal.ZERO);
|
||||
cargoDTO.setCargoUnitName(reservationCargo.getCargoUnitName());
|
||||
cargoDTO.setWeightUnit(reservationCargo.getCargoUnitName());
|
||||
cargoDTO.setGoodsTypeId(reservationCargo.getGoodsTypeId());
|
||||
cargoDTO.setGoodsType(reservationCargo.getGoodsType());
|
||||
cargoDTO.setGoodsNameId(reservationCargo.getGoodsNameId());
|
||||
cargoDTO.setGoodsName(reservationCargo.getGoodsName());
|
||||
cargoDTO.setMaterialContent(reservationCargo.getCargoContent());
|
||||
cargoDTO.setMachineCode(reservationCargo.getMachineCode());
|
||||
businessDocumentCargoMultiList.add(cargoDTO);
|
||||
}
|
||||
}
|
||||
businessDocumentOrderDO.setBusinessDocumentCargoMultiList(businessDocumentCargoMultiList);
|
||||
|
||||
// 组装装卸货地址信息 - 从 RESERVATION_ADDRESS_MULTI 表查询
|
||||
List<BusinessDocumentAddressMultiDTO> loadingAddressList = new ArrayList<>();
|
||||
List<BusinessDocumentAddressMultiDTO> unloadAddressList = new ArrayList<>();
|
||||
|
||||
|
||||
// 查询装货地址 (layType = 1)
|
||||
LambdaQueryWrapper<ReservationAddressMulti> loadingQueryWrapper = new LambdaQueryWrapper<>();
|
||||
loadingQueryWrapper.eq(ReservationAddressMulti::getOrderId, reservationOrder.getId())
|
||||
.eq(ReservationAddressMulti::getLayType, 1);
|
||||
List<ReservationAddressMulti> loadingAddressList1 = reservationAddressMultiMapper.selectList(loadingQueryWrapper);
|
||||
// @ApiModelProperty(value = "装货地址集合")
|
||||
// private List<BusinessDocumentAddressMultiDTO> loadingAddressList;
|
||||
// @ApiModelProperty(value = "卸货地址集合")
|
||||
// private List<BusinessDocumentAddressMultiDTO> unloadAddressList;
|
||||
if (loadingAddressList1.size() > 0) {
|
||||
for (ReservationAddressMulti address : loadingAddressList1) {
|
||||
BusinessDocumentAddressMultiDTO loadingAddress = new BusinessDocumentAddressMultiDTO();
|
||||
loadingAddress.setAreaCode(address.getAreaCode());
|
||||
loadingAddress.setAreaName(address.getAreaName());
|
||||
loadingAddress.setAddress(address.getAddress());
|
||||
loadingAddress.setLongitude(address.getLongitude());
|
||||
loadingAddress.setLatitude(address.getLatitude());
|
||||
loadingAddress.setContactName(address.getContactName());
|
||||
loadingAddress.setContactPhone(address.getContactPhone());
|
||||
loadingAddress.setLayDate(address.getLayDate());
|
||||
loadingAddress.setLayTimeId(address.getLayTimeId());
|
||||
loadingAddress.setLayType(Long.valueOf(address.getLayType()));
|
||||
// loadingAddress.setSort(Long.valueOf(address.getSort()));
|
||||
// loadingAddress.setShortName(address.getShortName());
|
||||
loadingAddressList.add(loadingAddress);
|
||||
}
|
||||
}
|
||||
|
||||
// 查询卸货地址 (layType = 2)
|
||||
LambdaQueryWrapper<ReservationAddressMulti> unloadQueryWrapper = new LambdaQueryWrapper<>();
|
||||
unloadQueryWrapper.eq(ReservationAddressMulti::getOrderId, reservationOrder.getId())
|
||||
.eq(ReservationAddressMulti::getLayType, 2);
|
||||
List<ReservationAddressMulti> unloadAddressList1 = reservationAddressMultiMapper.selectList(unloadQueryWrapper);
|
||||
if (unloadAddressList1.size() > 0) {
|
||||
for (ReservationAddressMulti address : unloadAddressList1) {
|
||||
BusinessDocumentAddressMultiDTO unloadAddress = new BusinessDocumentAddressMultiDTO();
|
||||
unloadAddress.setAreaCode(address.getAreaCode());
|
||||
unloadAddress.setAreaName(address.getAreaName());
|
||||
unloadAddress.setAddress(address.getAddress());
|
||||
unloadAddress.setLongitude(address.getLongitude());
|
||||
unloadAddress.setLatitude(address.getLatitude());
|
||||
unloadAddress.setContactName(address.getContactName());
|
||||
unloadAddress.setContactPhone(address.getContactPhone());
|
||||
unloadAddress.setLayDate(address.getLayDate());
|
||||
unloadAddress.setLayTimeId(address.getLayTimeId());
|
||||
unloadAddress.setLayType(Long.valueOf(address.getLayType()));
|
||||
unloadAddress.setShortName(address.getShortName());
|
||||
unloadAddressList.add(unloadAddress);
|
||||
}
|
||||
}
|
||||
|
||||
businessDocumentOrderDO.setLoadingAddressList(loadingAddressList);
|
||||
businessDocumentOrderDO.setUnloadAddressList(unloadAddressList);
|
||||
businessDocumentOrderDO.setOrderSource("0");
|
||||
|
||||
// 插入业务单
|
||||
Boolean insertResult = businessDocumentOrderApplicationService.insert(businessDocumentOrderDO);
|
||||
if (!insertResult) {
|
||||
throw new ServiceException("创建业务单失败");
|
||||
}
|
||||
|
||||
|
||||
LambdaQueryWrapper<BusinessDocumentOrder> orderQueryWrapper = new LambdaQueryWrapper<>();
|
||||
orderQueryWrapper.eq(BusinessDocumentOrder::getGoodsNumber, businessDocumentOrderDO.getGoodsNumber());
|
||||
BusinessDocumentOrder createdOrder = businessDocumentOrderService.getOne(orderQueryWrapper);
|
||||
if (createdOrder == null) {
|
||||
throw new ServiceException("创建业务单后查询失败");
|
||||
}
|
||||
|
||||
// 处理货物信息(从预约单获取)
|
||||
// handleCargoInfoFromReservation(createdOrder.getId(), reservationOrder.getId());
|
||||
|
||||
// 处理地址信息(从预约单获取)
|
||||
handleAddressInfoFromReservation(createdOrder.getId(), reservationOrder.getId());
|
||||
|
||||
// 更新预约单状态
|
||||
reservationOrder.setOrderType(1); // 设置为业务单类型
|
||||
reservationOrder.setBusinessOrderId(businessDocumentOrder.getId()); // 关联业务单ID
|
||||
reservationOrder.setBusinessOrderNumber(businessDocumentOrder.getGoodsNumber()); // 关联业务单号
|
||||
reservationOrder.setUpdateTime(new Date());
|
||||
reservationOrder.setUpdateBy(String.valueOf(loginUser.getUserid()));
|
||||
|
||||
int updateResult = resevationOrderMapper.updateById(reservationOrder);
|
||||
if (updateResult <= 0) {
|
||||
throw new ServiceException("更新预约单状态失败");
|
||||
}
|
||||
|
||||
|
||||
BusinessDocumentOrderPO businessDocumentOrderPO = new BusinessDocumentOrderPO();
|
||||
BeanUtils.copyProperties(businessDocumentOrder, businessDocumentOrderPO);
|
||||
|
||||
return businessDocumentOrderPO;
|
||||
BusinessDocumentOrder businessDocumentOrder = businessDocumentOrderMapper.selectOne(new LambdaQueryWrapper<BusinessDocumentOrder>().eq(BusinessDocumentOrder::getGoodsNumber, goodsNumber));
|
||||
reservationOrder.setBusinessOrderId(businessDocumentOrder.getId());
|
||||
reservationOrder.setBusinessOrderNumber(businessDocumentOrderDO.getGoodsNumber());
|
||||
reservationOrder.setOrderType(1);
|
||||
|
||||
resevationOrderMapper.updateById(reservationOrder);
|
||||
|
||||
return insertResult;
|
||||
}
|
||||
private void saveAddress2CargoInfo(String id, List<OmsCargoInfoDTO> cargoInfoList, List<OmsAddressMultiDTO> loadingAddressList, List<OmsAddressMultiDTO> unloadAddressList) {
|
||||
|
||||
@@ -1356,7 +1637,8 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
|
||||
|
||||
@Override
|
||||
public Result<?> batchConfirmReservationOrder(List<String> goodsNumbers) {
|
||||
public Result<?> batchConfirmReservationOrder(BusinessAuditDTO businessAuditDTO) {
|
||||
List<String> goodsNumbers = businessAuditDTO.getGoodsNumber();
|
||||
BatchConfirmResult result = new BatchConfirmResult();
|
||||
result.setTotal(goodsNumbers.size());
|
||||
result.setSuccessList(new ArrayList<>());
|
||||
@@ -1365,8 +1647,17 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
// 同步处理,避免线程池问题
|
||||
for (String goodsNumber : goodsNumbers) {
|
||||
try {
|
||||
BusinessDocumentOrderPO businessOrder = confirmReservationOrder(goodsNumber);
|
||||
result.getSuccessList().add(businessOrder);
|
||||
Boolean businessOrder = confirmReservationOrder(goodsNumber);
|
||||
if (businessOrder) {
|
||||
|
||||
} else {
|
||||
result.getFailList().add(new BatchConfirmResult.FailItem(goodsNumber, "确认失败"));
|
||||
}
|
||||
ReservationOrder reservationOrder = resevationOrderMapper.selectOne(new LambdaQueryWrapper<ReservationOrder>().eq(ReservationOrder::getGoodsNumber, goodsNumber));
|
||||
reservationOrder.setSalesManager(businessAuditDTO.getSalesManager());
|
||||
reservationOrder.setReviewOpinion(businessAuditDTO.getReviewOpinion());
|
||||
reservationOrder.setSalesmanName(businessAuditDTO.getSalesmanName());
|
||||
resevationOrderMapper.updateById(reservationOrder);
|
||||
result.setSuccessCount(result.getSuccessCount() + 1);
|
||||
} catch (Exception e) {
|
||||
result.getFailList().add(new BatchConfirmResult.FailItem(goodsNumber, e.getMessage()));
|
||||
@@ -1389,6 +1680,84 @@ public class OmsAddressMultiService implements IOmsAddressMultiService {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<Integer, Long> countByOrderType() {
|
||||
// 使用MyBatis Plus的LambdaQueryWrapper进行分组统计
|
||||
Map<Integer, Long> countMap = new HashMap<>();
|
||||
|
||||
// 查询所有非删除的订单,按orderType值分别计数
|
||||
for (int i = 0; i <= 5; i++) {
|
||||
LambdaQueryWrapper<ReservationOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ReservationOrder::getIsDelete, 0)
|
||||
.eq(ReservationOrder::getOrderType, i);
|
||||
long count = resevationOrderMapper.selectCount(queryWrapper);
|
||||
countMap.put(i, count);
|
||||
}
|
||||
|
||||
return countMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Integer cancelReserve(List<String> goodsNumbers) {
|
||||
int count = 0;
|
||||
|
||||
for (String goodsNumber : goodsNumbers) {
|
||||
|
||||
LambdaQueryWrapper<ReservationOrder> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(ReservationOrder::getGoodsNumber, goodsNumber);
|
||||
ReservationOrder reservationOrder = resevationOrderMapper.selectOne(queryWrapper);
|
||||
List<BusinessDocumentOrder> businessDocumentOrders = businessDocumentOrderMapper.selectList(new LambdaQueryWrapper<BusinessDocumentOrder>().eq(BusinessDocumentOrder::getGoodsNumber, goodsNumber));
|
||||
if (businessDocumentOrders != null && businessDocumentOrders.size() > 0) {
|
||||
BusinessDocumentOrder businessDocumentOrder = businessDocumentOrders.get(0);
|
||||
Long orderStatus = businessDocumentOrder.getOrderStatus();
|
||||
if (orderStatus ==0L || orderStatus == 1L) {
|
||||
businessDocumentOrder.setOrderStatus(4L);
|
||||
businessDocumentOrderMapper.updateById(businessDocumentOrder);
|
||||
reservationOrder.setOrderType(5);
|
||||
resevationOrderMapper.updateById(reservationOrder);
|
||||
count++;
|
||||
|
||||
}else {
|
||||
throw new ServiceException("订单进行中无法取消,请联系运营人员处理");
|
||||
}
|
||||
}else {
|
||||
reservationOrder.setOrderType(5);
|
||||
resevationOrderMapper.updateById(reservationOrder);
|
||||
count++;
|
||||
}
|
||||
}
|
||||
|
||||
// 返回成功修改的条数
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public OmsOrderDTO getResevationOrderInfo(String goodsNumber) {
|
||||
OmsOrderDTO omsOrderDTO = new OmsOrderDTO();
|
||||
ReservationOrder reservationOrder = resevationOrderMapper.selectOne(new LambdaQueryWrapper<ReservationOrder>().eq(ReservationOrder::getGoodsNumber, goodsNumber));
|
||||
if (reservationOrder == null) {
|
||||
throw new ServiceException("订单不存在");
|
||||
}
|
||||
BeanUtils.copyProperties(reservationOrder, omsOrderDTO);
|
||||
Long id = reservationOrder.getId();
|
||||
List<ReservationCargoInfo> reservationCargoInfos = reservationCargoInfoMapper.selectList(new LambdaQueryWrapper<ReservationCargoInfo>().eq(ReservationCargoInfo::getOrderId, id));
|
||||
if (reservationCargoInfos != null && reservationCargoInfos.size() > 0) {
|
||||
omsOrderDTO.setReservationCargoInfo(reservationCargoInfos);
|
||||
}
|
||||
ReservationAddressMulti loadingAddressMulti = reservationAddressMultiMapper.selectOne(new LambdaQueryWrapper<ReservationAddressMulti>().eq(ReservationAddressMulti::getOrderId, id).eq(ReservationAddressMulti::getLayType,1).eq(ReservationAddressMulti::getDelFlag, 1));
|
||||
if (loadingAddressMulti != null) {
|
||||
omsOrderDTO.setLoadingAddressMulti(loadingAddressMulti);
|
||||
}
|
||||
ReservationAddressMulti unloadAddressMulti = reservationAddressMultiMapper.selectOne(new LambdaQueryWrapper<ReservationAddressMulti>().eq(ReservationAddressMulti::getOrderId, id).eq(ReservationAddressMulti::getLayType,2).eq(ReservationAddressMulti::getDelFlag, 1));
|
||||
if (unloadAddressMulti != null) {
|
||||
omsOrderDTO.setUnloadAddressMulti(unloadAddressMulti);
|
||||
}
|
||||
|
||||
|
||||
return omsOrderDTO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Result<?> batchRejectReservationOrder(List<String> goodsNumbers) {
|
||||
BatchConfirmResult result = new BatchConfirmResult();
|
||||
|
||||
+6
@@ -14,11 +14,17 @@ import java.util.List;
|
||||
public class BusinessAuditDTO {
|
||||
|
||||
private List<Long> ids;
|
||||
//业务主管
|
||||
private String salesManager;
|
||||
//审核意见
|
||||
private String reviewOpinion;
|
||||
private Long reviewStatus;
|
||||
private String salesManagerName;
|
||||
private String reviewOpinionName;
|
||||
@ApiModelProperty("组织id")
|
||||
private Long organizationId;
|
||||
private List<String> goodsNumber;
|
||||
//业务员
|
||||
private String salesmanName;
|
||||
|
||||
}
|
||||
|
||||
@@ -4,6 +4,8 @@ import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.mhd.common.core.annotation.Excel;
|
||||
import com.mhd.oms.domain.reservationOrder.entity.ReservationAddressMulti;
|
||||
import com.mhd.oms.domain.reservationOrder.entity.ReservationCargoInfo;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
@@ -29,6 +31,10 @@ public class OmsOrderDTO {
|
||||
//
|
||||
// @ApiModelProperty(value = "运距(千米)")
|
||||
// private BigDecimal haulDistance;
|
||||
@ApiModelProperty(value = "订单创建时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
private java.util.Date createTime;
|
||||
@ApiModelProperty(value = "订单开始时间")
|
||||
@JsonFormat(timezone = "GMT+8",pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern="yyyy-MM-dd HH:mm:ss")
|
||||
@@ -786,5 +792,22 @@ public class OmsOrderDTO {
|
||||
|
||||
@ApiModelProperty("业务单号")
|
||||
private String businessOrderNumber;
|
||||
|
||||
@ApiModelProperty("货物信息")
|
||||
private List<ReservationCargoInfo> reservationCargoInfo;
|
||||
|
||||
@ApiModelProperty("装货地址")
|
||||
private ReservationAddressMulti loadingAddressMulti;
|
||||
|
||||
@ApiModelProperty("卸货地址")
|
||||
private ReservationAddressMulti unloadAddressMulti;
|
||||
|
||||
@ApiModelProperty("业务主管")
|
||||
private String salesManager;
|
||||
@ApiModelProperty("审核意见")
|
||||
private String reviewOpinion;
|
||||
@ApiModelProperty("起运时间")
|
||||
private Date departureTime;
|
||||
|
||||
}
|
||||
|
||||
|
||||
+109
-8
@@ -1,12 +1,18 @@
|
||||
package com.mhd.oms.interfaces.facade.resevationOrder;
|
||||
|
||||
import com.aliyun.oss.ServiceException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.mhd.common.core.utils.sms.CommonConstant;
|
||||
import com.mhd.common.core.utils.sms.Result;
|
||||
import com.mhd.common.core.web.page.TableDataInfo;
|
||||
import com.mhd.common.security.utils.SecurityUtils;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.po.BusinessDocumentOrderPO;
|
||||
import com.mhd.oms.domain.businessDocumentOrder.repository.todo.BusinessDocumentOrderDO;
|
||||
import com.mhd.oms.domain.reservationOrder.entity.ReservationOrder;
|
||||
import com.mhd.oms.domain.reservationOrder.repository.facade.IOmsAddressMultiService;
|
||||
import com.mhd.oms.domain.reservationOrder.repository.po.ReservationOrderPO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentAddressMulti.BusinessAuditDTO;
|
||||
import com.mhd.oms.interfaces.dto.businessDocumentOrder.BusinessDocumentOrderDTO;
|
||||
import com.mhd.oms.interfaces.dto.resevationOrder.OmsOrderAddDTO;
|
||||
import com.mhd.oms.interfaces.dto.resevationOrder.OmsOrderDTO;
|
||||
import com.mhd.system.api.domain.TmsTransportNote;
|
||||
@@ -17,6 +23,8 @@ import org.springframework.web.bind.annotation.*;
|
||||
import com.mhd.common.core.web.controller.BaseController;
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import com.mhd.common.core.web.domain.AjaxResult;
|
||||
//import static com.mhd.common.core.utils.PageUtils.startPage;
|
||||
|
||||
@@ -80,19 +88,80 @@ public class ResevationOrderApi extends BaseController{
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 修改预约单
|
||||
*
|
||||
* @param tmsOrderAddDTO
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "货源表-修改预约单", notes = "货源表-修改预约单")
|
||||
@PostMapping(value = "/edit")
|
||||
public Result<?> edit(@RequestBody OmsOrderAddDTO tmsOrderAddDTO) {
|
||||
Result<?> result = new Result<TmsTransportNote>();
|
||||
try {
|
||||
// 获取当前登录用户的组织信息
|
||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||
// 设置组织ID
|
||||
if (loginUser.getUserPo().getOrganizationId() != null) {
|
||||
tmsOrderAddDTO.setOrganizationId(loginUser.getUserPo().getOrganizationId());
|
||||
}
|
||||
// 设置组织名称
|
||||
if (loginUser.getUserPo().getOrganizationName() != null) {
|
||||
tmsOrderAddDTO.setOrganizationName(loginUser.getUserPo().getOrganizationName());
|
||||
}
|
||||
// 设置上级组织ID
|
||||
if (loginUser.getUserPo().getTopOrganizationId() != null) {
|
||||
tmsOrderAddDTO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
||||
}
|
||||
}
|
||||
|
||||
omsAddressMultiService.update(tmsOrderAddDTO);
|
||||
|
||||
result.success("修改成功");
|
||||
result.setCode(CommonConstant.SC_OK_200);
|
||||
} catch (ServiceException e) {
|
||||
e.printStackTrace();
|
||||
result.error500("修改失败:"+e.getErrorMessage());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.error500("修改失败");
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ApiOperation("获取预约单详情")
|
||||
@GetMapping("/getResevationOrderInfo")
|
||||
public Result<?> getResevationOrderInfo(@RequestParam("goodsNumber") String goodsNumber) {
|
||||
try {
|
||||
OmsOrderDTO detail = omsAddressMultiService.getResevationOrderInfo(goodsNumber);
|
||||
if (detail == null) {
|
||||
return Result.error("未查询到该预约单信息");
|
||||
}
|
||||
return Result.ok(detail);
|
||||
} catch (Exception e) {
|
||||
return Result.error("查询预约单详情失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 分页查询【预约单】列表
|
||||
*/
|
||||
@ApiOperation("查询【预约单】列表")
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(OmsOrderDTO omsOrderDTO)
|
||||
public TableDataInfo list(OmsOrderDTO omsOrderDTO,
|
||||
@RequestParam(value = "pageNo", required = false, defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(value = "pageSize", required = false, defaultValue = "20") Integer pageSize)
|
||||
{
|
||||
//转换实体
|
||||
startPage();
|
||||
PageHelper.startPage(pageNo, pageSize);
|
||||
List<ReservationOrderPO> list = omsAddressMultiService.queryList(omsOrderDTO);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
@@ -100,16 +169,12 @@ public class ResevationOrderApi extends BaseController{
|
||||
*/
|
||||
@ApiOperation("批量确认预约单")
|
||||
@PostMapping("/batchConfirm")
|
||||
public Result<?> batchConfirm(@RequestBody List<String> goodsNumbers) {
|
||||
public Result<?> batchConfirm(@RequestBody BusinessAuditDTO businessAuditDTO) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
if (goodsNumbers == null || goodsNumbers.isEmpty()) {
|
||||
result.error500("预约单号列表不能为空");
|
||||
return result;
|
||||
}
|
||||
|
||||
// 调用服务层方法 - 现在服务层直接返回Result
|
||||
return omsAddressMultiService.batchConfirmReservationOrder(goodsNumbers);
|
||||
return omsAddressMultiService.batchConfirmReservationOrder(businessAuditDTO);
|
||||
} catch (ServiceException e) {
|
||||
result.error500("批量确认失败: " + e.getErrorMessage());
|
||||
} catch (Exception e) {
|
||||
@@ -139,5 +204,41 @@ public class ResevationOrderApi extends BaseController{
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据订单状态(orderType)统计各状态的数量
|
||||
*/
|
||||
@ApiOperation("根据订单状态统计数量")
|
||||
@GetMapping("/countByOrderType")
|
||||
public Result<Map<Integer, Long>> countByOrderType() {
|
||||
Result<Map<Integer, Long>> result = new Result<>();
|
||||
try {
|
||||
Map<Integer, Long> countMap = omsAddressMultiService.countByOrderType();
|
||||
result.success("统计成功");
|
||||
result.setResult(countMap);
|
||||
result.setCode(CommonConstant.SC_OK_200);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
result.error500("统计失败: " + e.getMessage());
|
||||
}
|
||||
return result;
|
||||
}
|
||||
@ApiOperation("取消预约")
|
||||
@PostMapping("/cancelReserve")
|
||||
public Result<?> cancelReserve(@RequestBody List<String> goodsNumbers) {
|
||||
Result<?> result = new Result<>();
|
||||
try {
|
||||
Integer count = omsAddressMultiService.cancelReserve(goodsNumbers);
|
||||
if (count > 0) {
|
||||
return Result.ok("取消预约成功,共处理:" + count + "条");
|
||||
} else {
|
||||
return Result.error("取消预约失败,订单不存在或已取消");
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
return Result.error("取消预约失败:" + e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
+9
-5
@@ -35,9 +35,7 @@
|
||||
<!-- <if test="updateTime != null ">-->
|
||||
<!-- and UPDATE_TIME = #{updateTime}-->
|
||||
<!-- </if>-->
|
||||
<if test="goodsNumber != null and goodsNumber != ''">
|
||||
and GOODS_NUMBER = #{goodsNumber}
|
||||
</if>
|
||||
|
||||
<if test="loadingAreaId != null and loadingAreaId != ''">
|
||||
and LOADING_AREA_ID = #{loadingAreaId}
|
||||
</if>
|
||||
@@ -56,6 +54,9 @@
|
||||
<if test="loadingUnit != null and loadingUnit != ''">
|
||||
and LOADING_UNIT = #{loadingUnit}
|
||||
</if>
|
||||
<if test="organizationId != null and organizationId != ''">
|
||||
and ORGANIZATION_ID= #{organizationId}
|
||||
</if>
|
||||
<if test="freighterName != null and freighterName != ''">
|
||||
and FREIGHTER_NAME like concat('%', #{freighterName}, '%')
|
||||
</if>
|
||||
@@ -218,8 +219,11 @@
|
||||
<if test="createUserId != null and createUserId != ''">
|
||||
and CREATE_USER_ID = #{createUserId}
|
||||
</if>
|
||||
<if test="appointShipper != null and appointShipper != ''">
|
||||
and APPOINT_SHIPPER = #{appointShipper}
|
||||
<if test="goodsNumber != null and goodsNumber != ''">
|
||||
and GOODS_NUMBER LIKE CONCAT('%', #{goodsNumber}, '%')
|
||||
</if>
|
||||
<if test="appointShipper != null and appointShipper != ''">
|
||||
and APPOINT_SHIPPER LIKE CONCAT('%', #{appointShipper}, '%')
|
||||
</if>
|
||||
<if test="isStatus != null ">
|
||||
and IS_STATUS = #{isStatus}
|
||||
|
||||
Reference in New Issue
Block a user