Commit 90e1c543 authored by Administrator's avatar Administrator

Merge branch 'release' into 'jd_dev'

Release最新代码合并入捷道研发分支20241115

See merge request !35
parents f73c47c2 dc53642f
-- 产品价格相关数据decimal字段长度修改
alter table ecw_product_price
modify COLUMN `transport_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '运费';
alter table ecw_product_price
modify COLUMN `clearance_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '清关费用';
alter table ecw_product_price
modify COLUMN `all_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '全包价金额';
alter table ecw_product_price
modify COLUMN `min_weight` decimal(10,2) NOT NULL DEFAULT '0.00' COMMENT '最小计费重量';
alter table ecw_product_price
modify COLUMN `square` decimal(10,2) DEFAULT NULL COMMENT '方数要求';
alter table ecw_product_price
modify COLUMN `day_limit` decimal(10,2) DEFAULT NULL COMMENT '每日入仓上限,立方米';
alter table ecw_product_price
modify COLUMN `weight_limit` decimal(10,2) DEFAULT '0.00' COMMENT '路线重量上限';
alter table ecw_product_price_packaging
modify COLUMN `packaging_price` decimal(15,2) DEFAULT NULL COMMENT '包装单位收费';
alter table ecw_product_price_special
modify COLUMN `transport_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '运费';
alter table ecw_product_price_special
modify COLUMN `clearance_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '清关费用';
alter table ecw_product_price_special
modify COLUMN `all_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '全包价格';
alter table ecw_product_price_step
modify COLUMN `start_num` decimal(10,2) NOT NULL COMMENT '起始数量';
alter table ecw_product_price_step
modify COLUMN `end_num` decimal(15,2) DEFAULT NULL COMMENT '结束数量';
alter table ecw_product_price_step
modify COLUMN `transport_price` decimal(15,2) DEFAULT NULL COMMENT '运费';
alter table ecw_product_price_step
modify COLUMN `clearance_price` decimal(15,2) DEFAULT NULL COMMENT '清关费用';
alter table ecw_product_price_step
modify COLUMN `all_price` decimal(15,2) DEFAULT NULL COMMENT '全包价格';
alter table ecw_product_price_step_clearance
modify COLUMN `start_num` decimal(10,2) NOT NULL COMMENT '起始数量';
alter table ecw_product_price_step_clearance
modify COLUMN `end_num` decimal(15,2) DEFAULT NULL COMMENT '结束数量';
alter table ecw_product_price_step_clearance
modify COLUMN `clearance_price` decimal(15,2) DEFAULT NULL COMMENT '清关费用';
alter table ecw_product_price_step_packaging
modify COLUMN `packaging_price` decimal(15,2) DEFAULT NULL COMMENT '包装单位收费';
alter table ecw_product_price_step_special
modify COLUMN `transport_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '运费';
alter table ecw_product_price_step_special
modify COLUMN `clearance_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '清关费用';
alter table ecw_product_price_step_special
modify COLUMN `all_price` decimal(15,2) NOT NULL DEFAULT '0.00' COMMENT '全包价格';
......@@ -11,7 +11,7 @@ VALUES (25, '25', '新增跟进纪录', 'Create Customer Followup', 'customer_op
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (26, '26', '编辑跟进纪录', 'Update Customer Followup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (27, '27', '提交跟进纪录', 'Commit Customer Followup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
VALUES (27, '27', '修改跟进状态', 'Commit Customer Followup', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
......
-- 修改费用申请记录表批量审批流程id字段类型
alter table ecw_order_fee_application
modify COLUMN `batch_bpm_business_id` varchar(64) DEFAULT NULL COMMENT '批量费用审核时流程ID';
\ No newline at end of file
-- 出货阶段订单修改、入仓修改、入仓补充按钮菜单权限
INSERT INTO `system_menu`( `name`, `permission`, `menu_type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `is_show_in_menu_bar`, `name_en`, `keepalive`, `redirect`, `badge_field`) VALUES ( '出货阶段入仓补充', 'ecw:order:shipment:warehouse_replenish', 3, 1, 1852, '', '', '', 0, '119', '2024-11-12 23:34:53', '119', '2024-11-12 23:34:53', b'0', b'1', '出货阶段入仓补充', b'0', NULL, NULL);
INSERT INTO `system_menu`(`name`, `permission`, `menu_type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `is_show_in_menu_bar`, `name_en`, `keepalive`, `redirect`, `badge_field`) VALUES ('出货阶段入仓修改', 'ecw:order:shipment:warehouse_update', 3, 1, 1852, '', '', '', 0, '119', '2024-11-12 23:34:28', '119', '2024-11-12 23:34:28', b'0', b'1', '出货阶段入仓修改', b'0', NULL, NULL);
INSERT INTO `system_menu`( `name`, `permission`, `menu_type`, `sort`, `parent_id`, `path`, `icon`, `component`, `status`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `is_show_in_menu_bar`, `name_en`, `keepalive`, `redirect`, `badge_field`) VALUES ('出货订单编辑', 'ecw:order:shipment:update', 3, 0, 1852, '', '', '', 0, '119', '2024-10-23 23:10:39', '119', '2024-10-23 23:10:39', b'0', b'1', 'ShipmentOrderEdit', b'0', NULL, NULL);
package cn.iocoder.yudao.framework.apollo.core.event.box;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.Date;
/**
* 出货中入仓修改 Event
*
* @author yanghao
*/
@Data
@AllArgsConstructor
public class BoxOrderShipmentWarehouseInEvent {
/**
* 订单ID
*/
private Long orderId;
}
package cn.iocoder.yudao.module.customer.service.customerFollowup;
import cn.hutool.core.date.DateUtil;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderNumberLogEvent;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.code.CodeUtils;
......@@ -16,14 +17,12 @@ import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.Customer
import cn.iocoder.yudao.module.customer.dal.mysql.customer.CustomerMapper;
import cn.iocoder.yudao.module.customer.dal.mysql.customerContacts.CustomerContactsMapper;
import cn.iocoder.yudao.module.customer.dal.mysql.customerFollowup.CustomerFollowupMapper;
import cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants;
import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.*;
import cn.iocoder.yudao.module.customer.vo.customerOperateLog.CustomerOperateLogCreateReqVO;
import cn.iocoder.yudao.module.ecw.enums.CustomerFollowupStatusEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerOperateTypeEnum;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.apache.commons.lang3.StringUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -31,6 +30,7 @@ import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
......@@ -93,7 +93,7 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// 更新编号,内部会判断冲突
//OrderNumberLogListener
OrderNumberLogEvent event = new OrderNumberLogEvent();
event.setType(3);
event.setType(6);
event.setNumberKey(FOLLOWUP_NEW_NUMBER);
applicationContext.publishEvent(event);
String newNumber = CodeUtils.getOddFollowupNumbers(event.getNumber());
......@@ -206,11 +206,16 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
// throw exception(FOLLOWUP_ALREADY_SUBMITTED);
// }
}
Date now = DateUtil.date();
Long userId = SecurityFrameworkUtils.getLoginUser().getId();
for (Long id : ids) {
CustomerFollowupDO customerFollowupDO = followupMapper.selectById(id);
Integer statusOld = customerFollowupDO.getStatus();
customerFollowupDO.setStatus(updateStatusReqVO.getStatus());
customerFollowupDO.setUpdater(String.valueOf(userId));
customerFollowupDO.setUpdateTime(now);
followupMapper.updateById(customerFollowupDO);
......@@ -231,8 +236,8 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
.setOldCustomerService(customer.getCustomerService())
.setOldEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setNewEstimateEnterOpenSeaTime(customer.getEstimateEnterOpenSeaTime())
.setOperateType(CustomerOperateTypeEnum.FOLLOWUP_COMMIT.getValue())
.setRemark("提交跟进纪录");
.setOperateType(CustomerOperateTypeEnum.FOLLOWUP_UPDATE_STATUS.getValue())
.setRemark(String.format("由【%s】修改为【%s】", statusOld == 1 ? "已提交" : "未提交", updateStatusReqVO.getStatus() == 1 ? "已提交" : "未提交"));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
}
}
......
......@@ -11,3 +11,11 @@ GET {{baseUrl}}/customer/followup/page?pageNo=1&pageSize=10&followMethods[0]=1&f
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
### 客户跟进修改状态
PUT {{baseUrl}}//customer/followup/update-status
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
{"ids":[513,512],"status":1}
\ No newline at end of file
......@@ -11,12 +11,21 @@ public class WarehouseLineSearchVO {
private String transportType;
/**始发地城市*/
private Long startCityId;
/**目的地城市*/
private Long destCityId;
/**目的地城市*/
private Long destCountryId;
/**目的仓*/
private Long destWarehouseId;
/**目的地城市*/
private List<Long> destCityIds;
/**目的地城市*/
private List<Long> destCountryIds;
/**目的仓*/
private List<Long> destWarehouseIds;
/**渠道id*/
private Long channelId;
......@@ -25,4 +34,6 @@ public class WarehouseLineSearchVO {
/** 线路id列表 */
private List<Long> lineIdList;
}
......@@ -46,6 +46,7 @@
<if test="params.startCityId != null and params.startCityId != 0">
and ew_start.shi = #{params.startCityId}
</if>
<if test="params.destCityId != null and params.destCityId != 0">
and ew_dest.shi = #{params.destCityId}
</if>
......@@ -55,6 +56,29 @@
<if test="params.destWarehouseId != null and params.destWarehouseId != 0">
and ewl.dest_warehouse_id = #{params.destWarehouseId}
</if>
<!--目的地-->
<if test="params.destCityIds != null and params.destCityIds.size()>0 ">
and ew_dest.`shi` in
<foreach item='destCity' index='index' collection='params.destCityIds' open='(' separator=',' close=')'>
#{destCity}
</foreach>
</if>
<!--目的国-->
<if test="params.destCountryIds != null and params.destCountryIds.size()>0 ">
and ew_dest.`guojia` in
<foreach item='destCountry' index='index' collection='params.destCountryIds' open='(' separator=',' close=')'>
#{destCountry}
</foreach>
</if>
<!--目的仓-->
<if test="params.destWarehouseIds != null and params.destWarehouseIds.size()>0 ">
and ewl.dest_warehouse_id in
<foreach item='destWarehouse' index='index' collection='params.destWarehouseIds' open='(' separator=',' close=')'>
#{destWarehouse}
</foreach>
</if>
<if test="params.lineId != null and params.lineId != 0">
and ewl.id = #{params.lineId}
</if>
......
......@@ -217,10 +217,15 @@ public class WarehouseController {
channelInfoEvent.setChannelId(requestVO.getChannelId());
applicationContext.publishEvent(channelInfoEvent);
if (Objects.nonNull(channelInfoEvent.getCountryId()) && channelInfoEvent.getCountryId() > 0L){
if (Objects.nonNull(requestVO.getDestCountryId()) && requestVO.getDestCountryId() > 0L && !Objects.equals(requestVO.getDestCountryId(),channelInfoEvent.getCountryId())) {
if (Objects.nonNull(requestVO.getDestCountryIds()) && requestVO.getDestCountryIds().size() > 0 ) {
List<Long> destCountryIds = requestVO.getDestCountryIds();
for(Long countryid:destCountryIds) {
if(!Objects.equals(countryid,channelInfoEvent.getCountryId())) {
return error(400,"目的国与渠道不匹配");
}
requestVO.setDestCountryId(channelInfoEvent.getCountryId());
}
}
//requestVO.setDestCountryId(channelInfoEvent.getCountryId());
}
}
List<WarehouseLineDO> list = warehouseService.openedRouterList(requestVO);
......
......@@ -56,7 +56,7 @@ public enum CustomerOperateTypeEnum {
FOLLOWUP_CREATE(25, "新增跟进纪录"),
FOLLOWUP_UPDATE(26, "编辑跟进纪录"),
FOLLOWUP_COMMIT(27, "提交跟进纪录"),
FOLLOWUP_UPDATE_STATUS(27, "修改跟进状态"),
......
package cn.iocoder.yudao.module.order.dal.dataobject.orderFeeApplication;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import java.util.*;
import com.baomidou.mybatisplus.annotation.*;
......@@ -101,4 +102,8 @@ public class OrderFeeApplicationDO extends BaseDO {
*/
private String batchBpmBusinessId;
@TableField(exist = false)
@ApiModelProperty(value = "是否有修改的状态")
private boolean editMode;
}
......@@ -106,12 +106,6 @@ public class OrderWarehouseInDO extends BaseDO {
private String remark;
/**
* 出货后新添加的商品
*/
private Boolean isShipmentNewIn = false;
/**
* 入仓纪录明细VO
*/
......
......@@ -2753,7 +2753,7 @@ public interface OrderMapper extends AbstractMapper<OrderDO> {
"and eo.status in (5,8,9) ",
"and eo.transport_id in (1,2,4)",
"and eo.abnormal_state=0 ",
"and eo.audit_type not in(1,2,3,4,5,12,31,32) ",
"and eo.audit_type not in(6,11,13,14,22,23) ",
"<when test = 'query.rucangTimeStart != null'>",
"AND eo.`rucang_time` &gt;= #{query.rucangTimeStart}",
"</when>",
......
......@@ -31,7 +31,7 @@ public interface OrderFeeApplicationService extends IService<OrderFeeApplication
* @param createReqVO 创建信息
* @return 编号
*/
void createFeeBatchApplication(@Valid OrderFeeBatchApplicationCreateReqVO createReqVO) throws Exception;
void createFeeBatchApplication(@Valid OrderFeeBatchApplicationUpdateReqVO updateReqVO) throws Exception;
/**
* 更新订单费用申请
......
......@@ -55,6 +55,7 @@ import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
......@@ -151,7 +152,7 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
@Override
@Transactional(rollbackFor = Exception.class)
public void createFeeBatchApplication(OrderFeeBatchApplicationCreateReqVO createReqVO) {
public void createFeeBatchApplication(OrderFeeBatchApplicationUpdateReqVO createReqVO) {
// OrderDO orderDO = orderService.getById(createReqVO.getOrderId());
// if (orderDO.getAuditType() != 0) {
// throw exception(ORDER_HAS_PROCESSING_APPROVAL, orderDO.getOrderNo());
......@@ -168,14 +169,18 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
//查询订单信息
// 批量插入费用
List<OrderFeeApplicationCreateReqVO> baseVOList = createReqVO.getOrderFeeApplicationCreateReqVOList();
OrderDO orderDO = orderService.getById(createReqVO.getOrderId());
// 批量转换费用
List<OrderFeeApplicationUpdateReqVO> baseVOList = createReqVO.getOrderFeeApplicationCreateReqVOList();
List<OrderFeeApplicationDO> batchFeeList = new ArrayList<>();
for (OrderFeeApplicationCreateReqVO vo : baseVOList) {
for (OrderFeeApplicationUpdateReqVO vo : baseVOList) {
OrderFeeApplicationDO feeApplication = OrderFeeApplicationConvert.INSTANCE.convert(vo);
feeApplicationMapper.insert(feeApplication);
// if (Objects.isNull(feeApplication.getId())) {
// feeApplicationMapper.insert(feeApplication);
// }
batchFeeList.add(feeApplication);
}
......@@ -186,25 +191,64 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
//批量费用申请
orderApprovalDO.setType(expense_apply_BATCH.getValue());
orderApprovalDO.setStatus(ApprovalResultStatusEnum.processing.getValue());
Long bpmProcessId = orderApprovalService.applyAndCreate(orderApprovalDO, WorkFlowEmus.ORDER_BATCH_FREE_APPLY, createReqVO.getCopyUserId());
orderApprovalDO.setStatus(ApprovalResultStatusEnum.processing.getValue());
//创建审批流
OrderDO orderDO = orderService.selectOne(OrderDO::getOrderId, createReqVO.getOrderId());
orderApprovalService.save(orderApprovalDO);
//发起流程
String formId = bpmCreateServiceFactory.createBmp(SecurityFrameworkUtils.getLoginUserId(),
orderApprovalDO.getOrderApprovalId(), WorkFlowEmus.ORDER_BATCH_FREE_APPLY.getKey(), orderDO.getOrderNo(), createReqVO.getCopyUserId());
orderApprovalDO.setFormId(formId);
List<ApplyInfoVO> list = new ArrayList<>();
//更新费用列表对应的流程申请ID及状态,并封装审批详情说明文案
for (OrderFeeApplicationDO feeApplicationDO : batchFeeList) {
if (feeApplicationDO.isEditMode() || Objects.isNull(feeApplicationDO.getId())) {
feeApplicationDO.setBatchBpmBusinessId(formId);
feeApplicationDO.setStatus(ApprovalResultStatusEnum.processing.getValue());
DictDataRespDTO feeDictDataFromCache = DictFrameworkUtils.getDictDataFromCache(DictTypeConstants.RECEIVABLE_FEE_TYPE, String.valueOf(feeApplicationDO.getFeeType()));
DictDataRespDTO payDictDataFromCache = DictFrameworkUtils.getDictDataFromCache(DictTypeConstants.PAYMENT_TYPE, String.valueOf(feeApplicationDO.getPayType()));
CurrencyDO currency = currencyService.getCurrency(feeApplicationDO.getApplicationFeeCurrency());
String value = "%s: 金额[%s%s], 付款类型[%s]";
ApplyInfoVO applyInfoVO = new ApplyInfoVO();
if (Objects.isNull(feeApplicationDO.getId())) {
applyInfoVO.setName("新增申请费用");
applyInfoVO.setNewValue(String.format(value,
I18nMessage.getLang() == 0 ? feeDictDataFromCache.getLabel() : feeDictDataFromCache.getLabelEn() ,
feeApplicationDO.getApplicationFee().toString(),
I18nMessage.getLang() == 0 ? currency.getTitleZh() : currency.getTitleEn(),
I18nMessage.getLang() == 0 ? payDictDataFromCache.getLabel() : payDictDataFromCache.getLabelEn()));
}else {
OrderFeeApplicationDO oldFeeAppliction = feeApplicationMapper.selectById(feeApplicationDO.getId());
DictDataRespDTO feeDictDataFromCacheOld = DictFrameworkUtils.getDictDataFromCache(DictTypeConstants.RECEIVABLE_FEE_TYPE, String.valueOf(oldFeeAppliction.getFeeType()));
DictDataRespDTO payDictDataFromCacheOld = DictFrameworkUtils.getDictDataFromCache(DictTypeConstants.PAYMENT_TYPE, String.valueOf(oldFeeAppliction.getPayType()));
CurrencyDO currencyOld = currencyService.getCurrency(oldFeeAppliction.getApplicationFeeCurrency());
applyInfoVO.setName("修改申请费用");
applyInfoVO.setNewValue(String.format(value,
I18nMessage.getLang() == 0 ? feeDictDataFromCache.getLabel() : feeDictDataFromCache.getLabelEn() ,
feeApplicationDO.getApplicationFee().toString(),
I18nMessage.getLang() == 0 ? currency.getTitleZh() : currency.getTitleEn(),
I18nMessage.getLang() == 0 ? payDictDataFromCache.getLabel() : payDictDataFromCache.getLabelEn()));
applyInfoVO.setOrgValue(String.format(value,
I18nMessage.getLang() == 0 ? feeDictDataFromCacheOld.getLabel() : feeDictDataFromCacheOld.getLabelEn() ,
oldFeeAppliction.getApplicationFee().toString(),
I18nMessage.getLang() == 0 ? currencyOld.getTitleZh() : currencyOld.getTitleEn(),
I18nMessage.getLang() == 0 ? payDictDataFromCacheOld.getLabel() : payDictDataFromCacheOld.getLabelEn()));
}
list.add(applyInfoVO);
}
}
orderApprovalDO.setDetails(JSONObject.toJSONString(batchFeeList));
orderApprovalService.updateById(orderApprovalDO);
orderBusinessService.addOrderOperateLog(createReqVO.getOrderId(), "", "提交费用申请", list);
orderService.updateStatus(orderDO.getOrderId(), null, null, null, null, null, OrderApprovalTypeResultEnum.expense_apply_batch_processing.getType(), OrderApprovalTypeResultEnum.expense_apply_batch_processing.getDesc());
//更新费用列表对应的流程申请ID
for (OrderFeeApplicationDO feeApplication : batchFeeList) {
feeApplication.setBatchBpmBusinessId(String.valueOf(bpmProcessId));
feeApplication.setStatus(ApprovalResultStatusEnum.processing.getValue());
feeApplicationMapper.updateById(feeApplication);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateFeeApplication(OrderFeeApplicationUpdateReqVO updateReqVO) {
OrderDO orderDO = orderService.getById(updateReqVO.getOrderId());
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(updateReqVO.getOrderId(), null, expense_apply.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent);
......@@ -259,7 +303,6 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
applyInfoVO.setOrgValue(I18nMessage.getLang() == 0 ? payDictDataFromCacheOld.getLabel() : payDictDataFromCacheOld.getLabelEn());
applyInfoVO.setNewValue(I18nMessage.getLang() == 0 ? payDictDataFromCache.getLabel() : payDictDataFromCache.getLabelEn());
list.add(applyInfoVO);
orderBusinessService.addOrderOperateLog(updateObj.getOrderId(), "", "费用修改提交审核", list);
}
......@@ -351,6 +394,10 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
List<FeeDto> feeDtos = new ArrayList<>();
if (result == 2) {
// 审批通过,更新状态与修改后的数据到数据库
if (Objects.nonNull(orderFeeApplicationDO.getId())){
OrderFeeApplicationDO orgFeeApplicationDO = feeApplicationMapper.selectById(orderFeeApplicationDO.getId());
orderFeeApplicationDO.setReceivableId(orgFeeApplicationDO.getReceivableId());
}
orderFeeApplicationDO.setStatus(result);
feeApplicationMapper.updateById(orderFeeApplicationDO);
OrderBackVO order = orderQueryService.getOrder(orderFeeApplicationDO.getOrderId());
......@@ -455,11 +502,20 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
if (result == ApprovalResultStatusEnum.pass.getValue()) {
List<FeeDto> feeDtos = new ArrayList<>();
OrderBackVO order = orderQueryService.getOrder(orderApprovalDO.getOrderId());
List<OrderFeeApplicationDO> batchFeeList = null;
if (Objects.nonNull(orderApprovalDO.getDetails())){
batchFeeList = JSONObject.parseArray(orderApprovalDO.getDetails(), OrderFeeApplicationDO.class);
}else {
LambdaQueryWrapper<OrderFeeApplicationDO> lambdaQueryWrapper = new LambdaQueryWrapper();
lambdaQueryWrapper.eq(OrderFeeApplicationDO::getOrderId, orderApprovalDO.getOrderId());
lambdaQueryWrapper.eq(OrderFeeApplicationDO::getBatchBpmBusinessId, orderApprovalDO.getOrderApprovalId());
List<OrderFeeApplicationDO> batchFeeList = this.list(lambdaQueryWrapper);
batchFeeList = this.list(lambdaQueryWrapper);
}
for (OrderFeeApplicationDO feeApplicationDO : batchFeeList) {
if (Objects.nonNull(feeApplicationDO.getId())){
OrderFeeApplicationDO orgFeeApplicationDO = feeApplicationMapper.selectById(feeApplicationDO.getId());
feeApplicationDO.setReceivableId(orgFeeApplicationDO.getReceivableId());
}
//生成应收
DictDataRespDTO dictDto = DictFrameworkUtils.getDictDataFromCache("receivable_fee_type", String.valueOf(feeApplicationDO.getFeeType()));
if (feeApplicationDO.getReceivableId() != null && feeApplicationDO.getReceivableId() > 0) {
......@@ -504,8 +560,12 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
Long receivableId = receivableService.createReceivable(receivableCreateReqVO);
feeApplicationDO.setReceivableId(receivableId.intValue());
}
feeApplicationDO.setStatus(ApprovalResultStatusEnum.pass.getValue());
feeApplicationDO.setStatus(result);
if (Objects.nonNull(feeApplicationDO.getId())){
feeApplicationMapper.updateById(feeApplicationDO);
}else {
feeApplicationMapper.insert(feeApplicationDO);
}
FeeDto feeDto = new FeeDto();
feeDto.setFeeType(feeApplicationDO.getFeeType());
feeDto.setAmount(feeApplicationDO.getApplicationFee());
......@@ -538,6 +598,14 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
@Override
public List<OrderFeeApplicationDO> getFeeApplicationListByOrderId(Long orderId) {
OrderApprovalDO approvalDO = orderApprovalService.getOne(new LambdaQueryWrapper<OrderApprovalDO>()
.eq(OrderApprovalDO::getOrderId, orderId)
.eq(OrderApprovalDO::getStatus, 1)
.orderByDesc(OrderApprovalDO::getOrderApprovalId).last("limit 1"));
if (Objects.nonNull(approvalDO) && approvalDO.getType() == 41 && Objects.nonNull(approvalDO.getDetails())) {
// 对于批量审批中的费用申请,直接返回审批中数据即可
return JSONObject.parseArray(approvalDO.getDetails(), OrderFeeApplicationDO.class);
}
List<OrderFeeApplicationDO> feeApplicationList = feeApplicationMapper.getFeeApplicationListByOrderId(orderId);
feeApplicationList.stream().forEach(item -> {
item.setApplicationAuthor(adminUserService.getUser(Long.valueOf(item.getCreator())).getUsername());
......@@ -552,7 +620,6 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
item.setReceiveFlag(0);
}
if (item.getStatus() == 1 && StringUtils.isNotBlank(item.getBpmProcessId())){
OrderApprovalDO approvalDO = orderApprovalService.getApproval(Long.valueOf(item.getBpmProcessId()));
if (Objects.nonNull(approvalDO) && Objects.nonNull(approvalDO.getDetails())){
OrderFeeApplicationDO feeApplicationDO = JSONObject.parseObject(approvalDO.getDetails(), OrderFeeApplicationDO.class);
BeanUtils.copyProperties(feeApplicationDO, item);
......@@ -564,6 +631,19 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
@Override
public OrderFeeApplicationBackVO getOrderByProcessId(String processId) {
OrderApprovalDO orderApprovalDO = orderApprovalService.getOne(new LambdaQueryWrapper<OrderApprovalDO>().eq(OrderApprovalDO::getFormId, processId).orderByDesc(OrderApprovalDO::getOrderApprovalId).last("limit 1"));
if (Objects.nonNull(orderApprovalDO) && orderApprovalDO.getType() == 12 && StringUtils.isNotBlank(orderApprovalDO.getDetails())) {
OrderFeeApplicationDO orderFeeApplicationDO = JSONObject.parseObject(orderApprovalDO.getDetails(), OrderFeeApplicationDO.class);
OrderFeeApplicationBackVO convert = OrderFeeApplicationConvert.INSTANCE.convert(orderFeeApplicationDO);
if (orderFeeApplicationDO != null) {
OrderBackVO order = orderQueryService.getOrder(orderFeeApplicationDO.getOrderId());
LogisticsInfoDto startInfoAndDestInfoByLineId = warehouseLineMapper.getStartInfoAndDestInfoByLineId(order.getLineId());
convert.setStartWarehouse(startInfoAndDestInfoByLineId.getStartTitleZh());
convert.setDestWarehouse(startInfoAndDestInfoByLineId.getDestTitleZh());
convert.setOrderBackVO(order);
}
return convert;
}else {
OrderFeeApplicationDO orderFeeApplicationDO = feeApplicationMapper.selectOne(OrderFeeApplicationDO::getBpmProcessId, processId);
OrderFeeApplicationBackVO convert = OrderFeeApplicationConvert.INSTANCE.convert(orderFeeApplicationDO);
if (orderFeeApplicationDO != null) {
......@@ -575,12 +655,19 @@ public class OrderFeeApplicationServiceImpl extends AbstractService<OrderFeeAppl
}
return convert;
}
}
@Override
public List<OrderFeeApplicationBackVO> getBatchFeeByProcessId(String processId) {
OrderApprovalDO orderApprovalDO = orderApprovalService.getApproval(Long.valueOf(processId));
if (Objects.nonNull(orderApprovalDO) && orderApprovalDO.getType() == 41 && StringUtils.isNotBlank(orderApprovalDO.getDetails())) {
List<OrderFeeApplicationDO> orderFeeApplicationDOList = JSONObject.parseArray(orderApprovalDO.getDetails(), OrderFeeApplicationDO.class);
return OrderFeeApplicationConvert.INSTANCE.convertList(orderFeeApplicationDOList.stream().filter(fee -> Objects.isNull(fee.getId()) || fee.isEditMode()).collect(Collectors.toList()));
}else {
List<OrderFeeApplicationDO> orderFeeApplicationDOList = feeApplicationMapper.selectList(OrderFeeApplicationDO::getBatchBpmBusinessId, processId);
return OrderFeeApplicationConvert.INSTANCE.convertList(orderFeeApplicationDOList);
}
}
@Override
@Transactional(rollbackFor = Exception.class)
......
......@@ -216,13 +216,12 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
dto -> "create_order_phone_limit".equals(dto.getLabel())).findFirst().
orElse(null);
if ((Objects.isNull(createReqVO.getIsCargoControl()) ||
!createReqVO.getIsCargoControl()) &&
if (createReqVO.getHasConsignee() && Objects.nonNull(createReqVO.getIsCargoControl()) &&
createReqVO.getIsCargoControl() &&
Objects.nonNull(dictDataRespDTO) &&
StringUtils.equals(dictDataRespDTO.getValue(), "11")
&& StringUtils.isNotBlank(createReqVO.getCountryCode())
&& StringUtils.equals("86", createReqVO.getCountryCode())) {
throw exception(CONSIGNEE_PHONE_IS_EXTERNAL);
}
LogisticsInfoDto logisticsInfoDto =
......@@ -657,7 +656,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (StringUtils.isBlank(orderConsigneeDO.getName())) {
throw exception(ORDER_CONSIGNEE_NAME_NOT_COMPLETE);
}
if ((Objects.isNull(createReqVO.getIsCargoControl()) || !createReqVO.getIsCargoControl()) && StringUtils.isNotBlank(orderConsigneeDO.getCountryCode()) &&
if (createReqVO.getHasConsignee() && Objects.nonNull(createReqVO.getIsCargoControl()) && createReqVO.getIsCargoControl() && StringUtils.isNotBlank(orderConsigneeDO.getCountryCode()) &&
Objects.nonNull(dictDataRespDTO) && StringUtils.equals(dictDataRespDTO.getValue(), "11") && StringUtils.equals("86", orderConsigneeDO.getCountryCode())) {
throw exception(CONSIGNEE_PHONE_IS_EXTERNAL);
}
......@@ -937,7 +936,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
throw exception(ORDER_CONSIGNEE_PHONE_INCORRECT_FORMAT);
}
}
if ((Objects.isNull(createReqVO.getIsCargoControl()) || !createReqVO.getIsCargoControl()) && StringUtils.isNotBlank(orderConsigneeDO.getCountryCode()) &&
if (createReqVO.getHasConsignee() && Objects.nonNull(createReqVO.getIsCargoControl()) && createReqVO.getIsCargoControl() && StringUtils.isNotBlank(orderConsigneeDO.getCountryCode()) &&
Objects.nonNull(dictDataRespDTO) && StringUtils.equals(dictDataRespDTO.getValue(), "11") && StringUtils.equals("86", orderConsigneeDO.getCountryCode())) {
throw exception(CONSIGNEE_PHONE_IS_EXTERNAL);
}
......@@ -1509,15 +1508,17 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
updateReqVO.setCustomsClearCert(false);
updateReqVO.setAirlineCompany(0L);
}
OrderDO updateObj = OrderConvert.INSTANCE.convert(updateReqVO);
// 获取功能开关
List<DictDataRespDTO> dictList = dictDataApi.getDictDatas("part_function_switch");
// 智慧预装功能开关
DictDataRespDTO dictDataRespDTO = dictList.stream().filter(dto -> "create_order_phone_limit".equals(dto.getLabel())).findFirst().orElse(null);
if ((Objects.isNull(updateReqVO.getIsCargoControl()) || !updateReqVO.getIsCargoControl()) &&
if (updateReqVO.getHasConsignee() && Objects.nonNull(updateReqVO.getIsCargoControl()) &&
updateReqVO.getIsCargoControl() &&
Objects.nonNull(dictDataRespDTO) && StringUtils.equals(dictDataRespDTO.getValue(), "11") && StringUtils.isNotBlank(updateReqVO.getCountryCode()) && StringUtils.equals("86", updateReqVO.getCountryCode())) {
throw exception(CONSIGNEE_PHONE_IS_EXTERNAL);
}
OrderDO updateObj = OrderConvert.INSTANCE.convert(updateReqVO);
LogisticsInfoDto logisticsInfoDto = warehouseLineMapper.getStartInfoAndDestInfoByLineId(updateReqVO.getLineId());
if (Objects.isNull(logisticsInfoDto)) {
throw exception(ORDER_LINE_NOT_EXIST);
......@@ -2714,7 +2715,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (!Objects.equals(orderConsigneeBackVO.getCustomerContactsId(), consigneeContactsDO.getId())) {
// 收货人电话
if (!StringUtils.equals(orderConsigneeBackVO.getPhone(), consigneeContactsDO.getPhoneNew()) || !StringUtils.equals(orderConsigneeBackVO.getCountryCode(), consigneeContactsDO.getAreaCode())) {
if ((Objects.isNull(updateReqVO.getIsCargoControl()) || !updateReqVO.getIsCargoControl()) && StringUtils.isNotBlank(consigneeContactsDO.getAreaCode()) &&
if (updateReqVO.getHasConsignee() && Objects.nonNull(updateReqVO.getIsCargoControl()) && updateReqVO.getIsCargoControl() && StringUtils.isNotBlank(consigneeContactsDO.getAreaCode()) &&
Objects.nonNull(dictDataRespDTO) && StringUtils.equals(dictDataRespDTO.getValue(), "11") && StringUtils.equals("86", consigneeContactsDO.getAreaCode())) {
throw exception(CONSIGNEE_PHONE_IS_EXTERNAL);
}
......@@ -3290,7 +3291,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
if (StringUtils.isBlank(orderConsigneeDO.getName())) {
throw exception(ORDER_CONSIGNEE_NAME_NOT_COMPLETE);
}
if ((Objects.isNull(updateReqVO.getIsCargoControl()) || !updateReqVO.getIsCargoControl()) && StringUtils.isNotBlank(orderConsigneeDO.getCountryCode()) &&
if (updateReqVO.getHasConsignee() && Objects.nonNull(updateReqVO.getIsCargoControl()) && updateReqVO.getIsCargoControl() && StringUtils.isNotBlank(orderConsigneeDO.getCountryCode()) &&
Objects.nonNull(dictDataRespDTO) && StringUtils.equals("11", dictDataRespDTO.getValue()) && StringUtils.equals("86", orderConsigneeDO.getCountryCode())) {
throw exception(CONSIGNEE_PHONE_IS_EXTERNAL);
}
......@@ -3541,7 +3542,7 @@ public class OrderServiceImpl extends AbstractService<OrderMapper, OrderDO> impl
orderConsigneeDO.setEmail(updateReqVO.getConsigneeEmail());
orderConsigneeDO.setPhone(updateReqVO.getConsigneePhone());
}
if ((Objects.isNull(updateReqVO.getIsCargoControl()) || !updateReqVO.getIsCargoControl()) && StringUtils.isNotBlank(orderConsigneeDO.getCountryCode()) &&
if (updateReqVO.getHasConsignee() && Objects.nonNull(updateReqVO.getIsCargoControl()) && updateReqVO.getIsCargoControl() && StringUtils.isNotBlank(orderConsigneeDO.getCountryCode()) &&
Objects.nonNull(dictDataRespDTO) && StringUtils.equals("11", dictDataRespDTO.getValue()) && StringUtils.equals("86", orderConsigneeDO.getCountryCode())) {
throw exception(CONSIGNEE_PHONE_IS_EXTERNAL);
}
......
......@@ -8,6 +8,8 @@ import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxCheckOrderSchedulingEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.apollo.core.event.QueryChannelInfoEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderRevokeWarehouseCheckEvent;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderShipmentWarehouseInEvent;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.date.DateUtils;
......@@ -299,10 +301,14 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
private void throwProcessingApproval(OrderDO orderDO) {
// 费用申请中可以入仓和完成入仓。 详见字典order_approval_type
if (orderDO.getAuditType() != 0 && orderDO.getAuditType() > 5 && orderDO.getAuditType() != 12) {
if (orderDO.getAuditType() != 0) {
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23, 28), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_HAS_PROCESSING_APPROVAL, orderDO.getOrderNo());
}
}
}
/*
创建入仓记录
......@@ -3427,28 +3433,29 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
private void compareOrderItemFieldAppend(OrderWarehouseInCreateReqVO createReqVO, OrderItemDO orderItemOld, List<ApplyInfoVO> applyInfoList) {
String prodName = String.format("商品:%s - ", orderItemOld.getProdTitleZh());
String prodName = String.format("商品:%s - ", createReqVO.getProdTitleZh());
Boolean isNew = createReqVO.getIsAppend();
if (isNew) {
prodName = String.format("出货追加新商品:%s - ", orderItemOld.getProdTitleZh());
// 新增品名
Boolean isAddNewOrderItem = !createReqVO.getIsAppend();
if (isAddNewOrderItem) {
prodName = String.format("出货追加新商品:%s - ", createReqVO.getProdTitleZh());
}
ApplyInfoVO infoVO;
if (isNew || !Objects.equals(orderItemOld.getProdId(), createReqVO.getProdId())) {
if (isAddNewOrderItem || !Objects.equals(orderItemOld.getProdId(), createReqVO.getProdId())) {
infoVO = new ApplyInfoVO();
infoVO.setName(isNew ? "新增商品" : "商品");
infoVO.setName(isAddNewOrderItem ? "新增商品" : "商品");
Long prodId = createReqVO.getProdId();
ProductDO productDONew = productService.getProduct(prodId);
infoVO.setNewValue(productDONew == null ? "空" : (I18nMessage.getLang() == 0 ? productDONew.getTitleZh() : productDONew.getTitleEn()));
applyInfoList.add(infoVO);
}
if (isNew || !Objects.equals(orderItemOld.getBrand(), createReqVO.getBrand())) {
if (isAddNewOrderItem || !Objects.equals(orderItemOld.getBrand(), createReqVO.getBrand())) {
infoVO = new ApplyInfoVO();
infoVO.setName(prodName + "品牌");
if (isNew) {
if (isAddNewOrderItem) {
infoVO.setOrgValue("空");
} else {
ProductBrankDO productBrankDOOld = productBrankMapper.selectById(orderItemOld.getBrand());
......@@ -3467,11 +3474,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// infoVO.setNewValue(brandTypeNew.equals(0) ? "无备案" : (brandTypeNew.equals(1) ? "有备案" : "中性"));
// applyInfoList.add(infoVO);
// }
if (isNew || !Objects.equals(orderItemOld.getFeeType(), createReqVO.getFeeType())) {
if (isAddNewOrderItem || !Objects.equals(orderItemOld.getFeeType(), createReqVO.getFeeType())) {
infoVO = new ApplyInfoVO();
infoVO.setName(prodName + "收费模式");
if (isNew) {
if (isAddNewOrderItem) {
infoVO.setOrgValue("空");
} else {
infoVO.setOrgValue(orderItemOld.getFeeType().equals(0) ? "无牌价" : (orderItemOld.getFeeType().equals(1) ? "有牌价" : "中性品牌价"));
......@@ -3491,7 +3498,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
BigDecimal volumeOld = BigDecimal.ZERO;
BigDecimal weightOld = BigDecimal.ZERO;
if (!isNew) {
if (!isAddNewOrderItem) {
// 统计原来的入仓数理,体积,重量
WarehouseInInfoVO warehouseInInfoVO = orderItemOld.getWarehouseInInfoVO();
numOld = warehouseInInfoVO == null ? 0 : warehouseInInfoVO.getCartonsNum();
......@@ -3531,7 +3538,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
infoVO = new ApplyInfoVO();
infoVO.setName(prodName + "材质");
if (!isNew && StringUtils.isNotEmpty(materialOld)) {
if (!isAddNewOrderItem && StringUtils.isNotEmpty(materialOld)) {
DictDataRespDTO material = DictFrameworkUtils.getDictDataFromCache("product_material", materialOld);
String labelEn = material != null ? material.getLabelEn() : materialOld;
String label = material != null ? material.getLabel() : materialOld;
......@@ -3552,8 +3559,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
String warehouseInProdAttrIdsNew = createReqVO.getWarehouseInProdAttrIds();
String warehouseInProdAttrIdsOld = isNew == null ? "" : StringUtils.isNotEmpty(orderItemOld.getWarehouseInProdAttrIds()) ? orderItemOld.getWarehouseInProdAttrIds() : orderItemOld.getProdAttrIds();
String prodAttrIdsSortOld = isNew == null ? "" : StringUtils.isNotEmpty(warehouseInProdAttrIdsOld) ?
String warehouseInProdAttrIdsOld = isAddNewOrderItem == null ? "" : StringUtils.isNotEmpty(orderItemOld.getWarehouseInProdAttrIds()) ? orderItemOld.getWarehouseInProdAttrIds() : orderItemOld.getProdAttrIds();
String prodAttrIdsSortOld = isAddNewOrderItem == null ? "" : StringUtils.isNotEmpty(warehouseInProdAttrIdsOld) ?
Arrays.stream(warehouseInProdAttrIdsOld.split(",")).filter(Objects::nonNull).sorted(Comparator.comparingInt(Integer::parseInt)).collect(Collectors.joining(",")) : "";
String prodAttrIdsSortNew = StringUtils.isNotEmpty(warehouseInProdAttrIdsNew) ?
......@@ -3594,11 +3601,8 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 入仓影像
List<String> pictureUrls =
CollectionUtil.isNotEmpty(createReqVO.getPictureUrls()) ? createReqVO.getPictureUrls() : new ArrayList<>();
List<String> pictureUrlsOld = isNew ? new ArrayList<>() :
orderWarehousePictureService.getWarehousePictureUrlList(5,
orderItemOld.getOrderItemId());
if (pictureUrlsOld.size() != pictureUrls.size() ||
pictureUrlsOld.containsAll(pictureUrls)) {
List<String> pictureUrlsOld = isAddNewOrderItem ? new ArrayList<>() : orderWarehousePictureService.getWarehousePictureUrlList(5, orderItemOld.getOrderItemId());
if (pictureUrlsOld.size() != pictureUrls.size() || pictureUrlsOld.containsAll(pictureUrls)) {
infoVO = new ApplyInfoVO();
infoVO.setName(prodName + "入仓影像");
infoVO.setOrgValue((CollectionUtil.isEmpty(pictureUrlsOld) ? 0 : pictureUrlsOld.size()) + "个");
......@@ -3609,7 +3613,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 入仓商品用途
String usageIdsNew = createReqVO.getUsageIds();
String usageIdsOld = isNew ? null : orderItemOld.getUsageIds();
String usageIdsOld = isAddNewOrderItem ? null : orderItemOld.getUsageIds();
String usageIdsSortOld = StringUtils.isNotEmpty(usageIdsOld) ?
Arrays.stream(usageIdsOld.split(",")).filter(Objects::nonNull).sorted(Comparator.comparingInt(Integer::parseInt)).collect(Collectors.joining(",")) : null;
String usageIdsSortNew = StringUtils.isNotEmpty(usageIdsNew) ?
......@@ -3669,7 +3673,7 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
String prodTitleZh = createReqVO.getProdTitleZh();
String prodTitleEn = createReqVO.getProdTitleEn();
OrderItemDO orderItemDO = null;
OrderItemDO orderItemDO = new OrderItemDO();
// 下单货物,
if (orderItemId != null) {
orderItemDO = orderItemService.selectOne(OrderItemDO::getOrderItemId,
......@@ -4186,7 +4190,10 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderService.shipmentOrderInWarehouse(orderWarehouseInVO);
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", "航运中修改", updateReqVO.getApplyInfoVOList());
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", "航运中-入仓修改审批已通过", updateReqVO.getApplyInfoVOList());
// 预装、理货、装柜
applicationContext.publishEvent(new BoxOrderShipmentWarehouseInEvent(orderId));
}
}
......@@ -4194,6 +4201,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
// 出货阶段 入仓追加 (有可能orderItemId为null)
else {
// 更新订单状态 出货阶段 入仓追加-已通过
Integer auditType = OrderApprovalTypeResultEnum.warehouse_update_pass.getType();
orderService.updateStatus(orderId, null, null, null,
null, null, 0, OrderApprovalTypeResultEnum.typeAndResultOf(auditType, result).getDesc(), false);
// copy
OrderWarehouseInCreateReqVO createReqVO = new OrderWarehouseInCreateReqVO();
BeanUtils.copyProperties(updateReqVO, createReqVO);
......@@ -4227,7 +4239,10 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
orderItemService.updateById(orderItemDO);
}
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", "航运中追加", updateReqVO.getApplyInfoVOList());
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", "航运中-入仓追加审批已通过", updateReqVO.getApplyInfoVOList());
// 预装、理货、装柜
applicationContext.publishEvent(new BoxOrderShipmentWarehouseInEvent(orderId));
}
......@@ -4255,8 +4270,16 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
String details = orderWarehouseApprovalDO.getDetails();
if (StringUtils.isNotEmpty(details)) {
OrderWarehouseInUpdateApplyReqVO updateReqVO = JSON.parseObject(details, OrderWarehouseInUpdateApplyReqVO.class);
String msg = "货物入仓修改申请已拒绝";
if (updateReqVO.getIsShipmentUpdate()) {
msg = "航运中-入仓修改申请已拒绝";
} else if (updateReqVO.getIsShipmentAppend()) {
msg = "航运中-入仓追加申请已拒绝";
}
// 添加仓库操作日志
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", "货物入仓修改申请已拒绝", updateReqVO.getApplyInfoVOList());
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", msg, updateReqVO.getApplyInfoVOList());
}
} else if (ApprovalResultStatusEnum.cancel.getValue().equals(result)) {
......@@ -4281,12 +4304,14 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
if (StringUtils.isNotEmpty(details)) {
OrderWarehouseInUpdateApplyReqVO updateReqVO = JSON.parseObject(details, OrderWarehouseInUpdateApplyReqVO.class);
String prefixStr = "";
if (updateReqVO.getIsShipmentAppend() || updateReqVO.getIsShipmentUpdate()) {
prefixStr = "航运中-";
String msg = "货物入仓修改申请已取消";
if (updateReqVO.getIsShipmentUpdate()) {
msg = "航运中-入仓修改申请已取消";
} else if (updateReqVO.getIsShipmentAppend()) {
msg = "航运中-入仓追加申请已取消";
}
// 添加仓库操作日志
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", prefixStr + "货物入仓修改申请已取消", updateReqVO.getApplyInfoVOList());
orderBusinessService.addOrderOperateLog(orderId, "仓库操作", msg, updateReqVO.getApplyInfoVOList());
}
}
}
......
......@@ -18,4 +18,8 @@ public class OrderFeeApplicationUpdateReqVO extends OrderFeeApplicationBaseVO {
@ApiModelProperty(value = "抄送人userId")
String[] copyUserId;
@ApiModelProperty(value = "是否有修改的状态")
private boolean editMode;
}
......@@ -11,7 +11,7 @@ import java.util.List;
@Data
@ToString(callSuper = true)
@ApiModel("管理后台 - 批量费用申请创建 Request VO")
@ApiModel("管理后台 - 批量费用申请创建或更新 Request VO")
public class OrderFeeBatchApplicationCreateReqVO {
@ApiModelProperty(value = "订单id", required = true)
@NotNull(message = "订单id不能为空")
......@@ -20,5 +20,5 @@ public class OrderFeeBatchApplicationCreateReqVO {
String[] copyUserId;
@ApiModelProperty(value = "批量费用")
@NotEmpty(message = "费用列表不能为空")
List<OrderFeeApplicationCreateReqVO> orderFeeApplicationCreateReqVOList;
List<OrderFeeApplicationUpdateReqVO> orderFeeApplicationCreateReqVOList;
}
package cn.iocoder.yudao.module.order.vo.orderFeeApplication;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.ToString;
import javax.validation.constraints.NotEmpty;
import javax.validation.constraints.NotNull;
import java.util.List;
@Data
@ToString(callSuper = true)
@ApiModel("管理后台 - 批量费用申请创建 Request VO")
public class OrderFeeBatchApplicationUpdateReqVO {
@ApiModelProperty(value = "订单id", required = true)
@NotNull(message = "订单id不能为空")
private Long orderId;
@ApiModelProperty(value = "抄送人userId")
String[] copyUserId;
@ApiModelProperty(value = "批量费用")
@NotEmpty(message = "费用列表不能为空")
List<OrderFeeApplicationUpdateReqVO> orderFeeApplicationCreateReqVOList;
}
......@@ -15,10 +15,7 @@ import cn.iocoder.yudao.module.order.enums.ApprovalResultStatusEnum;
import cn.iocoder.yudao.module.order.service.approval.OrderApprovalService;
import cn.iocoder.yudao.module.order.service.order.OrderFeeApplicationService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.vo.orderFeeApplication.OrderFeeApplicationBackVO;
import cn.iocoder.yudao.module.order.vo.orderFeeApplication.OrderFeeApplicationQueryVO;
import cn.iocoder.yudao.module.order.vo.orderFeeApplication.OrderFeeApplicationUpdateReqVO;
import cn.iocoder.yudao.module.order.vo.orderFeeApplication.OrderFeeBatchApplicationCreateReqVO;
import cn.iocoder.yudao.module.order.vo.orderFeeApplication.*;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
......@@ -85,7 +82,7 @@ public class OrderFeeApplicationController {
@PostMapping("/create/batch")
@ApiOperation("批量创建订单费用申请")
@Idempotent(timeout = 10)
public CommonResult<Boolean> createFeeBatchApplication(@Valid @RequestBody OrderFeeBatchApplicationCreateReqVO createReqVO) throws Exception {
public CommonResult<Boolean> createFeeBatchApplication(@Valid @RequestBody OrderFeeBatchApplicationUpdateReqVO createReqVO) throws Exception {
String redisKey = MessageFormat.format(ORDER_FEE_APPLICATION_KEY, createReqVO.getOrderId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){
......
......@@ -93,6 +93,15 @@ Content-Type: application/json
{"table":[{"id":46775,"cartonsNum":100,"quantityAll":100,"specificationType":"1","unit":"1","boxGauge":"150*34*44","volume":22.44,"weight":30,"expressNo":"df123123","remark":null,"inTime":1698722752000,"heavyNumber":null,"lightNumber":3747.5,"orderLocationBackVOList":[{"id":49330,"orderId":19698,"wareId":1,"areaId":3,"locationId":8,"orderItemId":28123,"warehouseInId":46775,"adminId":0,"createTime":1698722752000,"warehouseName":"广州仓A","areaName":"B","locationName":"3-1"}],"createTime":1698722752000,"updateTime":1698722752000,"orderLocationStr4Merge":"B3-1","orderWarehouseInDetailsVOList":[{"unit":"2","brand":441,"prodId":395,"volume":"0.11","weight":30,"boxGauge":"141*23*33","usageIds":"","expressNo":"sf12312312","cartonsNum":null,"createTime":null,"prodAttrIds":"2,2","quantityAll":"222","specificationType":null}],"boxGauge1":"150","boxGauge2":"34","boxGauge3":"44"}],"brandType":0,"orderId":19698,"orderNo":"A2300278NG","brand":325,"inTime":null,"material":null,"orderItemId":28123,"warehouseInProdAttrIds":"2","prodId":3314,"prodTitleEn":"kifdasdasd","prodTitleZh":"kif头戴式耳机","prodType":1,"feeType":0,"recordMode":0,"pictureUrls":["https://static.jd.jdshangmen.com/2023/10/31/654073bfe4b09171582d5638.png"],"usageIds":"","num":100,"volume":"2.12","weight":"30.00","orderWarehouseInUpdateItemDoList":[{"id":46775,"cartonsNum":100,"quantityAll":100,"specificationType":"1","unit":"1","boxGauge":"150*34*44","volume":22.44,"weight":30,"expressNo":"df123123","remark":null,"inTime":1698722752000,"heavyNumber":null,"lightNumber":3747.5,"orderLocationBackVOList":[{"id":49330,"orderId":19698,"wareId":1,"areaId":3,"locationId":8,"orderItemId":28123,"warehouseInId":46775,"adminId":0,"createTime":1698722752000,"warehouseName":"广州仓A","areaName":"B","locationName":"3-1"}],"createTime":1698722752000,"updateTime":1698722752000,"orderLocationStr4Merge":"B3-1","orderWarehouseInDetailsVOList":[{"unit":"2","brand":441,"prodId":395,"volume":"0.11","weight":30,"boxGauge":"141*23*33","usageIds":"","expressNo":"sf123112","cartonsNum":null,"createTime":null,"prodAttrIds":"2,2","quantityAll":"222","specificationType":null}],"boxGauge1":"150","boxGauge2":"34","boxGauge3":"44","orderLocationCreateReqVOList":[{"id":49330,"orderId":19698,"wareId":1,"areaId":3,"locationId":8,"orderItemId":28123,"warehouseInId":46775,"adminId":0,"createTime":1698722752000,"warehouseName":"广州仓A","areaName":"B","locationName":"3-1"}]}]}
### 出货阶段 - 入仓/追加申请
POST {{baseUrl}}/order/order-warehouse-in/append-apply-when-shipment
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
{"table":[{"boxGauge1":"2","boxGauge2":"2","boxGauge3":"2","cartonsNum":"2","expressNo":"","unit":"1","volume":"0.01","weight":"2","specificationType":"1","table":[],"orderLocationBackVOList":[]}],"brandType":0,"orderId":83529,"orderNo":"NG2424546L","brand":2635,"material":"1","warehouseInProdAttrIds":"2","prodId":3842,"prodTitleEn":"TV screen","prodTitleZh":"电视屏幕","type":1,"feeType":2,"recordMode":1,"pictureUrls":["https://static2.groupage.cn/2024/11/15/67362cdee4b0afc77d38d646.png"],"usageIds":"","orderWarehouseInItemDoList":[{"boxGauge1":"2","boxGauge2":"2","boxGauge3":"2","cartonsNum":"2","expressNo":"","unit":"1","volume":"0.01","weight":"2","specificationType":"1","table":[],"orderLocationBackVOList":[],"boxGauge":"2*2*2","orderLocationCreateReqVOList":[]}]}
### 调仓申请
......@@ -154,7 +163,7 @@ Content-Type: application/json
#### 入仓修改回调
GET {{baseUrl}}/order/order-warehouse-in/update-apply-callback?formId=201&result=2
GET {{baseUrl}}/order/order-warehouse-in/update-apply-callback?formId=12128&result=2
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
......
......@@ -367,7 +367,7 @@ public interface CouponMapper extends BaseMapperX<CouponDO> {
"AND c.start_time between #{reqVO.beginStartTime} and #{reqVO.endStartTime} ",
"</when>",
"<when test = 'reqVO.beginEndTime != null and reqVO.endEndTime != null'>",
"AND DATE_FORMAT(c.end_time,'%Y-%m-%d 23:59:59') between #{reqVO.beginEndTime} and #{reqVO.endEndTime} ",
"AND <![CDATA[ ( (DATE_FORMAT(c.end_time,'%Y-%m-%d 23:59:59') between #{reqVO.beginEndTime} and #{reqVO.endEndTime}) or (now() <= #{reqVO.endEndTime} and c.end_time is null) ) ]]> ",
"</when>",
" <when test='reqVO.beginCreateTime != null' >",
......
......@@ -5,6 +5,7 @@ import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.order.dto.OrderBackInfoDto;
import cn.iocoder.yudao.module.sale.dal.dataobject.offer.OfferDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.sale.vo.offer.*;
......@@ -419,4 +420,24 @@ public interface OfferMapper extends BaseMapperX<OfferDO> {
"</script>"
})
List<OfferRespVO> getOrderAssociationOfferList(@Param("queryVO") OrderAssociationOfferQueryVO queryVO, @Param("lang") Integer lang);
@ResultType(OfferRespVO.class)
@Select({
"<script>",
"SELECT",
"o.*,",
"d.name as dept_name,",
"u.nickname as business_manager_name,",
"if(#{lang} = 0, c.name_zh, c.name_en) as channel_name, ",
"c.attr_id as channel_attr_id ",
"FROM",
"ecw_offer o ",
"LEFT JOIN ecw_channel c on o.channel_id = c.channel_id",
"LEFT JOIN system_dept d on o.dept_id = d.id",
"LEFT JOIN system_user u on o.salesman_id = u.id",
"WHERE",
"o.offer_id = #{offerId}",
"</script>"
})
OfferRespVO info(@Param("offerId") Long offerId, @Param("lang") Integer lang);
}
......@@ -188,7 +188,7 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
}
}
if (Objects.nonNull(createReqVO.getConsigneeId()) && createReqVO.getConsigneeId() > 0) {
if (Objects.isNull(createReqVO.getControl()) || !createReqVO.getControl()) {
if (Objects.nonNull(createReqVO.getControl()) && createReqVO.getControl()) {
// 获取功能开关
List<DictDataRespDTO> dictList = dictDataApi.getDictDatas("part_function_switch");
// 智慧预装功能开关
......@@ -516,7 +516,7 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
}
}
if (Objects.nonNull(updateReqVO.getConsigneeId()) && updateReqVO.getConsigneeId() > 0) {
if (Objects.isNull(updateReqVO.getControl()) || !updateReqVO.getControl()) {
if (Objects.nonNull(updateReqVO.getControl()) && updateReqVO.getControl()) {
// 获取功能开关
List<DictDataRespDTO> dictList = dictDataApi.getDictDatas("part_function_switch");
// 智慧预装功能开关
......@@ -647,7 +647,7 @@ public class OfferServiceImpl extends AbstractService<OfferMapper, OfferDO> impl
throw exception(OFFER_NOT_EXISTS);
}
OfferRespVO respVO = OfferConvert.INSTANCE.convert(offerDO);
OfferRespVO respVO = offerMapper.info(offerId, I18nMessage.getLang());
EstCostVO estCostVO = JSONObject.parseObject(offerDO.getEstCost(), EstCostVO.class);
if (Objects.nonNull(estCostVO)) {
List<FeeDto> feeDtoList = estCostVO.getFeeDtoList();
......
......@@ -78,9 +78,15 @@ public class OfferRespVO extends OfferBaseVO {
@ApiModelProperty(value = "渠道名称")
private String channelName;
@ApiModelProperty(value = "渠道特性id")
private String channelAttrId;
@ApiModelProperty(value = "客户编号")
private String customerNumber;
@ApiModelProperty(value = "客户经理所属部门")
private String deptName;
@ApiModelProperty(value = "业务员名称-客户经理")
private String businessManagerName;
......
......@@ -43,7 +43,7 @@ public class BoxOrderRevokeWarehouseCheckListener {
// 跟新卸柜/到仓箱标数据表未真实卸柜的箱标到仓时间为null
boxLoadInfoService.update(new LambdaUpdateWrapper<BoxLoadInfoDO>()
.set(BoxLoadInfoDO::getUnloadTime, null)
.eq(BoxLoadInfoDO::getIsUnload, 0)
.set(BoxLoadInfoDO::getIsUnload, 0)
.eq(BoxLoadInfoDO::getOrderId, event.getOrderId()));
}
......
package cn.iocoder.yudao.module.shipment.listener;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.box.BoxOrderShipmentWarehouseInEvent;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderLocation.OrderLocationDO;
import cn.iocoder.yudao.module.order.service.order.OrderItemService;
import cn.iocoder.yudao.module.order.service.order.OrderLocationService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.vo.orderLocation.OrderLocationCreateReqVO;
import cn.iocoder.yudao.module.shipment.convert.BoxPreloadGoodsConvert;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxPreloadGoodsDO;
import cn.iocoder.yudao.module.shipment.enums.LdStatusEnum;
import cn.iocoder.yudao.module.shipment.enums.TyStatueEnum;
import cn.iocoder.yudao.module.shipment.service.box.BoxService;
import cn.iocoder.yudao.module.shipment.service.boxLoadInfo.BoxLoadInfoService;
import cn.iocoder.yudao.module.shipment.service.boxPreloadGoods.BoxPreloadGoodsService;
import cn.iocoder.yudao.module.shipment.vo.boxLoadInfo.BoxLoadInfoCreateReqVO;
import cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsCreateReqVO;
import cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods.BoxPreloadGoodsQueryVO;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.annotation.Lazy;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.*;
import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_NOT_EXISTS;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.BOX_NOT_EXISTS;
/**
* 出货中订单入仓修改业务
*
* @author yanghao
*/
@Component("BoxOrderShipmentWarehouseInListener")
@AllArgsConstructor
@Slf4j
public class BoxOrderShipmentWarehouseInListener {
@Resource
private BoxLoadInfoService boxLoadInfoService;
@Resource
private BoxPreloadGoodsService boxPreloadGoodsService;
@Resource
private BoxService boxService;
@Resource
private OrderService orderService;
@Resource
private OrderItemService orderItemService;
@Resource
private OrderLocationService orderLocationService;
/**
* 订单强制到仓业务执行
*
* @param event 订单信息
*/
@EventListener(BoxOrderShipmentWarehouseInEvent.class)
public void boxOrderShipmentWarehouseIn(BoxOrderShipmentWarehouseInEvent event) {
Long orderId = event.getOrderId();
OrderDO orderDO = orderService.getById(orderId);
if (Objects.isNull(orderDO)) {
throw exception(ORDER_NOT_EXISTS);
}
String containerNumber = orderDO.getContainerNumber();
if (StringUtils.isEmpty(containerNumber)) {
log.info("订单号:{},没有箱号,不需要处理", orderDO.getOrderNo());
return;
}
BoxDO boxDO = boxService.getOne(new LambdaQueryWrapper<BoxDO>().eq(BoxDO::getSelfNo, containerNumber));
if (boxDO == null) {
throw exception(BOX_NOT_EXISTS);
}
// 针对新添加的品名 生成预装单 并设置提单
boxPreloadInsert(orderId, boxDO);
// 若理货完成,则自动修改储位。
batchOrderLocationUpdate(orderId, boxDO);
// 若装柜完成,则自动装柜。
if (boxDO.getLdStatus() != null && boxDO.getLdStatus() >= LdStatusEnum.INSTALLED_TO_BE_SEALED.getLdStatus()) {
// 海运
BoxLoadInfoCreateReqVO boxLoadInfoCreateReqVO = new BoxLoadInfoCreateReqVO();
boxLoadInfoCreateReqVO.setOrderId(orderId);
boxLoadInfoCreateReqVO.setOrderNo(orderDO.getOrderNo());
boxLoadInfoCreateReqVO.setShipmentId(boxDO.getId());
if (orderDO.getTransportId() == 1 || orderDO.getTransportId() == 2) {
boxLoadInfoService.batchCreate(boxLoadInfoCreateReqVO);
} else {
// 空运
boxLoadInfoService.batchAirCreate(boxLoadInfoCreateReqVO);
}
}
}
private void boxPreloadInsert(Long orderId, BoxDO boxDO) {
// 1、查看此订单下的预装信息
BoxPreloadGoodsQueryVO query = new BoxPreloadGoodsQueryVO();
query.setOrderId(orderId);
query.setShipmentId(boxDO.getId());
List<BoxPreloadGoodsDO> boxPreloadGoodsList = boxPreloadGoodsService.getBoxPreloadGoodsList(query);
if (CollectionUtil.isNotEmpty(boxPreloadGoodsList)) {
// 得到所有的orderItem
List<Long> orderItemIdListOld = boxPreloadGoodsList.stream().map(BoxPreloadGoodsDO::getOrderItemId).collect(Collectors.toList());
// 根据orderId查询OrderItemList,然后找出新增的OrderItemList
List<OrderItemDO> orderItemListNew = orderItemService.getOrderItemsByOrderId(Arrays.asList(orderId));
// 找出新增的OrderItemId
List<Long> newOrderItemIdList = orderItemListNew.stream().map(OrderItemDO::getOrderItemId)
.filter(t -> !orderItemIdListOld.contains(t)).collect(Collectors.toList());
// 添加预装
BoxPreloadGoodsDO boxPreloadGoodsDO = boxPreloadGoodsList.stream().findFirst().get();
// 转换为BoxPreloadGoodsCreateReqVO
BoxPreloadGoodsCreateReqVO createReqVO = new BoxPreloadGoodsCreateReqVO();
BeanUtils.copyProperties(boxPreloadGoodsDO, createReqVO);
// 预装入库
List<BoxPreloadGoodsDO> preloadGoodsDOList = new ArrayList<>();
for (Long orderItemId : newOrderItemIdList) {
BoxPreloadGoodsDO boxPreloadGoods = BoxPreloadGoodsConvert.INSTANCE.convert(createReqVO);
boxPreloadGoods.setOrderItemId(orderItemId);
if (createReqVO.getIsCover() != null) {
boxPreloadGoods.setIsCover(createReqVO.getIsCover());
}
preloadGoodsDOList.add(boxPreloadGoods);
}
// 插入
boxPreloadGoodsService.insertBatch(preloadGoodsDOList);
}
}
private void batchOrderLocationUpdate(Long orderId, BoxDO boxDO) {
if (boxDO.getTyStatus() != null && boxDO.getTyStatus().equals(TyStatueEnum.HAS_TALLY.getTyStatus())) {
List<OrderLocationDO> orderLocationDOList = orderLocationService.getOrderLocationListByOrderId(orderId);
if (CollectionUtil.isNotEmpty(orderLocationDOList)) {
// 将orderLocationDOList按orderItemId分组后,获取到第一个OrderItemId的所有储位数据
Map<Long, List<OrderLocationDO>> groupedByOrderItemId = orderLocationDOList.stream()
.collect(Collectors.groupingBy(OrderLocationDO::getOrderItemId));
// 获取第一个OrderItemId的所有储位数据
if (!groupedByOrderItemId.isEmpty()) {
Long firstOrderItemId = groupedByOrderItemId.keySet().iterator().next();
List<OrderLocationDO> firstOrderItemIdLocations = groupedByOrderItemId.get(firstOrderItemId);
// 得到所有储位 并去重。
List<OrderLocationCreateReqVO> orderLocationCreateReqVOList = new ArrayList<>();
for (OrderLocationDO location : firstOrderItemIdLocations) {
boolean noneMatch = orderLocationCreateReqVOList.stream().noneMatch(t -> t.getOrderId().equals(orderId)
&& Objects.equals(t.getWareId(), location.getWareId())
&& Objects.equals(t.getAreaId(), location.getAreaId())
&& Objects.equals(t.getLocationId(), location.getLocationId()));
if (noneMatch) {
OrderLocationCreateReqVO orderLocationCreateReqVO = new OrderLocationCreateReqVO();
orderLocationCreateReqVO.setOrderId(orderId);
orderLocationCreateReqVO.setWareId(location.getWareId());
orderLocationCreateReqVO.setAreaId(location.getAreaId());
orderLocationCreateReqVO.setLocationId(location.getLocationId());
orderLocationCreateReqVOList.add(orderLocationCreateReqVO);
}
}
// 批量修改储位
orderLocationService.tallyUpdate(orderId, orderLocationCreateReqVOList);
}
}
}
}
}
......@@ -197,23 +197,23 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.eq(BoxPreloadGoodsDO::getIsRemove, 0)
);
OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
// 2024-11-5 注意:此处要关注关联订单,关联订单也是一并修改成不受费用申请和特价影响
if (StringUtils.isNotBlank(orderDO.getGuanLianOrderStatus())){
if (StringUtils.isNotBlank(orderDO.getGuanLianOrderStatus())) {
List<GuanLianOrderStatusVO> guanLianOrderStatusVOList = JSONObject.parseArray(orderDO.getGuanLianOrderStatus(), GuanLianOrderStatusVO.class);
if (CollectionUtil.isNotEmpty(guanLianOrderStatusVOList) && guanLianOrderStatusVOList.size() > 0){
if (CollectionUtil.isNotEmpty(guanLianOrderStatusVOList) && guanLianOrderStatusVOList.size() > 0) {
List<GuanLianOrderStatusVO> approvalGuanLianOrderList = guanLianOrderStatusVOList.stream().filter(vo -> vo.getType() == 2).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(approvalGuanLianOrderList)){
if (CollectionUtil.isNotEmpty(approvalGuanLianOrderList)) {
String orderNoStr = approvalGuanLianOrderList.stream().filter(o -> {
OrderApprovalTypeCheckEvent guanLianApprovalTypeCheckEvent = new OrderApprovalTypeCheckEvent(o.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent guanLianApprovalTypeCheckEvent = new OrderApprovalTypeCheckEvent(o.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(guanLianApprovalTypeCheckEvent);
return guanLianApprovalTypeCheckEvent.getResult();
}).map(GuanLianOrderStatusVO::getOrderNo).collect(Collectors.joining(StrUtil.COMMA));
if (StringUtils.isNotBlank(orderNoStr)){
if (StringUtils.isNotBlank(orderNoStr)) {
throw exception(GUAN_LIAN_ORDER_IS_APPROVAL_IN_PROCESS, orderNoStr);
}
}
......@@ -782,7 +782,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderDO orderDO,
List<Long> orderItemIdList) {
//订单校验是否在审核中
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
......@@ -919,7 +919,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BigDecimal volumeSum = boxGoodsStatistics.getVolume();
BigDecimal weightSum = boxGoodsStatistics.getWeight();
if(orderDO!=null) {
if (orderDO != null) {
if (orderDO.getSumNum() != null) {
numSum += orderDO.getSumNum();
boxGoodsStatistics.setNum(numSum);
......@@ -1428,7 +1428,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
));
Iterator<Long> orderIdIt = orderMap.keySet().iterator();
for (Integer num : missList) {
if(orderIdIt.hasNext()) {
if (orderIdIt.hasNext()) {
Long orderId = orderIdIt.next();
List<BoxPreloadGoodsDO> orderGoodList = orderMap.get(orderId);
setTidanNum(orderGoodList, num, selfNo, updateOrder);
......@@ -1439,7 +1439,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
List<BoxPreloadGoodsDO> resultList = orderMap.values().stream()
.flatMap(Collection::stream)
.collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(resultList)) {
if (CollectionUtil.isNotEmpty(resultList)) {
setTidanNum(resultList, orderNum, selfNo, updateOrder);
}
}
......@@ -1447,13 +1447,13 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
}
if(updateOrder) {
if (updateOrder) {
Set<Long> orderIdSet = preloadGoodsList.stream()
.map(BoxPreloadGoodsDO::getOrderId)
.collect(Collectors.toSet());
Map<Long, Integer> tidanNumMap = preloadGoodsList.stream()
.collect(Collectors.toMap(BoxPreloadGoodsDO::getOrderId, BoxPreloadGoodsDO::getTidanNum, (v1, v2)->v2));
.collect(Collectors.toMap(BoxPreloadGoodsDO::getOrderId, BoxPreloadGoodsDO::getTidanNum, (v1, v2) -> v2));
for (Long orderId : orderIdSet) {
Integer orderNum = tidanNumMap.get(orderId);
String ladingBillNo = selfNo + "-" + orderNum;
......@@ -1464,6 +1464,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 找出有间隔的订单
*
* @param list 预装商品项
* @return
*/
......@@ -1525,6 +1526,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 根据订单生成提单号
*
* @param orderId 订单ID
* @return
*/
......@@ -1603,8 +1605,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxDO boxDO = boxService.getBox(shipmentId);
Integer prStatus = boxDO.getPrStatus();
Set<Long> orderIdSet = getShipOrderIdList(shipmentId);
if(CollectionUtil.isEmpty(orderIdSet)) {
if(prStatus == PrStatusEnum.PRELOAD_ING.getPrStatus() ||
if (CollectionUtil.isEmpty(orderIdSet)) {
if (prStatus == PrStatusEnum.PRELOAD_ING.getPrStatus() ||
prStatus == PrStatusEnum.PRELOAD_APPROVAL_FAIL.getPrStatus()
) {
//修改为已订舱,待预装
......@@ -1613,7 +1615,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
}
} else {
//修改为预装中
if(prStatus == PrStatusEnum.NO_PRELOAD.getPrStatus() ||
if (prStatus == PrStatusEnum.NO_PRELOAD.getPrStatus() ||
prStatus == PrStatusEnum.PRELOAD_APPROVAL_FAIL.getPrStatus()
) {
//未预装和预装审核失败的情况才修改为预装中
......@@ -1626,6 +1628,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
/**
* 把订单从出货单中删除
*
* @param shipmentId 出货单ID
* @param orderIdCollection 订单列表
* @param type 1 预装移除 2 理货移除 3 装柜移除
......@@ -1633,7 +1636,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
*/
@Override
public void deleteOrderList(Long shipmentId, Collection<Long> orderIdCollection, Integer type, boolean hasExit) {
if(CollectionUtil.isNotEmpty(orderIdCollection)) {
if (CollectionUtil.isNotEmpty(orderIdCollection)) {
//删除装柜商品
boxPreloadGoodsMapper.delete(new LambdaQueryWrapperX<BoxPreloadGoodsDO>()
.in(BoxPreloadGoodsDO::getOrderId, orderIdCollection)
......@@ -1652,8 +1655,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//删除该订单在理货这合包时的装箱数据
boxOrderCheckInfoService.remove(new LambdaQueryWrapperX<BoxOrderCheckInfoDO>()
.eq(BoxOrderCheckInfoDO::getShipmentId,shipmentId)
.in(BoxOrderCheckInfoDO::getOrderId,orderIdCollection)
.eq(BoxOrderCheckInfoDO::getShipmentId, shipmentId)
.in(BoxOrderCheckInfoDO::getOrderId, orderIdCollection)
);
//删除已经理货的数据
......@@ -1921,7 +1924,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//查询订单的报关费用
List<BoxLoadOrderVO> orderVOList = detailBackVO.getSectionOrderList();
if(CollectionUtil.isNotEmpty(orderVOList)) {
if (CollectionUtil.isNotEmpty(orderVOList)) {
List<Long> orderIdList = orderVOList.stream()
.map(BoxLoadOrderVO::getOrderId)
.collect(Collectors.toList());
......@@ -1935,16 +1938,16 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
detailBackVO.setAbnormalList(BoxAbnormalConvert.INSTANCE.convertList(abnormalList));
String dealOrderIds = null;
BoxAbnormalDO boxAbnormalDO = null;
if(CollectionUtil.isNotEmpty(abnormalList)) {
if (CollectionUtil.isNotEmpty(abnormalList)) {
boxAbnormalDO = abnormalList.get(0);
dealOrderIds = boxAbnormalDO.getDealOrderIds();
}
if(StringUtils.isEmpty(dealOrderIds)) {
if (StringUtils.isEmpty(dealOrderIds)) {
dealOrderIds = "";
}
for (BoxLoadOrderVO orderVO : orderVOList) {
orderVO.setCustomsFee(orderFeeMap.get(orderVO.getOrderId()));
if(boxAbnormalDO == null) {
if (boxAbnormalDO == null) {
orderVO.setAbnormalDealStatus(1);
} else {
boolean isDeal = dealOrderIds.contains(orderVO.getOrderId().toString());
......@@ -2157,14 +2160,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.collect(Collectors.toList());
}
if (CollectionUtil.isNotEmpty(unLoadItemList)) {
//过滤审核中的订单
// 过滤审核中的订单 这里需要修改逻辑, 订单除拆单申请/合单申请/调仓申请/订单修改/入仓申请/退仓申请外,其他审批申请不受限制,允许订单预装
Set<Long> oIdList = unLoadItemList.stream()
.map(OrderItemDO::getOrderId)
.collect(Collectors.toSet());
List<OrderApprovalDO> orderApprovalList = boxService.getOrderApprovalIng(oIdList);
List<Long> approvalIdList = orderApprovalList.stream()
.map(OrderApprovalDO::getOrderId)
.collect(Collectors.toList());
List<Long> approvalIdList = new ArrayList<>();
for (Long orderId : oIdList) {
OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
approvalIdList.add(orderId);
}
}
list = list.stream()
.filter(t -> !approvalIdList.contains(t.getOrderId()))
.collect(Collectors.toList());
......@@ -2300,18 +2308,18 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
OrderConsigneeDO filterConsigneeDO = getFilterOrderConsigneeDO(boxDO, loadList);
OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6,11,13,14,22,23) , false);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
if(filterConsigneeDO != null) {
if (filterConsigneeDO != null) {
//校验收货人是否是同一个人
OrderConsigneeDO consigneeDO = boxService.getOrderConsignee(orderDO);
//校验是否是用一个人 ,通过手机号
if(consigneeDO != null && !consigneeDO.getPhone().equals(filterConsigneeDO.getPhone())) {
if (consigneeDO != null && !consigneeDO.getPhone().equals(filterConsigneeDO.getPhone())) {
throw new ServiceException(500, "当前自编号是客户+自清,收货人必须是手机号相同才可以进行分拣");
}
}
......@@ -2319,7 +2327,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//如果都符合,下面展示互斥和关联订单的弹窗
Integer relationStatus = createReqVO.getRelationStatus();
//校验是否是互斥订单
if(relationStatus == null || relationStatus == 2) {
if (relationStatus == null || relationStatus == 2) {
//校验互斥订单
checkMutualOrder(loadList, orderDO);
}
......@@ -2330,7 +2338,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
boolean hasRelationOrder = CollectionUtil.isNotEmpty(orderRelationList);
if(hasRelationOrder) {
if (hasRelationOrder) {
Set<Long> orderIdSet = orderRelationList.stream()
.flatMap(o -> Stream.of(o.getOrderId(), o.getRelateOrderId()))
.collect(Collectors.toSet());
......@@ -2406,7 +2414,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//过滤了入仓为0的数据
List<OrderItemBackVO> orderItemList = orderItemService.getOrderItemBackByOrderId(orderIdList);
if(CollectionUtil.isEmpty(orderItemList)) {
if (CollectionUtil.isEmpty(orderItemList)) {
throw new ServiceException(500, "订单项不存在");
}
......@@ -2713,14 +2721,19 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
.collect(Collectors.toList());
}
if (CollectionUtil.isNotEmpty(unLoadItemList)) {
//过滤审核中的订单
// 过滤审核中的订单 2024-11-13 这里有新的逻辑修改 订单除拆单申请/合单申请/调仓申请/订单修改/入仓申请/退仓申请外,其他审批申请不受限制,允许订单预装
Set<Long> oIdList = unLoadItemList.stream()
.map(OrderItemDO::getOrderId)
.collect(Collectors.toSet());
List<OrderApprovalDO> orderApprovalList = boxService.getOrderApprovalIng(oIdList);
List<Long> approvalIdList = orderApprovalList.stream()
.map(OrderApprovalDO::getOrderId)
.collect(Collectors.toList());
List<Long> approvalIdList = new ArrayList<>();
for (Long orderId : oIdList) {
OrderDO orderDO = orderService.getById(orderId);
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
approvalIdList.add(orderId);
}
}
list = list.stream()
.filter(t -> !approvalIdList.contains(t.getOrderId()))
.collect(Collectors.toList());
......@@ -2814,15 +2827,32 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
Iterator<OrderPreloadVO> it = orderPreloadList.iterator();
while (it.hasNext()) {
OrderPreloadVO orderPreloadVO = it.next();
String guanlianOrderStatus = orderPreloadVO.getGuanLianOrderStatus();
if (StringUtils.isEmpty(guanlianOrderStatus)) continue;
JSONArray jsonArray = JSONArray.parseArray(guanlianOrderStatus);
if (jsonArray.size() > 0) {
if (StringUtils.isNotBlank(orderPreloadVO.getGuanLianOrderStatus())) {
List<GuanLianOrderStatusVO> guanLianOrderStatusVOList = JSONObject.parseArray(orderPreloadVO.getGuanLianOrderStatus(), GuanLianOrderStatusVO.class);
if (CollectionUtil.isNotEmpty(guanLianOrderStatusVOList) && guanLianOrderStatusVOList.size() > 0) {
List<GuanLianOrderStatusVO> approvalGuanLianOrderList = guanLianOrderStatusVOList.stream().filter(vo -> vo.getType() == 2).collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(approvalGuanLianOrderList)) {
boolean isApproval = approvalGuanLianOrderList.stream().anyMatch(o -> {
if (o.getType() == 2) {
// 关联单进行中的审批类型校验
OrderApprovalTypeCheckEvent guanLianApprovalTypeCheckEvent = new OrderApprovalTypeCheckEvent(o.getOrderId(), null, null, Arrays.asList(6, 11, 13, 14, 22, 23), false);
applicationContext.publishEvent(guanLianApprovalTypeCheckEvent);
return guanLianApprovalTypeCheckEvent.getResult();
}else {
// 关联单有异常或未完成入仓
return true;
}
});
if (isApproval) {
//表示该订单的关联单-有异常或者在审核中或者未入仓
it.remove();
}
}
}
}
}
}
private String getSectionText(Long secId, List<BoxPreloadSectionDO> boxSectionList) {
Integer lang = I18nMessage.getLang();
......@@ -3069,7 +3099,7 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
//添加参数,解决合包箱数据为空时不计算预装箱数的BUG
calculateBoxMergeSum(shipmentMergeMap.get(shipmentId),
boxGoodsStatistics,shipmentId);
boxGoodsStatistics, shipmentId);
shipmentStatisticsMap.put(shipmentId, boxGoodsStatistics);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment