Commit 47f00984 authored by Administrator's avatar Administrator

Merge branch 'release' into 'jd_dev'

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

See merge request !31
parents 3e0355a2 6a2804f4
This diff is collapsed.
-- 客户主营类型 由 单个 改为 多个逗号分隔
alter table `ecw_customer`
change column `product_type` `product_types` varchar(300) DEFAULT NULL COMMENT '主营类型,多个逗号分隔';
-- 因为客户跟进表会有原来的跟进数据录入,故需要先把原来的跟进跟进编号录入到日志表中
-- 注意更新后 需要在应用启动前执行。因为此表会缓存。
insert into ecw_order_number_log(number_key, `number`, type, version, creator, create_time, updater, update_time, deleted)
select 'followup:new:number', max(`number`), 6, 0, 1, CURRENT_TIMESTAMP, 1, CURRENT_TIMESTAMP, 0 from ecw_customer_followup;
-- 增加订单的到仓数据字段
alter table ecw_order
add COLUMN `check_num` int DEFAULT '0' COMMENT '到仓件数';
alter table ecw_order
add COLUMN `check_volume` decimal(10, 2) DEFAULT '0.00' COMMENT '到仓体积';
alter table ecw_order
add COLUMN `check_quantity` int DEFAULT '0' COMMENT '到仓数量';
alter table ecw_order
add COLUMN `check_weight` decimal(10, 2) DEFAULT '0.00' COMMENT '到仓重量';
alter table ecw_order_item
add COLUMN `check_material` varchar(255) DEFAULT NULL COMMENT '到仓材质';
alter table ecw_order_item
add COLUMN `warehouse_check_prod_attr_ids` varchar(50) DEFAULT NULL COMMENT '到仓商品特性(可选多个特性ID)';
alter table ecw_order_item
add COLUMN `check_brand` bigint DEFAULT NULL COMMENT '到仓品牌';
alter table ecw_order_item
add COLUMN `check_brand_type` tinyint NOT NULL DEFAULT '0' COMMENT '到仓:0 无牌 1 有牌 2 中性';
alter table ecw_order_item
add COLUMN `warehouse_check_info` json DEFAULT NULL COMMENT '到仓信息json';
-- 跟进记录菜单
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 ( '跟进记录', '', 2, 1, 1417, 'offer/logList', 'log', 'ecw/offer/logList', 0, '2702', '2024-10-27 12:02:57', '2702', '2024-10-27 12:04:30', b'0', b'1', 'followLog', b'0', NULL, NULL);
-- 到仓详情表
CREATE TABLE `ecw_order_warehouse_check` (
`id` bigint NOT NULL AUTO_INCREMENT COMMENT '主键ID',
`warehouse_in_id` bigint NOT NULL COMMENT '入仓记录id',
`order_id` bigint NOT NULL COMMENT '订单ID',
`order_no` char(50) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '订单编号',
`order_item_id` bigint NOT NULL COMMENT '订单项id',
`cartons_num` int NOT NULL DEFAULT '0' COMMENT '箱/件数',
`check_cartons_num` int NOT NULL DEFAULT '0' COMMENT '到仓箱/件数',
`quantity_all` int DEFAULT NULL COMMENT '所有箱总数量',
`unit` char(10) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '单位',
`box_gauge` char(100) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '箱规',
`volume` decimal(10,2) DEFAULT NULL COMMENT '体积',
`weight` decimal(10,2) DEFAULT NULL COMMENT '重量',
`express_no` varchar(2048) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL DEFAULT '' COMMENT '快递单号',
`check_time` datetime DEFAULT NULL COMMENT '到仓时间',
`creator` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '创建者',
`create_time` datetime NOT NULL COMMENT '创建时间',
`updater` varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT '' COMMENT '更新者',
`update_time` datetime DEFAULT NULL COMMENT '更新时间',
`deleted` bit(1) DEFAULT b'0' COMMENT '是否删除',
`source` int DEFAULT '1' COMMENT '入仓来源 字典order_warehouse_in_source 1-始发港入仓、2-调拨入仓、3-目的港入仓、4-退场入仓',
`specification_type` int DEFAULT '1' COMMENT '入仓规格类型',
`remark` varchar(512) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
`order_warehouse_check_details` json DEFAULT NULL COMMENT '到仓纪录明细json',
PRIMARY KEY (`id`),
KEY `order_id` (`order_id`),
KEY `warehouse_in_id` (`warehouse_in_id`),
KEY `order_item_id` (`order_item_id`)
) ENGINE=InnoDB COMMENT='到仓货物详情表'
-- 补充字典脚本
INSERT INTO `system_dict_type` (`name`, `type`, `status`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`) VALUES ('商品列表中文标题匹配字段', 'prod_query_title_zh_field', 0, NULL, '2702', '2024-10-29 13:43:47', '2702', '2024-10-29 13:43:47', b'0');
INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`) VALUES (0, '包含', 'titleZhKey', 'prod_query_title_zh_field', 0, 'default', '', NULL, '2702', '2024-10-29 13:44:28', '2702', '2024-10-29 13:44:28', b'0', 'include');
INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`) VALUES (1, '等于', 'eqTitleZhKey', 'prod_query_title_zh_field', 0, 'default', '', NULL, '2702', '2024-10-29 13:45:12', '2702', '2024-10-29 13:45:12', b'0', 'equal');
INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`) VALUES (2, '不等于', 'notEqTitleZhKey', 'prod_query_title_zh_field', 0, 'default', '', NULL, '2702', '2024-10-29 13:45:39', '2702', '2024-10-29 13:45:58', b'0', 'not equal');
INSERT INTO `system_dict_data` (`sort`, `label`, `value`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`, `label_en`) VALUES (4, '不包含', 'notTitleZhKey', 'prod_query_title_zh_field', 0, 'default', '', NULL, '2702', '2024-10-29 13:46:58', '2702', '2024-10-29 13:46:58', b'0', 'not contain');
......@@ -221,6 +221,40 @@ public class CodeUtils {
}
}
/**
* 功能描述: 自动生成跟进单单号. 格式: GJ+年份YYYY+六位数
*
* @param maxOddNumbers 数据库中的最新单号
* @return java.lang.String
*/
public static String getOddFollowupNumbers(String maxOddNumbers) {
// 格式: GJ+年份YYYY+六位数
int numberLength = 12;
//获取当前日期并将其进行格式化
String formatYear = getDateTime("yyyy");
int newEndIntNum;
//判断数据中的最大单号是否存在,是否包含当前日期
if (StringUtils.isNotEmpty(maxOddNumbers) && maxOddNumbers.length() == numberLength &&
maxOddNumbers.substring(2, 6).equals(formatYear)) {
//截取后四位数
String endNum = maxOddNumbers.substring(maxOddNumbers.length() - 6);
//把截取的最后六位数解析为int
int endIntNum = Integer.parseInt(endNum);
//在将其加1(自增1)
newEndIntNum = endIntNum + 1;
} else {
// 如果为空(第一次生成)或者当前最大订单号的日期与当前日期不一致说明需要重新计数生成单号
newEndIntNum = 1;
}
//生成单号
String newOddNumber = String.format("%s%s%06d", "GJ", formatYear, newEndIntNum);
//将单号返回
return newOddNumber;
}
/**
* 功能描述: 自动生成收款单单单号
......
package cn.iocoder.yudao.framework.apollo.core.event;
import lombok.AllArgsConstructor;
import lombok.Data;
/**
* 审批校验 Event
*
* @author zhengYi
*/
@Data
@AllArgsConstructor
public class BoxCheckOrderApprovalEvent {
/**
* 订单ID
*/
private Long orderId;
/**
* 自编号
*/
private String selfNo;
/**
* 类型
*/
private Integer auditType;
/**
* 结果
*/
private String auditResult;
/**
* 是否存在
*/
private Boolean isExists;
}
package cn.iocoder.yudao.framework.apollo.core.event.Order;
import lombok.AllArgsConstructor;
import lombok.Data;
import java.util.List;
@Data
@AllArgsConstructor
public class OrderApprovalTypeCheckEvent {
/**
* 订单id
*/
private Long orderId;
/**
* 订单项id
*/
private List<Long> orderItemIdList;
/**
* 订单审批类型 {@link cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum}
*/
private Integer approvalType;
/**
* 订单审批类型列表 {@link cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum}
*/
private List<Integer> approvalTypeList;
/**
* 是否包含互斥审批类型: true 包含互斥审批或相同的审批不能进行重复审批 false 是没有包含互斥审批类型和当前审批类型
*/
private Boolean result;
}
......@@ -105,7 +105,7 @@ public class CustomerDO extends BaseDO {
/**
* 产品类型
*/
private Long productType;
private String productTypes;
/**
* 产品id
*/
......
......@@ -73,7 +73,8 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
"",
"country.name_zh as country_name_zh, country.name_en as country_name_en,",
"",
"pt.title_zh as product_type_name_zh, pt.title_en as product_type_name_en,",
"(SELECT GROUP_CONCAT(title_zh) FROM ecw_product_type pt WHERE FIND_IN_SET(pt.id,(SELECT product_types FROM ecw_customer WHERE id=c.id))) AS product_type_name_zh, ",
"(SELECT GROUP_CONCAT(title_en) FROM ecw_product_type pt WHERE FIND_IN_SET(pt.id,(SELECT product_types FROM ecw_customer WHERE id=c.id))) AS product_type_name_en, ",
"",
"(SELECT GROUP_CONCAT(title_zh) FROM ecw_product p WHERE FIND_IN_SET(p.id,(SELECT product_ids FROM ecw_customer WHERE id=c.id))) AS product_name_zh, ",
"(SELECT GROUP_CONCAT(title_en) FROM ecw_product p WHERE FIND_IN_SET(p.id,(SELECT product_ids FROM ecw_customer WHERE id=c.id))) AS product_name_en, ",
......@@ -96,7 +97,6 @@ public interface CustomerMapper extends BaseMapperX<CustomerDO> {
"left join ecw_customer_level cl on c.level = cl.id",
"left join ecw_customer_credit cc on c.credit_level = cc.id",
"left join ecw_country country on c.country = country.id",
"left join ecw_product_type pt on c.product_type = pt.id",
"left join system_user u on c.customer_service = u.id",
"left join system_user uc on c.creator = uc.id",
"left join system_user uu on c.updater = uu.id",
......
......@@ -68,6 +68,7 @@ public interface CustomerContactsMapper extends BaseMapperX<CustomerContactsDO>
"c.id as customer_id, ",
"c.name as customer_name, ",
"c.name_en as customer_name_en, ",
"c.number as customer_number, ",
"c.default_pay as default_pay, ",
"c.no_consignee as no_consignee, ",
"cc.* , ",
......@@ -110,6 +111,7 @@ public interface CustomerContactsMapper extends BaseMapperX<CustomerContactsDO>
"c.id as customer_id, ",
"c.name as customer_name, ",
"c.name_en as customer_name_en, ",
"c.number as customer_number, ",
"c.default_pay as default_pay, ",
"c.no_consignee as no_consignee, ",
"cc.* , ",
......
......@@ -13,6 +13,9 @@ public class CustomerContactsDto {
@ApiModelProperty(value = "客户联系人ID")
private Long customerContactsId;
@ApiModelProperty(value = "客户编码")
private String customerNumber;
@ApiModelProperty(value = "客户名称", required = true)
@NotNull(message = "客户名称不能为空")
private String customerName;
......
......@@ -35,4 +35,6 @@ public interface ErrorCodeConstants {
ErrorCode FOLLOWUP_NOT_EXISTS = new ErrorCode(1005001013, "客户跟进不存在");
ErrorCode FOLLOWUP_ALREADY_SUBMITTED = new ErrorCode(1005001014, "客户跟进已提交不可再修改");
ErrorCode FOLLOWUP_NUMBER_NOT_NULL = new ErrorCode(1005001015, "客户跟进编号不能为空");
}
......@@ -15,7 +15,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
*/
public interface CustomerFollowupService extends IService<CustomerFollowupDO> {
String generateFollowupNumber();
CustomerFollowupNumberBackVO generateFollowupNumber();
/**
* 创建客户跟进
......
package cn.iocoder.yudao.module.customer.service.customerFollowup;
import java.time.LocalDate;
import java.time.LocalDateTime;
import java.time.ZoneId;
import java.util.*;
import javax.annotation.Resource;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.OrderNumberLogEvent;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.code.CodeUtils;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.framework.mybatis.core.util.MyBatisUtils;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customerFollowup.CustomerFollowupConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO;
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;
import org.springframework.validation.annotation.Validated;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.mybatis.core.service.AbstractService;
import cn.iocoder.yudao.module.customer.vo.customerFollowup.*;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.customer.convert.customerFollowup.CustomerFollowupConvert;
import cn.iocoder.yudao.module.customer.dal.mysql.customerFollowup.CustomerFollowupMapper;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.FOLLOWUP_ALREADY_SUBMITTED;
import static cn.iocoder.yudao.module.customer.enums.ErrorCodeConstants.FOLLOWUP_NOT_EXISTS;
/**
* 客户跟进 Service 实现类
......@@ -54,36 +61,58 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Resource
private CustomerContactsMapper customerContactsMapper;
// 注入applicationContext
@Resource
private ApplicationContext applicationContext;
private static final String FOLLOWUP_NEW_NUMBER = "followup:new:number";
/**
* 跟进单编号生成方式:GJ+年份+六位数字,按年份累计
* @return
*/
@Override
public String generateFollowupNumber() {
// 获取当前时间的年份
LocalDate now = LocalDate.now();
int year = now.getYear();
// 获取当前年份的初始化时间
LocalDateTime startOfYear = LocalDateTime.of(year, 1, 1, 0, 0, 0, 0);
Date from = Date.from(startOfYear.atZone(ZoneId.systemDefault()).toInstant());
Long count = followupMapper.selectCount(new LambdaQueryWrapperX<CustomerFollowupDO>()
.ge(CustomerFollowupDO::getCreateTime, from));
return String.format("GJ%d%06d", year, count + 1);
public CustomerFollowupNumberBackVO generateFollowupNumber() {
// 跟进单号生成
OrderNumberLogEvent event = new OrderNumberLogEvent();
event.setType(6);
event.setNumberKey(FOLLOWUP_NEW_NUMBER);
applicationContext.publishEvent(event);
String newFollowupNumber = CodeUtils.getOddFollowupNumbers(event.getNumber());
CustomerFollowupNumberBackVO customerFollowupNumberBackVO =
new CustomerFollowupNumberBackVO()
.setNumber(newFollowupNumber)
.setNumberId(event.getId())
.setNumberVersion(event.getVersion());
return customerFollowupNumberBackVO;
}
@Override
@Transactional(rollbackFor = Exception.class)
public Long createFollowup(CustomerFollowupCreateReqVO createReqVO) {
// 获取新编号
String newNumber = createReqVO.getNumber();
Long numberId = createReqVO.getNumberId();
Integer numberVersion = createReqVO.getNumberVersion();
// 编号不存在,报异常
if (StringUtils.isBlank(newNumber)) {
throw exception(ErrorCodeConstants.FOLLOWUP_NUMBER_NOT_NULL);
}
String number = generateFollowupNumber();
createReqVO.setNumber(number);
// 更新编号,内部会判断冲突
OrderNumberLogEvent event = new OrderNumberLogEvent();
event.setId(numberId);
event.setVersion(numberVersion);
event.setNewNumber(newNumber);
event.setType(6);
event.setNumberKey(FOLLOWUP_NEW_NUMBER);
applicationContext.publishEvent(event);
// 插入
CustomerFollowupDO followup = CustomerFollowupConvert.INSTANCE.convert(createReqVO);
// 设置联系人名称
setContactName(followup);
......@@ -175,7 +204,19 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
@Override
public void updateFollowupStatus(CustomerFollowupUpdateStatusReqVO updateStatusReqVO) {
Long id = updateStatusReqVO.getId();
Long updateId = updateStatusReqVO.getId();
List<Long> ids = updateStatusReqVO.getIds();
List<Long> idList = new ArrayList<>();
// id + ids 到idList
if (updateId!= null) {
idList.add(updateId);
}
if (CollectionUtil.isNotEmpty(ids)) {
idList.addAll(ids);
}
for (Long id : idList) {
CustomerFollowupDO customerFollowupDO = followupMapper.selectById(id);
if (customerFollowupDO == null) {
throw exception(FOLLOWUP_NOT_EXISTS);
......@@ -184,12 +225,15 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
if (CustomerFollowupStatusEnum.Commited.getValue().equals(customerFollowupDO.getStatus())) {
throw exception(FOLLOWUP_ALREADY_SUBMITTED);
}
}
for (Long id : idList) {
CustomerFollowupDO customerFollowupDO = followupMapper.selectById(id);
customerFollowupDO.setStatus(updateStatusReqVO.getStatus());
followupMapper.updateById(customerFollowupDO);
Long customerId = customerFollowupDO.getCustomerId();
if (customerId != null) {
CustomerDO customer = customerMapper.selectById(customerId);
......@@ -214,6 +258,7 @@ public class CustomerFollowupServiceImpl extends AbstractService<CustomerFollowu
}
}
}
}
@Override
public void deleteFollowup(Long id) {
......
......@@ -43,8 +43,8 @@ public class CustomerCreateReqVO extends CustomerBaseVO {
@ApiModelProperty(value = "联系地址")
private String address;
@ApiModelProperty(value = "产品类型id")
private Long productType;
@ApiModelProperty(value = "产品类型ids,多个逗号分隔")
private String productTypes;
@ApiModelProperty(value = "产品ids")
private String productIds;
......
......@@ -67,7 +67,7 @@ public class CustomerDetailRespVO extends CustomerBaseVO {
private String address;
@ApiModelProperty(value = "产品类型id")
private Long productType;
private String productTypes;
@ApiModelProperty(value = "产品ids")
private String productIds;
......
......@@ -50,8 +50,8 @@ public class CustomerUpdateReqVO extends CustomerBaseVO {
@ApiModelProperty(value = "联系地址")
private String address;
@ApiModelProperty(value = "产品类型")
private Long productType;
@ApiModelProperty(value = "产品类型ids,多个逗号分隔")
private String productTypes;
@ApiModelProperty(value = "产品ids")
private String productIds;
......
......@@ -11,4 +11,10 @@ import javax.validation.constraints.*;
@ApiModel("管理后台 - 客户跟进创建 Request VO")
public class CustomerFollowupCreateReqVO extends CustomerFollowupBaseVO {
@ApiModelProperty(value = "编号纪录ID")
private Long numberId;
@ApiModelProperty(value = "行号")
private Integer numberVersion;
}
package cn.iocoder.yudao.module.customer.vo.customerFollowup;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 客户跟进 编码 VO,提供给添加、修改、详细的子 VO 使用
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成
*/
@Data
@ApiModel("管理后台 - 客户跟进编码查询返回 VO")
public class CustomerFollowupNumberBackVO {
@ApiModelProperty(value = "编号")
private String number;
@ApiModelProperty(value = "编号纪录ID")
private Long numberId;
@ApiModelProperty(value = "行号")
private Integer numberVersion;
}
......@@ -21,15 +21,25 @@ public class CustomerFollowupQueryVO extends PageParam {
@ApiModelProperty(value = "状态 字典customer_followup_status")
private Integer status;
@ApiModelProperty(value = "客户编号")
@ApiModelProperty(value = "客户id")
private Long customerId;
@ApiModelProperty(value = "客户编号")
private String customerNumber;
@ApiModelProperty(value = "客户编号")
private Long customerDetailId;
@ApiModelProperty(value = "报价单")
@ApiModelProperty(value = "报价单id")
private Long offerId;
@ApiModelProperty(value = "报价单id列表")
private List<Long> offerIds;
@ApiModelProperty(value = "报价单编号")
private String offerNumber;
@ApiModelProperty(value = "跟进类型 字典customer_followup_type")
private Integer followType;
......@@ -85,6 +95,15 @@ public class CustomerFollowupQueryVO extends PageParam {
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
// 更新时间
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始更新时间")
private Date beginUpdateTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "结束更新时间")
private Date endUpdateTime;
@ApiModelProperty(value = "跟进类型,下拉多选")
private List<Integer> followTypes;
......@@ -96,4 +115,13 @@ public class CustomerFollowupQueryVO extends PageParam {
@ApiModelProperty(value = "跟进状态,下拉多选")
private List<Integer> statuses;
@ApiModelProperty(value = "客户经理/跟进业务员ids")
private List<Long> followUserIds;
@ApiModelProperty(value = "联系人电话")
private String contactPhone;
}
......@@ -7,6 +7,7 @@ import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.util.List;
@ApiModel("管理后台 - 客户跟进更新状态 Request VO")
@Data
......@@ -17,6 +18,11 @@ public class CustomerFollowupUpdateStatusReqVO {
@NotNull(message = "主键不能为空")
private Long id;
//ids
@ApiModelProperty(value = "主键列表", required = true)
@NotNull(message = "主键列表不能为空")
private List<Long> ids;
@ApiModelProperty(value = "状态 字典customer_followup_status")
private Integer status;
......
......@@ -20,8 +20,8 @@
<if test="query.customerId != null">
AND a.customer_id = #{query.customerId}
</if>
<if test="query.offerId != null">
AND a.offer_id = #{query.offerId}
<if test="query.offerIds != null and query.offerIds.size() > 0">
AND FIND_IN_SET(a.offer_id, #{query.offerIds})
</if>
<if test="query.followType != null">
......@@ -38,35 +38,53 @@
AND a.result_type = #{query.resultType}
</if>
<if test="query.followTypes != null and query.followTypes.size()>0">
AND
<foreach item='item' index="index" collection='query.followTypes' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, a.follow_type)
</foreach>
<if test="query.followTypes != null and query.followTypes.size() > 0">
AND FIND_IN_SET(a.follow_type, #{query.followTypes})
</if>
<if test="query.followMethods != null and query.followMethods.size()>0">
AND
<foreach item='item' index="index" collection='query.followMethods' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, a.follow_method)
</foreach>
AND FIND_IN_SET(a.follow_method, #{query.followMethods})
</if>
<if test="query.resultTypes != null and query.resultTypes.size()>0">
AND
<foreach item='item' index="index" collection='query.resultTypes' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, a.result_type)
</foreach>
AND FIND_IN_SET(a.result_type, #{query.resultTypes})
</if>
<if test="query.statuses != null and query.statuses.size()>0">
AND
<foreach item='item' index="index" collection='query.statuses' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, a.status)
</foreach>
AND FIND_IN_SET(a.status, #{query.statuses})
</if>
<if test="query.followUserIds!= null and query.followUserIds.size() > 0">
AND FIND_IN_SET(a.follow_user_id, #{query.followUserIds})
</if>
<if test="query.beginFollowTime != null and query.endFollowTime != null">
AND ( a.follow_time BETWEEN #{query.beginFollowTime} AND #{query.endFollowTime} )
</if>
<if test="query.beginNextTime!= null and query.endNextTime!= null">
AND ( a.next_time BETWEEN #{query.beginNextTime} AND #{query.endNextTime} )
</if>
<if test="query.beginCreateTime!= null and query.endCreateTime!= null">
AND ( a.create_time BETWEEN #{query.beginCreateTime} AND #{query.endCreateTime} )
</if>
<if test="query.beginUpdateTime!= null and query.endUpdateTime!= null">
AND ( a.update_time BETWEEN #{query.beginUpdateTime} AND #{query.endUpdateTime} )
</if>
<if test="query.contactPhone != null and query.contactPhone != '' ">
AND concat('+', g.area_code, g.phone_new, '') LIKE concat('%', concat( #{query.contactPhone}, '%' ))
</if>
<if test="query.customerNumber != null and query.customerNumber != '' ">
AND b.number LIKE concat('%', concat( #{query.customerNumber}, '%' ))
</if>
<if test="query.offerNumber != null and query.offerNumber != '' ">
AND c.number LIKE concat('%', concat( #{query.offerNumber}, '%' ))
</if>
</sql>
<select id="selectPage1" resultType="cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO">
......@@ -96,6 +114,12 @@
<select id="selectCount1" resultType="java.lang.Long">
select count(1)
from ecw_customer_followup a
left join ecw_customer b on a.customer_id = b.id
left join ecw_offer c on a.offer_id = c.offer_id
left join system_user d on a.creator = d.id
left join system_user e on a.updater = e.id
left join system_user f on a.follow_user_id = f.id
left join ecw_customer_contacts g on a.contact_id = g.id
WHERE 1=1 AND a.deleted = 0
<include refid="queryCondition"/>
</select>
......
......@@ -699,7 +699,7 @@
<if test="query.productTypes != null and query.productTypes.size()>0">
AND
<foreach item='item' index="index" collection='query.productTypes' open='(' separator='or' close=')'>
FIND_IN_SET(#{item}, contact.product_type)
FIND_IN_SET(#{item}, contact.product_types)
</foreach>
</if>
<!--主营商品名称-->
......
......@@ -379,17 +379,11 @@ public class CustomerController {
if (customerDOSaved == null) {
throw exception(ErrorCodeConstants.CUSTOMER_SAVED_NOT_EXISTS);
}
if (customerDOSaved.getCustomerService() == null) {
throw exception(ErrorCodeConstants.CUSTOMER_SAVED_CUSTOMER_SERVICE_IS_NULL);
}
CustomerDO customerDODeleted = customerService.getById(par.getCustomerIdDeleted());
if (customerDODeleted == null) {
throw exception(ErrorCodeConstants.CUSTOMER_DELETED_NOT_EXISTS);
}
if (customerDODeleted.getCustomerService() == null) {
throw exception(ErrorCodeConstants.CUSTOMER_DELETED_CUSTOMER_SERVICE_IS_NULL);
}
if (!customerDOSaved.getCustomerService().equals(customerDODeleted.getCustomerService())) {
if (!Objects.equals(customerDOSaved.getCustomerService(), customerDODeleted.getCustomerService())) {
throw exception(ErrorCodeConstants.CUSTOMER_MERGE_CUSTOMER_SERVICE_NOT_SAME);
}
......
package cn.iocoder.yudao.module.customer.controller.admin.customer;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.boot.module.order.api.OrderApi;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
......@@ -7,7 +8,6 @@ import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.complaint.CustomerComplaintDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.follow.CustomerFollowDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerFollowup.CustomerFollowupDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
......@@ -33,6 +33,7 @@ import cn.iocoder.yudao.module.wealth.service.commissionPayment.CommissionPaymen
import cn.iocoder.yudao.module.wealth.service.receipt.ReceiptServiceImpl;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import lombok.extern.log4j.Log4j2;
import org.apache.commons.beanutils.BeanUtils;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
......@@ -338,12 +339,22 @@ public class CustomerMergeServiceImpl implements CustomerMergeService {
if (CollectionUtil.isNotEmpty(cuscontactList2)) {
for (CustomerContactsDO d : cuscontactList2
) {
d.setCustomerId(customerDOSaved.getId());
try {
// 1、联系人copy一份
CustomerContactsDO newCustomer = new CustomerContactsDO();
BeanUtil.copyProperties(d, newCustomer);
newCustomer.setId(null);
//被合并的客户联系人,默认为非默认
d.setIsDefault(0);
d.setUpdateTime(new Date());
d.setUpdater(String.valueOf(loginUserId));
customerContactsService.updateById(d);
newCustomer.setIsDefault(0);
// 设置被合并客户的联系人
newCustomer.setCustomerId(customerDOSaved.getId());
customerContactsService.save(newCustomer);
// 2、删除被合并客户的联系人
customerContactsService.deleteCustomerContacts(d.getId());
} catch (Exception e) {
log.error("合并客户联系人失败", e);
}
}
}
}
......
### 客户跟进
GET {{baseUrl}}/customer/followup/getFollowupNewNumber
Authorization: Bearer {{token}}
tenant-id: {{adminTenentId}}
Content-Type: application/json
### 客户跟进
GET {{baseUrl}}/customer/followup/page?pageNo=1&pageSize=10&total=0&customerId=51966
Authorization: Bearer {{token}}
......
......@@ -42,6 +42,16 @@ public class CustomerFollowupController {
@Resource
private FileMakeApi fileMakeApi;
@GetMapping("/getFollowupNewNumber")
@ApiOperation("获得最新的跟进编号")
public CommonResult<CustomerFollowupNumberBackVO> getFollowupNewNumber() {
CustomerFollowupNumberBackVO customerFollowupNumberBackVO = followupService.generateFollowupNumber();
return success(customerFollowupNumberBackVO);
}
@PostMapping("/create")
@ApiOperation("创建客户跟进")
// @PreAuthorize("@ss.hasPermission('customer:followup:create')")
......
......@@ -21,8 +21,14 @@ public class WarehouseLineQueryVO {
@ApiModelProperty(value = "运输方式")
private Integer transportType;
@ApiModelProperty(value = "目的地城市id")
private List<Long> destCityId;
@ApiModelProperty(value = "目的国家id")
private Long destCountryId;
private List<Long> destCountryId;
@ApiModelProperty(value = "目的仓")
private List<Long> destWarehouseId;
@ApiModelProperty(value = "出货渠道ID,空运才有,海运可以为空")
private Long channelId;
......
......@@ -123,12 +123,32 @@
</foreach>
</if>
<if test="query.transportType != null">
AND line.transport_type = #{query.transportType}
<!--目的地-->
<if test="query.destCityId != null and query.destCityId.size()>0 ">
and destwarehouse.`shi` in
<foreach item='destCity' index='index' collection='query.destCityId' open='(' separator=',' close=')'>
#{destCity}
</foreach>
</if>
<!--目的国-->
<if test="query.destCountryId != null and query.destCountryId.size()>0 ">
and destwarehouse.`guojia` in
<foreach item='destCountry' index='index' collection='query.destCountryId' open='(' separator=',' close=')'>
#{destCountry}
</foreach>
</if>
<if test="query.destCountryId != null">
AND destwarehouse.guojia = #{query.destCountryId}
<!--目的仓-->
<if test="query.destWarehouseId != null and query.destWarehouseId.size()>0 ">
AND line.dest_warehouse_id IN
<foreach item='destWarehouse' index='index' collection='query.destWarehouseId' open='(' separator=',' close=')'>
#{destWarehouse}
</foreach>
</if>
<if test="query.transportType != null">
AND line.transport_type = #{query.transportType}
</if>
<if test="query.channelId != null">
......
......@@ -669,7 +669,17 @@ public class OrderDO extends BaseDO {
private Boolean isInOpenSea;
@ApiModelProperty(value = "到仓件数")
private Integer checkNum;
@ApiModelProperty(value = "到仓数量")
private Integer checkQuantity;
@ApiModelProperty(value = "到仓体积")
private BigDecimal checkVolume;
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
@ApiModelProperty(value = "订单修改是否变动了归属客户,此字段用来判定订单是否需要重置归属客户经理,下单后归属客户的客户经理是固定的,除非订单归属客户变动,才需要重置客户经理")
@TableField(exist = false)
......
......@@ -416,6 +416,23 @@ public class OrderItemDO extends BaseDO {
@ApiModelProperty(value = "是否处理了渠道特性异常")
private Boolean handlerChannelAttrException;
@ApiModelProperty(value = "到仓材质")
private String checkMaterial;
@ApiModelProperty(value = "到仓商品特性(可选多个特性ID)")
private String warehouseCheckProdAttrIds;
@ApiModelProperty(value = "到仓品牌")
private Long checkBrand;
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息json")
private String warehouseCheckInfo;
/**
* 1-未设置商品清关费, 2-区间未匹配上
*/
......
package cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseCheck;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseIn.handler.OrderWarehouseInDetailsTypeHandler;
import cn.iocoder.yudao.module.order.vo.order.OrderWarehouseInDetailsVO;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.ToString;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
/**
* 到仓货物详情 DO
*/
@Data
@Builder
@NoArgsConstructor
@AllArgsConstructor
@TableName(value = "ecw_order_warehouse_check", autoResultMap = true)
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class OrderWarehouseCheckDO extends BaseDO {
/**
* 主键ID
*/
@TableId
private Long id;
/**
* 订单ID
*/
private Long orderId;
/**
* 订单编号
*/
private String orderNo;
/**
* 订单项id
*/
private Long orderItemId;
/**
* 箱/件数
*/
private Integer cartonsNum;
/**
* 所有箱内总货物数量
*/
private Integer quantityAll;
/**
* 单位
*/
private String unit;
/**
* 入仓规格类型 1箱/2整板 见字典 warehousing_specification_type
*/
private Integer specificationType;
/**
* 箱规
*/
private String boxGauge;
/**
* 体积
*/
private BigDecimal volume;
/**
* 重量
*/
private BigDecimal weight;
/**
* 快递单号
*/
private String expressNo;
/**
* 到仓时间
*/
private Date checkTime;
/**
* 到仓来源 字典order_warehouse_check_source 1-始发港入仓、2-调拨入仓、3-目的港入仓、4-退场入仓
*/
private Integer source;
/**
* 备注
*/
private String remark;
/**
* 入仓记录id
*/
private Long warehouseInId;
/**
* 入仓纪录明细VO
*/
@TableField(value = "order_warehouse_check_details", typeHandler = OrderWarehouseInDetailsTypeHandler.class)
private List<OrderWarehouseInDetailsVO> orderWarehouseInDetailsVOList;
@TableField(exist = false)
private String locationId;
}
package cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseCheck.handler;
import cn.iocoder.yudao.framework.common.util.json.JsonUtils;
import cn.iocoder.yudao.module.order.vo.order.OrderWarehouseCheckDetailsVO;
import com.baomidou.mybatisplus.extension.handlers.AbstractJsonTypeHandler;
import java.util.List;
public class OrderWarehouseCheckDetailsTypeHandler extends AbstractJsonTypeHandler<List<OrderWarehouseCheckDetailsVO>> {
@Override
protected List<OrderWarehouseCheckDetailsVO> parse(String json) {
return JsonUtils.parseArray(json, OrderWarehouseCheckDetailsVO.class);
}
@Override
protected String toJson(List<OrderWarehouseCheckDetailsVO> obj) {
return JsonUtils.toJsonString(obj);
}
}
\ No newline at end of file
......@@ -200,4 +200,24 @@ public interface OrderApprovalMapper extends AbstractMapper<OrderApprovalDO> {
"</script>"
})
List<OrderApprovalDO> approvalListBytTypeAndStatus(@Param("orderId") Long orderId, @Param("typeList") List<Integer> typeList, @Param("status") Integer status);
@ResultType(Long.class)
@Select({
"<script>",
"select",
" count(1)",
"from ecw_order_approval a",
"where ",
"a.order_id = #{orderId} ",
"<when test = 'types != null and types.size() > 0'>",
"and a.type in <foreach item='type' index='index' collection='types' open='(' separator=',' close=')'>#{type}</foreach> ",
"</when>",
"<when test = 'orderItemIdList != null and orderItemIdList.size() > 0'>",
"and (a.details->>'$.orderItemId' is null or (a.details->>'$.orderItemId' is not null and a.details->>'$.orderItemId' in <foreach item='orderItemId' index='index' collection='orderItemIdList' open='(' separator=',' close=')'>#{orderItemId}</foreach>)) ",
"</when>",
"and a.status = 1 ",
"</script>"
})
long countProcessingApproval(@Param("orderId") Long orderId, @Param("orderItemIdList") List<Long> orderItemIdList, @Param("types") List<Integer> types);
}
......@@ -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=0 ",
"and eo.audit_type not in(1,2,3,4,5,12,31,32) ",
"<when test = 'query.rucangTimeStart != null'>",
"AND eo.`rucang_time` &gt;= #{query.rucangTimeStart}",
"</when>",
......
......@@ -166,10 +166,13 @@ public interface OrderItemMapper extends AbstractMapper<OrderItemDO> {
"(oi.original_clearance_freight + oi.packaging_freight_price + oi.brand_clearance_fee_price + oi.electrified_clearance_fee_price + oi.liquid_clearance_fee_price - oi.discount_clearance_fee_price) as after_discount_clearance_freight, ",
"IF(o.order_type != 2 and (SELECT COUNT(1) FROM ecw_order_exception hoe WHERE hoe.order_id = o.order_id AND hoe.deleted = 0 AND hoe.order_exception_status = 0 AND hoe.order_exception_type ='order_heavy_cargo_exception') = 0, IFNULL(oi.warehouse_in_info ->> '$.volume', oi.volume), oi.w_volume ) as we_volume,",
"IF(o.order_type != 3 and (SELECT COUNT(1) FROM ecw_order_exception boe WHERE boe.order_id = o.order_id AND boe.deleted = 0 AND boe.order_exception_status = 0 AND boe.order_exception_type ='order_bulky_cargo_exception') = 0, IFNULL(oi.warehouse_in_info ->> '$.weight', oi.weight), oi.v_weight ) as vo_weight,",
"IF(#{lang} = 0, pd.title_zh, pd.title_en) as brand_name ",
"IF(#{lang} = 0, pd.title_zh, pd.title_en) as brand_name, ",
"IF(#{lang} = 0, pdc.title_zh, pdc.title_en) as brand_name ",
"from ecw_order_item oi",
"left join ecw_product_brank pd",
"on pd.id = oi.brand",
"left join ecw_product_brank pdc",
"on pdc.id = oi.check_brand",
"left join ecw_order o",
"on o.order_id = oi.order_id",
"where oi.deleted = 0 and ",
......
......@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.order.vo.orderWarehouseApproval.OrderWarehouseApprovalQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
/**
......@@ -69,4 +70,23 @@ public interface OrderWarehouseApprovalMapper extends AbstractMapper<OrderWareho
@Select("select * from ecw_order_warehouse_approval where deleted = 0 and type = #{type} and order_ids = #{orderId} order by id desc limit 1")
OrderWarehouseApprovalDO selectOne(@Param("type") Integer type, @Param("orderId") Long orderId);
@ResultType(Long.class)
@Select({
"<script>",
"select",
" count(1)",
"from ecw_order_warehouse_approval a",
"where ",
"a.order_ids = #{orderId} ",
"<when test = 'typeList != null and typeList.size() > 0'>",
"and a.type in <foreach item='type' index='index' collection='typeList' open='(' separator=',' close=')'>#{type}</foreach> ",
"</when>",
"<when test = 'orderItemIdList != null and orderItemIdList.size() > 0'>",
"and (a.order_item_id is null or (a.order_item_id is not null and a.order_item_id in <foreach item='orderItemId' index='index' collection='orderItemIdList' open='(' separator=',' close=')'>#{orderItemId}</foreach>)) ",
"</when>",
"and a.status = 1 ",
"</script>"
})
long countProcessingApproval(@Param("orderId") Long orderId, @Param("orderItemIdList") List<Long> orderItemIdList, @Param("typeList") List<Integer> typeList);
}
package cn.iocoder.yudao.module.order.dal.mysql.orderWarehouseCheck;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseCheck.OrderWarehouseCheckDO;
import org.apache.ibatis.annotations.Mapper;
/**
* 到仓货物详情 Mapper
*/
@Mapper
public interface OrderWarehouseCheckMapper extends AbstractMapper<OrderWarehouseCheckDO> {
}
......@@ -549,6 +549,18 @@ public class OrderBackInfoDto {
@ApiModelProperty(value = "放货箱数")
private Integer releaseNum;
@ApiModelProperty(value = "到仓件数")
private Integer checkNum;
@ApiModelProperty(value = "到仓数量")
private Integer checkQuantity;
@ApiModelProperty(value = "到仓体积")
private BigDecimal checkVolume;
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
public void setExceptionReason(String exceptionReason) {
this.exceptionReason = exceptionReason;
if (StringUtils.isNotBlank(exceptionReason) && Objects.nonNull(this.lang)) {
......
......@@ -223,6 +223,9 @@ public interface ErrorCodeConstants {
ErrorCode WAREHOUSE_APPROVAL_BATCH_ADJUST_APPLYING = new ErrorCode(1006010014, "warehouse.approval.batch.adjust.applying");
ErrorCode WAREHOUSE_APPROVAL_PASSED_CANNOT_CANCEL = new ErrorCode(1006010015, "warehouse.approval.passed.cannot.cancel");
ErrorCode ORDER_WAREHOUSE_CHECK_NOT_EXISTS = new ErrorCode(1006010016, "order.warehouse.check.not.exists");
ErrorCode ORDER_WAREHOUSE_CHECK_BAD_VOLUME = new ErrorCode(1006010017, "order.warehouse.check.bad.volume");
ErrorCode ORDER_WAREHOUSE_CHECK_BAD_WEIGHT = new ErrorCode(1006010018, "order.warehouse.check.bad.weight");
ErrorCode ORDER_LABEL_NOT_EMPTY = new ErrorCode(1006010020, "order.label.not.empty");
......@@ -425,4 +428,6 @@ public interface ErrorCodeConstants {
ErrorCode ORDER_IS_OVERSEAS_WAREHOUSE_ORDER = new ErrorCode(1004001169, "order.is.overseas.warehouse.order");
// 该订单已经是非海外仓订单
ErrorCode ORDER_NOT_IS_OVERSEAS_WAREHOUSE_ORDER = new ErrorCode(1004001170, "order.not.is.overseas.warehouse.order");
ErrorCode ORDER_APPROVAL_IS_NOT_EXISTS = new ErrorCode(1004001171, "order.approval.is.not.exists");
ErrorCode FEE_APPLICATION_NOT_IS_ZERO = new ErrorCode(1004001172, "fee.application.not.is.zero");
}
......@@ -5,54 +5,64 @@ import lombok.AllArgsConstructor;
import lombok.Getter;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
@AllArgsConstructor
@Getter
public enum OrderApprovalTypeEnum {
DISCOUNT_APPLY(1, "优惠申请"),
ADMIN_DISCOUNT(2, "管理优惠"),
COMMISSION_SET(3, "佣金设置"),
WEIGHT_DISCOUNT(4, "重货优惠"),
BUBBLE_DISCOUNT(5, "泡货优惠"),
ORDER_SPLIT(6, "拆单"),
ORDER_CARGO_CONTROL_PICK_UPDATE(7, "控货订单放货修改"),
ORDER_CARGO_CONTROL_PICK_ANTI_CHECKING(8, "控货订单反复核"),
seasoning_condiments(9, "调货"),
order_cargo_control_cancel_pick(10, "取消放货"),
merge_order(11, "合单"),
expense_apply(12, "费用申请"),
WAREHOUSE_ADJUST(13, "调仓"),
ORDER_UPDATE(14, "订单修改"),
WAREHOUSE_UPDATE(22, "入仓修改"),
WAREHOUSE_ROLLBACK(23, "退仓"),
DISCOUNT_APPLY(1, "优惠申请", Arrays.asList(2, 6, 11, 14, 23, 28, 31, 32)),// 管理优惠(当前商品有在途申请)/拆单申请/合单申请/订单修改/退仓/撤销拆单审批/批量优惠申请(当前商品有在途申请)/批量管理折扣申请(当前商品有在途申请)
ADMIN_DISCOUNT(2, "管理优惠", Arrays.asList(1, 6, 11, 14, 23, 28, 31, 32)), // 拆单申请/合单申请/订单修改/退仓/撤销拆单审批/批量优惠申请(当前商品有在途申请)/批量管理折扣申请(当前商品有在途申请)/优惠申请(当前商品有在途申请)
COMMISSION_SET(3, "佣金设置", Arrays.asList(6, 11, 14, 23, 28)), // 拆单申请/合单申请/订单修改/退仓/撤销拆单审批
WEIGHT_DISCOUNT(4, "重货优惠", Arrays.asList(6, 11, 14, 22, 23, 28)), // 拆单申请/合单申请/订单修改/入仓修改/退仓/撤销拆单审批
BUBBLE_DISCOUNT(5, "泡货优惠", Arrays.asList(6, 11, 14, 22, 23, 28, 29)), // 拆单申请/合单申请/订单修改/入仓修改/退仓/撤销拆单审批/泡重特价优惠
ORDER_SPLIT(6, "拆单", Collections.singletonList(-1)), // 全部互斥,订单无任何在途审批才可以申请
ORDER_CARGO_CONTROL_PICK_UPDATE(7, "控货订单放货修改", null), // 无限制
ORDER_CARGO_CONTROL_PICK_ANTI_CHECKING(8, "控货订单反复核", null), // 无限制
seasoning_condiments(9, "调货", null), // 无限制
order_cargo_control_cancel_pick(10, "取消放货", null), // 无限制
merge_order(11, "合单", Collections.singletonList(-1)), // 全部互斥,订单无任何在途审批才可以申请
expense_apply(12, "费用申请", Arrays.asList(6, 11, 28)), // 拆单申请/合单申请/撤销拆单审批
WAREHOUSE_ADJUST(13, "调仓", Arrays.asList(6, 11, 14, 22, 23, 28)), // 拆单申请/合单申请/订单修改/入仓修改/退仓/撤销拆单审批
ORDER_UPDATE(14, "订单修改", Arrays.asList(1, 2, 3, 4, 5, 6, 11, 23, 28, 31, 32)), // 拆单申请/合单申请/优惠申请/管理优惠/重货优惠/泡货优惠/退仓/佣金设置
pre_install(18, "预装审核", Arrays.asList(6, 11, 13, 14, 22, 23, 28)), // 自编号全部申请互斥,跟原本一致,不修改,自编号下订单除拆单申请/合单申请/调仓申请/订单修改/入仓申请/退仓申请外,其他申请不受限制,允许订单预装
closure(19, "封柜审核", null), // 自编号全部申请互斥,跟原本一致,不修改
unloading_cabinet(20, "卸柜审核", null), // 自编号全部申请互斥,跟原本一致,不修改
WAREHOUSE_UPDATE(22, "入仓修改", Arrays.asList(6, 11, 23, 28)), // 拆单申请/合单申请/退仓
WAREHOUSE_ROLLBACK(23, "退仓", Collections.singletonList(-1)), // 全部互斥,订单无任何在途审批才可以申请
pre_install_back(24, "预装反审"),
closure_back(25, "封柜反审"),
unloading_cabinet_back(26, "卸柜反审"),
customs_exit(27, "报关审批"),
ORDER_SPLIT_REVOKE(28, "撤销订单拆单"),
BUBBLE_WEIGHT_SPECIAL_DISCOUNT(29, "泡重特价优惠"),
DISCOUNT_APPLY_BATCH(31, "批量优惠申请"),
ADMIN_DISCOUNT_BATCH(32, "批量管理折扣申请"),
pre_install_back(24, "预装反审", null), // 自编号全部申请互斥,跟原本一致,不修改, 自编号下订单任何申请不受限制
closure_back(25, "封柜反审", null), // 自编号全部申请互斥,跟原本一致,不修改, 自编号下订单任何申请不受限制
unloading_cabinet_back(26, "卸柜反审", null), // 自编号全部申请互斥,跟原本一致,不修改, 自编号下订单任何申请不受限制
customs_exit(27, "报关审批", null), // 自编号全部申请互斥,跟原本一致,不修改, 自编号下订单任何申请不受限制
ORDER_SPLIT_REVOKE(28, "撤销订单拆单", Collections.singletonList(-1)), // 全部互斥,订单无任何在途审批才可以申请
BUBBLE_WEIGHT_SPECIAL_DISCOUNT(29, "泡重特价优惠", Arrays.asList(5, 6, 11, 14, 22, 23, 28)), // 拆单申请/合单申请/订单修改/入仓修改/退仓/撤销拆单审批/泡货优惠
DISCOUNT_APPLY_BATCH(31, "批量优惠申请", Arrays.asList(1, 2, 6, 11, 14, 23, 28, 32)), // 拆单申请/合单申请/订单修改/退仓/撤销拆单审批/优惠申请(当前商品有在途申请)/批量管理折扣申请(当前商品有在途申请)/管理优惠(当前商品有在途申请)
ADMIN_DISCOUNT_BATCH(32, "批量管理折扣申请", Arrays.asList(1, 2, 6, 11, 14, 23, 28, 31)), // 拆单申请/合单申请/订单修改/退仓/撤销拆单审批/优惠申请(当前商品有在途申请)/批量优惠申请(当前商品有在途申请)/管理优惠(当前商品有在途申请)
//分拣
sorting(50, "分拣审批"),
sorting(50, "分拣审批", Arrays.asList(6, 11, 13, 14, 22, 23, 28)), // 自编号全部申请互斥,跟原本一致,不修改, 自编号下订单除拆单申请/合单申请/调仓申请/订单修改/入仓申请/退仓申请外,其他申请不受限制,允许封柜反审批
//分拣反审
sorting_back(51,"分拣反审"),
sorting_back(51, "分拣反审", null), // 自编号全部申请互斥,跟原本一致,不修改,自编号下订单任何申请不受限制
//到仓
warehoused(52, "到仓审批"),
warehoused(52, "到仓审批", null), // 自编号全部申请互斥,跟原本一致,不修改,自编号下订单任何申请不受限制
//到仓反审
warehoused_back(53, "到仓反审"),
warehoused_back(53, "到仓反审", null), // 自编号全部申请互斥,跟原本一致,不修改,自编号下订单任何申请不受限制
// 出货
shipment(54, "出货审批", null), // 自编号全部申请互斥,跟原本一致,不修改,自编号下订单任何申请不受限制
// 出货反审
shipment_back(55, "出货反审", null), // 自编号全部申请互斥,跟原本一致,不修改,自编号下订单任何申请不受限制
// 撤销清关
clearance_back(56, "撤销清关", null), // 自编号全部申请互斥,跟原本一致,不修改,自编号下订单任何申请不受限制
//收货人限制修改
CONSIGNEE_LIMIT_UPDATE(61, "收货人限制修改"),
CONSIGNEE_LIMIT_UPDATE(61, "收货人限制修改", Arrays.asList(6, 11, 14, 23, 28)), // 拆单申请/合单申请/订单修改/退仓/撤销拆单审批
//海外仓修改
OVERSEAS_WAREHOUSE_UPDATE(62, "海外仓修改"),
OVERSEAS_WAREHOUSE_UPDATE(62, "海外仓修改", Arrays.asList(6, 11, 14, 23, 28)), // 拆单申请/合单申请/订单修改/退仓/撤销拆单审批
;
......@@ -65,6 +75,10 @@ public enum OrderApprovalTypeEnum {
* 类型名
*/
private final String name;
/**
* 互斥审批类型
*/
private final List<Integer> mutualExclusionValues;
public static OrderApprovalTypeEnum valueOf(Integer value) {
return ArrayUtil.firstMatch(orderApprovalType -> orderApprovalType.getValue().equals(value), OrderApprovalTypeEnum.values());
......
......@@ -15,6 +15,7 @@ public enum OrderNumberEnum {
RECEIPT_NO(3, "收款单号"),
PAYMENT_NO(3, "付款单号"),
COMMISSION_PAYMENT_NO(5, "佣金付款单号"),
FOLLOWUP_NO(6, "跟进单号"),
;
/**
* 类型
......
package cn.iocoder.yudao.module.order.listener;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum;
import cn.iocoder.yudao.module.order.service.approval.OrderApprovalService;
import cn.iocoder.yudao.module.order.service.orderWarehouseApproval.OrderWarehouseApprovalService;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
/**
* 校验审批类型是否互斥
*
* @author zhengYi
*/
@Component("OrderApprovalTypeCheckListener")
@AllArgsConstructor
@Slf4j
public class OrderApprovalTypeCheckListener {
private final OrderApprovalService orderApprovalService;
private final OrderWarehouseApprovalService orderWarehouseApprovalService;
@EventListener(OrderApprovalTypeCheckEvent.class)
public void orderApprovalTypeCheckEvent(OrderApprovalTypeCheckEvent event) {
// 枚举配置中的互斥类型集合不能添加新值,这里需要重新定义新集合补充当前审批类型进行查询
List<Integer> typeList = null;
if (Objects.nonNull(event.getApprovalType())) {
OrderApprovalTypeEnum approvalTypeEnum = OrderApprovalTypeEnum.valueOf(event.getApprovalType());
if (Objects.isNull(approvalTypeEnum)) {
// 没有配置相关审批类型则不做校验
event.setResult(Boolean.FALSE);
return;
}
List<Integer> types = approvalTypeEnum.getMutualExclusionValues();
if (Objects.isNull(types)) {
// 没有配置相关审批类型则不做校验
event.setResult(Boolean.FALSE);
return;
}
// 包含-1则表示订单不能有任何审批状态存在,所以不用区分类型,查询所有的进行中审批
if (!types.contains(-1)) {
typeList = new ArrayList<>(types);
typeList.add(event.getApprovalType());
}
}else {
typeList = new ArrayList<>(event.getApprovalTypeList());
}
// 查询当前订单正在进行的审批
boolean result = orderApprovalService.countProcessingApproval(event.getOrderId(), event.getOrderItemIdList(), typeList);
// 入仓相关正在进行的审批业务查询
if (!result){
List<Integer> warehouseApprovalTypeList = null;
if (Objects.nonNull(typeList)){
// 1 入仓修改 2 调仓 3 退仓
warehouseApprovalTypeList = new ArrayList<>();
if (typeList.contains(OrderApprovalTypeEnum.WAREHOUSE_UPDATE.getValue())){
warehouseApprovalTypeList.add(1);
}
if (typeList.contains(OrderApprovalTypeEnum.WAREHOUSE_ADJUST.getValue())){
warehouseApprovalTypeList.add(2);
}
if (typeList.contains(OrderApprovalTypeEnum.WAREHOUSE_ROLLBACK.getValue())){
warehouseApprovalTypeList.add(3);
}
if (warehouseApprovalTypeList.size() == 0){
event.setResult(result);
return;
}
}
result = orderWarehouseApprovalService.countProcessingApproval(event.getOrderId(), event.getOrderItemIdList(), warehouseApprovalTypeList);
}
// TODO 当订单互斥所有审批类型时,是否也要对自编号的审批状态进行校验
event.setResult(result);
}
}
......@@ -113,6 +113,15 @@ public interface OrderApprovalService extends IService<OrderApprovalDO> {
OrderApprovalDO getLast(Long orderId, OrderApprovalTypeEnum orderApprovalTypeEnum);
/**
* 获取正在处理中的批量审批(批量优惠/批量特价)
* @param orderId 订单id
* @param orderItemIdList 订单项id列表
* @param approvalTypes 类型
* @return
*/
boolean countProcessingApproval(Long orderId, List<Long> orderItemIdList, List<Integer> approvalTypes);
/**
* 获取正在处理中的批量审批(批量优惠/批量特价)
* @param orderId
......
......@@ -176,6 +176,12 @@ public class OrderApprovalServiceImpl extends AbstractService<OrderApprovalMappe
.eq(OrderApprovalDO::getType, orderApprovalTypeEnum.getValue()).orderByDesc(OrderApprovalDO::getOrderApprovalId).last("limit 1"));
}
@Override
public boolean countProcessingApproval(Long orderId, List<Long> orderItemIdList, List<Integer> types) {
long count = approvalMapper.countProcessingApproval(orderId, orderItemIdList, types);
return count > 0;
}
@Override
public OrderApprovalDO getProcessingItemBatchApproval(Long orderId, Long orderItemId) {
......
......@@ -6,18 +6,22 @@ import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderException.OrderExceptionDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseCheck.OrderWarehouseCheckDO;
import cn.iocoder.yudao.module.order.dto.OrderRemindExceptionDto;
import cn.iocoder.yudao.module.order.enums.OrderAirTimeEnum;
import cn.iocoder.yudao.module.order.enums.OrderSeaTimeEnum;
import cn.iocoder.yudao.module.order.param.OrderChangePriceParam;
import cn.iocoder.yudao.module.order.param.OrderControlLogParam;
import cn.iocoder.yudao.module.order.vo.order.*;
import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemCheckWarehouseVO;
import cn.iocoder.yudao.module.order.vo.orderWarehouseCheck.CheckItemSumVO;
import cn.iocoder.yudao.module.product.dal.dataobject.product.ProductPriceDO;
import java.math.BigDecimal;
import java.util.Collection;
import java.util.Date;
import java.util.List;
import java.util.Map;
/**
* 订单 Service 接口
......@@ -398,4 +402,21 @@ public interface OrderBusinessService extends IService<OrderDO> {
void updateItem(OrderItemDO orderItemDO);
/**
* 订单到仓更新
*
* @param orderId 订单ID
* @param orderItemCheckWarehouseVOMap 到仓商品项
*/
void orderToWarehouse(Long orderId, Map<Long, OrderItemCheckWarehouseVO> orderItemCheckWarehouseVOMap);
/**
* 撤销到仓
*
* @param orderId 订单id
*/
void revokeToWarehouse(Long orderId);
}
......@@ -50,6 +50,7 @@ import cn.iocoder.yudao.module.order.dal.dataobject.order.OrderDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigneeDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignor.OrderConsignorDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderDeparture.OrderDepartureDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderException.OrderExceptionDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderTime.OrderTimeDO;
......@@ -64,8 +65,10 @@ import cn.iocoder.yudao.module.order.dal.mysql.orderWarehouseIn.OrderWarehouseIn
import cn.iocoder.yudao.module.order.dto.*;
import cn.iocoder.yudao.module.order.enums.CustomDraweeEnum;
import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum;
import cn.iocoder.yudao.module.order.enums.OrderExceptionEnum;
import cn.iocoder.yudao.module.order.enums.TransportTypeShortEnum;
import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.orderException.OrderExceptionService;
import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInService;
import cn.iocoder.yudao.module.order.service.orderWarehousePicture.OrderWarehousePictureService;
import cn.iocoder.yudao.module.order.vo.approval.OrderApprovalHeadBaseVO;
......@@ -74,6 +77,7 @@ import cn.iocoder.yudao.module.order.vo.approval.OrderSpecialBatchApplyOrderItem
import cn.iocoder.yudao.module.order.vo.approval.OrderSpecialBatchApplyVO;
import cn.iocoder.yudao.module.order.vo.order.*;
import cn.iocoder.yudao.module.order.vo.orderConsignee.OrderConsigneeBackVO;
import cn.iocoder.yudao.module.order.vo.orderException.ExceptionTypeResultVO;
import cn.iocoder.yudao.module.order.vo.orderException.OrderExceptionStatisticsExcelVo;
import cn.iocoder.yudao.module.order.vo.orderException.OrderFeeDetailBackVO;
import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemBackVO;
......@@ -164,6 +168,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
private final OrderWarehouseInService orderWarehouseInService;
private final CustomerContactsService customerContactsService;
private final OrderExceptionService orderExceptionService;
private UeProperties ueProperties;
......@@ -838,8 +843,7 @@ public class OrderQueryServiceImpl implements OrderQueryService {
item.setWarehouseRecordRemark(warehouseInDO.getWarehouseRecordRemark());
}
// 转换赋值出刷数值
// 转换赋值初始数值
item.setInitialChargeWeight(item.getChargeWeight());
item.setInitialChargeVolume(item.getChargeVolume());
item.setInitialChargeQuantity(item.getChargeQuantity());
......@@ -847,6 +851,30 @@ public class OrderQueryServiceImpl implements OrderQueryService {
item.setChargeWeight(new BigDecimal(item.getVWeight()));
item.setChargeVolume(new BigDecimal(item.getWVolume()));
item.setChargeQuantity(new BigDecimal(item.getQQuantity()));
// 订单项到仓异常登记信息
if (Objects.nonNull(item.getWarehouseCheckInfoVO())) {
List<String> exceptionKeys = Arrays.asList(OrderExceptionEnum.ORDER_MISS_EXCEPTION.getKey(),
OrderExceptionEnum.ORDER_SUPERFLUOUS_GOODS_EXCEPTION.getKey(),
OrderExceptionEnum.ORDER_DAMAGE_EXCEPTION.getKey(),
OrderExceptionEnum.ORDER_IN_WATER_EXCEPTION.getKey(),
OrderExceptionEnum.ORDER_ABNORMAL_WEIGHT_EXCEPTION.getKey());
List<OrderExceptionDO> orderExceptionDOList = orderExceptionService.list(new LambdaQueryWrapper<OrderExceptionDO>()
.eq(OrderExceptionDO::getOrderItemId, item.getOrderItemId())
.in(OrderExceptionDO::getOrderExceptionType, exceptionKeys));
if (CollectionUtil.isNotEmpty(orderExceptionDOList)) {
List<ExceptionTypeResultVO> itemExceptionList = new ArrayList<>();
for (OrderExceptionDO orderExceptionDO : orderExceptionDOList) {
OrderExceptionEnum exceptionEnum = OrderExceptionEnum.getEnumByKey(orderExceptionDO.getOrderExceptionType());
// 异常状态0:待处理,1处理中,2已处理
String result = orderExceptionDO.getOrderExceptionStatus() == 0 ? "待处理" : (orderExceptionDO.getOrderExceptionStatus() == 1 ? "1处理中" : "已处理");
ExceptionTypeResultVO typeResultVO = new ExceptionTypeResultVO();
typeResultVO.setExceptionType(I18nMessage.getLang() == 0 ? exceptionEnum.getZhValueDesc() : exceptionEnum.getEnValueDesc());
typeResultVO.setResult(result);
itemExceptionList.add(typeResultVO);
}
item.setItemExceptionList(itemExceptionList);
}
}
//订单项入仓影像
List<OrderWarehousePictureDO> warehousePictureList =
orderWarehousePictureService.getWarehousePictureList(5, item.getOrderItemId());
......@@ -854,6 +882,13 @@ public class OrderQueryServiceImpl implements OrderQueryService {
List<String> pictureUrls = warehousePictureList.stream().map(OrderWarehousePictureDO::getUrl).collect(Collectors.toList());
item.setPictureUrls(pictureUrls);
}
//订单项到仓影像
List<OrderWarehousePictureDO> warehouseCheckPictureList =
orderWarehousePictureService.getWarehousePictureList(7, item.getOrderItemId());
if (CollectionUtil.isNotEmpty(warehouseCheckPictureList)) {
List<String> checkPictureUrls = warehouseCheckPictureList.stream().map(OrderWarehousePictureDO::getUrl).collect(Collectors.toList());
item.setCheckPictureUrls(checkPictureUrls);
}
if ((Objects.nonNull(item.getChannelManualPricing()) && item.getChannelManualPricing())
|| (Objects.nonNull(item.getSpecialPriceType()) && item.getSpecialPriceType())
|| (Objects.nonNull(item.getSplitCustomPriceType()) && item.getSplitCustomPriceType())) {
......
......@@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderSchedulingEvent;
import cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrdersSchedulingEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.code.CodeUtils;
......@@ -54,6 +55,7 @@ import cn.iocoder.yudao.module.order.service.orderWarehouseIn.OrderWarehouseInSe
import cn.iocoder.yudao.module.order.service.orderWarehousePicture.OrderWarehousePictureService;
import cn.iocoder.yudao.module.order.service.targetLog.TargetLogService;
import cn.iocoder.yudao.module.order.vo.approval.OrderApprovalCancelApplyReqVO;
import cn.iocoder.yudao.module.order.vo.approval.OrderSpecialBatchApplyOrderItemDetailVO;
import cn.iocoder.yudao.module.order.vo.order.ApplyInfoVO;
import cn.iocoder.yudao.module.order.vo.order.CostVO;
import cn.iocoder.yudao.module.order.vo.order.OrderBackVO;
......@@ -87,6 +89,7 @@ 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.*;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.ORDER_SPLIT;
import static cn.iocoder.yudao.module.order.enums.TargetLogEnum.SPLIT;
/**
......@@ -192,7 +195,9 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
if (orderDO.getTransportId() == 4 && OrderStatusEnum.IN_WAREHOUSE.getValue().equals(orderDO.getStatus()) && orderDO.getAirShipment() > 2) {
throw exception(AIR_ORDER_IS_READY_STOCK_NOT_SPLIT);
}
if (orderDO.getAuditType() != 0) {
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, ORDER_SPLIT.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
if (Objects.equals(orderDO.getStatus(), OrderStatusEnum.SPLIT_ORDER.getValue())) {
......@@ -475,7 +480,7 @@ public class OrderSplitServiceImpl extends AbstractService<OrderSplitMapper, Ord
throw exception(ORDER_NOT_EXISTS);
}
// TODO 需要调整异常说明为 -> 订单正在进行拆单审批,无法重置拆单
if (Objects.equals(orderDO.getAuditType(), OrderApprovalTypeEnum.ORDER_SPLIT.getValue())) {
if (Objects.equals(orderDO.getAuditType(), ORDER_SPLIT.getValue())) {
throw exception(ORDER_HAS_PROCESSING_APPROVAL, orderDO.getOrderNo());
}
// if (Objects.equals(orderDO.getStatus(), OrderStatusEnum.SPLIT_ORDER.getValue())) {
......
......@@ -3,6 +3,7 @@ package cn.iocoder.yudao.module.order.service.orderWarehouseAdjust;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderDestWarehouseEvent;
import cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderSchedulingEvent;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.dict.core.dto.DictDataRespDTO;
......@@ -49,6 +50,8 @@ 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.*;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.ORDER_SPLIT;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.WAREHOUSE_ADJUST;
/**
* 调仓记录 Service 实现类
......@@ -139,7 +142,9 @@ public class OrderWarehouseAdjustServiceImpl extends AbstractService<OrderWareho
}
orderQueryService.throwPendingExceptionOrProcessingApproval(orderId);
if (orderDO.getAuditType() != 0){
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, WAREHOUSE_ADJUST.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
orderStatusSet.add(orderDO.getStatus());
......
......@@ -167,6 +167,5 @@ public interface OrderWarehouseApprovalService extends IService<OrderWarehouseAp
OrderWarehouseApprovalBackVO getLastUpdateApprovalInfo(Long orderId, Long orderItemId);
boolean countProcessingApproval(Long orderId, List<Long> orderItemIdList, List<Integer> typeList);
}
......@@ -289,4 +289,10 @@ public class OrderWarehouseApprovalServiceImpl extends AbstractService<OrderWare
OrderWarehouseApprovalBackVO convert = OrderWarehouseApprovalConvert.INSTANCE.convert(orderWarehouseApprovalDO);
return convert;
}
@Override
public boolean countProcessingApproval(Long orderId, List<Long> orderItemIdList, List<Integer> typeList) {
long count = orderWarehouseApprovalMapper.countProcessingApproval(orderId, orderItemIdList, typeList);
return count > 0;
}
}
package cn.iocoder.yudao.module.order.service.orderWarehouseCheck;
import cn.iocoder.yudao.framework.mybatis.core.service.IService;
import cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseCheck.OrderWarehouseCheckDO;
import cn.iocoder.yudao.module.order.vo.orderWarehouseCheck.OrderWarehouseCheckUpdateItemVO;
import cn.iocoder.yudao.module.order.vo.orderWarehouseCheck.OrderWarehouseCheckUpdateReqVO;
import java.util.List;
/**
* 到仓货物详情 Service 接口
*/
public interface OrderWarehouseCheckService extends IService<OrderWarehouseCheckDO> {
/**
* 到仓查询. 当前订单到仓信息详情列表
*
* @param orderId 订单编号
* @return 到仓详情列表
*/
List<OrderWarehouseCheckDO> list(long orderId);
List<OrderWarehouseCheckDO> listByOrderItemId(long orderItemId);
/**
* 订单到仓. 复制入仓信息,到仓订单修改已在缷柜逻辑中
*
* @param orderId 订单编号
*/
void check(long orderId);
/**
* 强制到仓. 箱数=入仓箱数
*
* @param orderId 订单编号
*/
void force(long orderId);
/**
* 撤销到仓. 修改订单状态为已清关,清空到仓时间箱数以及详情
*
* @param orderId 订单编号
*/
void revoke(long orderId);
/**
* 到仓修改. 允许修改到仓后的体积与重量,箱数默认为到仓箱数
*
* @param orderId 订单编号
* @param updates 更新详情
*/
void update(OrderWarehouseCheckUpdateReqVO checkUpdateReqVO);
}
......@@ -6,6 +6,7 @@ import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.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.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -132,6 +133,8 @@ import java.util.stream.Collectors;
import static cn.iocoder.yudao.framework.apollo.core.constants.Constants.NOT_ACCEPTED_PROD_CODE;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.*;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.WAREHOUSE_ADJUST;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.WAREHOUSE_UPDATE;
import static cn.iocoder.yudao.module.wealth.enums.ErrorCodeConstants.RECEIVABLE_WRITE_OFF_ING_NO_NEED_TO_PACK;
/**
......@@ -2766,6 +2769,11 @@ public class OrderWarehouseInServiceImpl extends AbstractService<OrderWarehouseI
}
}
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderId, null, WAREHOUSE_UPDATE.getValue(), null, false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
//如仓记录项
List<OrderWarehouseInItemDto> orderWarehouseInUpdateItemDoList =
updateReqVO.getOrderWarehouseInUpdateItemDoList();
......
......@@ -545,6 +545,17 @@ public class OrderBackPageVO {
private String customerServiceName;
// -----------end -----------
@ApiModelProperty(value = "到仓件数")
private Integer checkNum;
@ApiModelProperty(value = "到仓数量")
private Integer checkQuantity;
@ApiModelProperty(value = "到仓体积")
private BigDecimal checkVolume;
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
public void setGuanLianOrderStatus(String guanLianOrderStatus) {
......
......@@ -647,6 +647,17 @@ public class OrderBackVO {
@ApiModelProperty(value = "放货箱数")
private Integer releaseNum;
@ApiModelProperty(value = "到仓件数")
private Integer checkNum;
@ApiModelProperty(value = "到仓数量")
private Integer checkQuantity;
@ApiModelProperty(value = "到仓体积")
private BigDecimal checkVolume;
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
public void setExternalWarehouseJson(String externalWarehouseJson) {
this.externalWarehouseJson = externalWarehouseJson;
......
......@@ -389,6 +389,19 @@ public class OrderBaseVO {
@ApiModelProperty(value = "是否有收货人,1-是,0-否")
private Boolean hasConsignee = true;
@ApiModelProperty(value = "到仓件数")
private Integer checkNum;
@ApiModelProperty(value = "到仓数量")
private Integer checkQuantity;
@ApiModelProperty(value = "到仓体积")
private BigDecimal checkVolume;
@ApiModelProperty(value = "到仓重量")
private BigDecimal checkWeight;
public void setExceptionReason(String exceptionReason) {
this.exceptionReason = StringUtils.isNotBlank(exceptionReason) ? I18nMessage.getMessage(exceptionReason) : exceptionReason;
}
......
......@@ -141,6 +141,7 @@ public class OrderExcelVO {
@ApiModelProperty(value = "入仓信息json")
private String warehouseInInfo;
@ExcelIgnore
@ApiModelProperty(value = "是否控货")
private Boolean isCargoControl;
......@@ -287,6 +288,43 @@ public class OrderExcelVO {
@ApiModelProperty(value = "是否在公海")
private Boolean isInOpenSea;
@ExcelIgnore
@ApiModelProperty(value = "到仓材质")
private String checkMaterial;
@ExcelIgnore
@ApiModelProperty(value = "到仓商品特性(可选多个特性ID)")
private String warehouseCheckProdAttrIds;
@ExcelIgnore
@ApiModelProperty(value = "到仓品牌")
private Long checkBrand;
@ExcelIgnore
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType;
/**
* 到仓信息json
*/
@ExcelIgnore
@ApiModelProperty(value = "到仓信息json")
private String warehouseCheckInfo;
/**
* 到仓信息json
*/
@ExcelIgnore
@ApiModelProperty(value = "到仓信息VO")
private WarehouseCheckInfoVO warehouseCheckInfoVO;
public void setWarehouseCheckInfo(String warehouseCheckInfo) {
this.warehouseCheckInfo = warehouseCheckInfo;
if (StringUtils.isNotBlank(warehouseCheckInfo)) {
this.warehouseCheckInfoVO = JSONObject.parseObject(warehouseCheckInfo, WarehouseCheckInfoVO.class);
}
}
public void setWarehouseInInfo(String warehouseInInfo) {
this.warehouseInInfo = warehouseInInfo;
if (StringUtils.isNotBlank(warehouseInInfo)) {
......@@ -295,6 +333,9 @@ public class OrderExcelVO {
}
public void setLang(Integer lang) {
this.lang = lang;
this.getOrderDesc();
......
package cn.iocoder.yudao.module.order.vo.order;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 入仓纪录明细VO
*
* @author yanghao
*/
@Data
@ApiModel(value = "入仓纪录明细VO")
public class OrderWarehouseCheckDetailsVO {
@ApiModelProperty(value = "商品ID")
private Long prodId;
@ApiModelProperty(value = "品牌ID")
private Long brand;
/**
* 商品特性(可选多个特性ID)
*/
private String prodAttrIds;
@ApiModelProperty("用途")
private String usageIds;
@ApiModelProperty(value = "箱/件数")
private Integer cartonsNum;
@ApiModelProperty(value = "所有箱内总货物数量")
private Integer quantityAll;
@ApiModelProperty(value = "单位")
private String unit;
/**
* 入仓规格类型 1箱/2整板 见字典 warehousing_specification_type
*/
@ApiModelProperty(value = "入仓规格类型")
private Integer specificationType;
/**
* 箱规
*/
@ApiModelProperty(value = "箱规")
private String boxGauge;
@ApiModelProperty(value = "体积")
private BigDecimal volume;
@ApiModelProperty(value = "重量")
private BigDecimal weight;
@ApiModelProperty(value = "快递单号")
private String expressNo;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
@ApiModelProperty(value = "材质")
private String material;
}
package cn.iocoder.yudao.module.order.vo.order;
import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemCheckWarehouseVO;
import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemInWarehouseVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 入仓订单详情 Response VO
* @author yanghao
*/
@Data
@ApiModel(value = "入仓订单详情")
public class OrderWarehouseCheckVO {
@ApiModelProperty(value = "主键ID")
private Long orderId;
@ApiModelProperty(value = "订单编号")
private String orderNo;
@ApiModelProperty(value = "到仓订单项列表")
private List<OrderItemCheckWarehouseVO> orderItemCheckWarehouseVOList;
@ApiModelProperty(value = "箱/件数", required = true)
private Integer cartonsNum;
@ApiModelProperty(value = "类型,多了还是少了,见字典warehouse_in_status", required = true)
private Integer diffType;
@ApiModelProperty(value = "箱/件数差", required = true)
private Integer cartonsNumDiff;
@ApiModelProperty(value = "所有箱内总货物数量")
private Integer quantityAll;
@ApiModelProperty(value = "单位", required = true)
private String unit;
@ApiModelProperty(value = "体积")
private BigDecimal volume;
@ApiModelProperty(value = "重量")
private BigDecimal weight;
@ApiModelProperty(value = "快递单号")
private String expressNo;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "入仓时间")
private Date firstInTime;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
/**
* 重货方数
*/
@ApiModelProperty(value = "入仓货物-重货方数")
private BigDecimal heavyNumber;
/**
* 泡货方数
*/
@ApiModelProperty(value = "入仓货物-泡货方数")
private BigDecimal lightNumber;
}
package cn.iocoder.yudao.module.order.vo.order;
import cn.iocoder.yudao.module.order.vo.orderLocation.OrderLocationBackVO;
import cn.iocoder.yudao.module.order.vo.orderLocation.OrderLocationMergeVO;
import com.alibaba.excel.annotation.ExcelProperty;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
/**
* 到仓货物详情 Response VO
* @author yanghao
*/
@Data
public class WarehouseCheckInfoVO {
@ApiModelProperty(value = "是否多规格")
private Boolean isMultiSpecification;
@ExcelProperty("箱/件数")
@ApiModelProperty(value = "箱/件数", required = true)
private Integer cartonsNum;
@ExcelProperty("所有箱内总货物数量")
@ApiModelProperty(value = "所有箱内总货物数量")
private Integer quantity;
@ExcelProperty("单位")
@ApiModelProperty(value = "单位", required = true)
private String unit;
@ApiModelProperty(value = "规格类型")
private Integer specificationType;
@ApiModelProperty(value = "单位-拼接所有")
private String units;
/**
* 箱规
*/
@ExcelProperty("箱规")
@ApiModelProperty(value = "箱规")
private String boxGauge;
@ExcelProperty("体积")
@ApiModelProperty(value = "体积")
private BigDecimal volume;
@ExcelProperty("重量")
@ApiModelProperty(value = "重量")
private BigDecimal weight;
@ExcelProperty("快递单号")
@ApiModelProperty(value = "快递单号")
private String expressNo;
@ExcelProperty("备注")
@ApiModelProperty(value = "备注")
private String remark;
@ExcelProperty("到仓时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "到仓时间")
private Date checkTime;
@ExcelProperty("创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "创建时间", required = true)
private Date createTime;
@ApiModelProperty(value = "到仓储位详细列表")
private List<OrderLocationBackVO> orderLocationBackVOList;
@ApiModelProperty(value = "到仓储位合并后的显示列表")
private List<OrderLocationMergeVO> orderLocationMergeVOSet;
@ApiModelProperty(value = "混箱状态, 1-混箱")
private Integer mixStatus = 0;
@ApiModelProperty(value = "到仓影像列表")
private List<String> pictureUrls;
}
package cn.iocoder.yudao.module.order.vo.orderException;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel("异常类型结果值")
public class ExceptionTypeResultVO {
@ApiModelProperty("异常类型")
private String exceptionType;
@ApiModelProperty("异常处理结果状态")
private String result;
}
package cn.iocoder.yudao.module.order.vo.orderItem;
import cn.iocoder.yudao.module.order.vo.order.WarehouseCheckInfoVO;
import cn.iocoder.yudao.module.order.vo.order.WarehouseInInfoVO;
import cn.iocoder.yudao.module.order.vo.orderException.ExceptionTypeResultVO;
import cn.iocoder.yudao.module.product.vo.coupon.CouponInfoVO;
import com.alibaba.excel.annotation.ExcelIgnore;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
......@@ -437,6 +440,53 @@ public class OrderItemBackVO {
@ApiModelProperty(value = "入仓记录备注,多个用逗号分隔")
private String warehouseRecordRemark ;
@ApiModelProperty(value = "到仓材质")
private String checkMaterial;
@ApiModelProperty(value = "到仓商品特性(可选多个特性ID)")
private String warehouseCheckProdAttrIds;
@ApiModelProperty(value = "到仓品牌")
private Long checkBrand;
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息json")
private String warehouseCheckInfo;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息VO")
private WarehouseCheckInfoVO warehouseCheckInfoVO;
@ExcelProperty("到仓品牌名称")
@ApiModelProperty(value = "到仓品牌名称")
private String checkBrandName;
@ApiModelProperty(value = "订单项到仓影像列表")
private List<String> checkPictureUrls;
@ApiModelProperty(value = "订单项到仓异常登记列表")
private List<ExceptionTypeResultVO> itemExceptionList;
public void setWarehouseCheckInfo(String warehouseCheckInfo) {
this.warehouseCheckInfo = warehouseCheckInfo;
if (StringUtils.isNotBlank(warehouseCheckInfo)) {
this.warehouseCheckInfoVO = JSONObject.parseObject(warehouseCheckInfo, WarehouseCheckInfoVO.class);
}
}
public void setWarehouseCheckInfoVO(WarehouseCheckInfoVO warehouseCheckInfoVO) {
this.warehouseCheckInfoVO = warehouseCheckInfoVO;
if (Objects.nonNull(warehouseCheckInfoVO)) {
this.warehouseCheckInfo = JSONObject.toJSONString(warehouseCheckInfoVO);
}
}
public void setCouponInfo(String couponInfo) {
this.couponInfo = couponInfo;
......
package cn.iocoder.yudao.module.order.vo.orderItem;
import cn.iocoder.yudao.module.order.vo.order.WarehouseCheckInfoVO;
import cn.iocoder.yudao.module.order.vo.order.WarehouseInInfoVO;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONObject;
......@@ -9,6 +10,8 @@ import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import javax.validation.constraints.*;
/**
......@@ -290,6 +293,43 @@ public class OrderItemBaseVO {
@ApiModelProperty(value = "是否处理了渠道特性异常")
private Boolean handlerChannelAttrException;
@ApiModelProperty(value = "到仓材质")
private String checkMaterial;
@ApiModelProperty(value = "到仓商品特性(可选多个特性ID)")
private String warehouseCheckProdAttrIds;
@ApiModelProperty(value = "到仓品牌")
private Long checkBrand;
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息json")
private String warehouseCheckInfo;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息VO")
private WarehouseCheckInfoVO warehouseCheckInfoVO;
public void setWarehouseCheckInfo(String warehouseCheckInfo) {
this.warehouseCheckInfo = warehouseCheckInfo;
if (StringUtils.isNotBlank(warehouseCheckInfo)) {
this.warehouseCheckInfoVO = JSONObject.parseObject(warehouseCheckInfo, WarehouseCheckInfoVO.class);
}
}
public void setWarehouseCheckInfoVO(WarehouseCheckInfoVO warehouseCheckInfoVO) {
this.warehouseCheckInfoVO = warehouseCheckInfoVO;
if (Objects.nonNull(warehouseCheckInfoVO)) {
this.warehouseCheckInfo = JSONObject.toJSONString(warehouseCheckInfoVO);
}
}
public void setWarehouseInInfo(String warehouseInInfo) {
this.warehouseInInfo = warehouseInInfo;
this.warehouseInInfoVO = JSONObject.parseObject(warehouseInInfo, WarehouseInInfoVO.class);
......
package cn.iocoder.yudao.module.order.vo.orderItem;
import cn.iocoder.yudao.module.order.vo.order.WarehouseCheckInfoVO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@Data
@ApiModel(value = "到仓订单项信息")
public class OrderItemCheckWarehouseVO {
@ApiModelProperty(value = "主键ID", required = true)
private Long orderItemId;
@ApiModelProperty(value = "订单ID", required = true)
private Long orderId;
@ApiModelProperty(value = "商品ID", required = true)
private Long prodId;
@ApiModelProperty(value = "产品类型")
private Integer prodType;
@ApiModelProperty(value = "产品中文标题")
private String prodTitleZh;
@ApiModelProperty(value = "产品英文标题")
private String prodTitleEn;
@ApiModelProperty(value = "到仓品牌ID", required = true)
private Long checkBrand;
@ApiModelProperty(value = "0 无牌 1 有牌 2 中性", required = true)
private Integer checkBrandType;
@ApiModelProperty(value = "商品特性(可选多个特性ID)")
private String checkProdAttrIds;
@ApiModelProperty(value = "入仓规格类型")
private Integer specificationType;
@ApiModelProperty(value = "材质")
private String checkMaterial;
@ApiModelProperty(value = "到仓数据")
private WarehouseCheckInfoVO warehouseCheckInfoVO;
}
package cn.iocoder.yudao.module.order.vo.orderItem;
import cn.iocoder.yudao.module.order.vo.order.WarehouseCheckInfoVO;
import cn.iocoder.yudao.module.order.vo.order.WarehouseInInfoVO;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.*;
import java.math.BigDecimal;
import java.util.*;
import io.swagger.annotations.*;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
......@@ -211,4 +214,28 @@ public class OrderItemQueryVO {
@ApiModelProperty(value = "是否处理了渠道特性异常")
private Boolean handlerChannelAttrException;
@ApiModelProperty(value = "到仓材质")
private String checkMaterial;
@ApiModelProperty(value = "到仓商品特性(可选多个特性ID)")
private String warehouseCheckProdAttrIds;
@ApiModelProperty(value = "到仓品牌")
private Long checkBrand;
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息json")
private String warehouseCheckInfo;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息VO")
private WarehouseCheckInfoVO warehouseCheckInfoVO;
}
package cn.iocoder.yudao.module.order.vo.orderItem;
import cn.iocoder.yudao.module.order.vo.order.WarehouseCheckInfoVO;
import cn.iocoder.yudao.module.order.vo.order.WarehouseInInfoVO;
import com.alibaba.excel.annotation.ExcelProperty;
import com.alibaba.fastjson.JSONObject;
......@@ -7,6 +8,7 @@ import com.baomidou.mybatisplus.annotation.TableField;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.apache.commons.lang3.StringUtils;
import org.springframework.format.annotation.DateTimeFormat;
import java.math.BigDecimal;
......@@ -287,6 +289,43 @@ public class OrderItemSpecialBackVO {
@ApiModelProperty(value = "是否处理了渠道特性异常")
private Boolean handlerChannelAttrException;
@ApiModelProperty(value = "到仓材质")
private String checkMaterial;
@ApiModelProperty(value = "到仓商品特性(可选多个特性ID)")
private String warehouseCheckProdAttrIds;
@ApiModelProperty(value = "到仓品牌")
private Long checkBrand;
@ApiModelProperty(value = "到仓:0 无牌 1 有牌 2 中性")
private Integer checkBrandType;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息json")
private String warehouseCheckInfo;
/**
* 到仓信息json
*/
@ApiModelProperty(value = "到仓信息VO")
private WarehouseCheckInfoVO warehouseCheckInfoVO;
public void setWarehouseCheckInfo(String warehouseCheckInfo) {
this.warehouseCheckInfo = warehouseCheckInfo;
if (StringUtils.isNotBlank(warehouseCheckInfo)) {
this.warehouseCheckInfoVO = JSONObject.parseObject(warehouseCheckInfo, WarehouseCheckInfoVO.class);
}
}
public void setWarehouseCheckInfoVO(WarehouseCheckInfoVO warehouseCheckInfoVO) {
this.warehouseCheckInfoVO = warehouseCheckInfoVO;
if (Objects.nonNull(warehouseCheckInfoVO)) {
this.warehouseCheckInfo = JSONObject.toJSONString(warehouseCheckInfoVO);
}
}
public void setWarehouseInInfo(String warehouseInInfo) {
this.warehouseInInfo = warehouseInInfo;
......
package cn.iocoder.yudao.module.order.vo.orderWarehouseCheck;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.math.BigDecimal;
@Data
public class CheckItemSumVO {
@ApiModelProperty("到仓箱数")
private int cartons = 0; // 到仓总箱数
@ApiModelProperty("到仓数量")
private int quantity = 0; // 到仓总数量
@ApiModelProperty("到仓体积")
private BigDecimal volume = BigDecimal.ZERO; // 到仓总体积
@ApiModelProperty("到仓重量")
private BigDecimal weight = BigDecimal.ZERO; // 到仓总重量
public void add(Integer checkNum, Integer checkQuantity, BigDecimal checkVolume, BigDecimal checkWeight) {
this.cartons += checkNum;
this.quantity += checkQuantity;
this.volume = this.volume.add(checkVolume);
this.weight = this.weight.add(checkWeight);
}
}
package cn.iocoder.yudao.module.order.vo.orderWarehouseCheck;
import cn.iocoder.yudao.module.order.vo.order.OrderWarehouseInDetailsVO;
import cn.iocoder.yudao.module.order.vo.orderLocation.OrderLocationCreateReqVO;
import cn.iocoder.yudao.module.order.vo.orderWarehouseIn.OrderWarehouseInItemDto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import org.hibernate.validator.constraints.Length;
import javax.validation.Valid;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
@ApiModel("管理后台 - 到仓货物详情更新 Item VO")
@Data
@EqualsAndHashCode
@ToString(callSuper = true)
public class OrderWarehouseCheckUpdateItemVO {
@ApiModelProperty(value = "入仓货物-id, 可为空")
private Long id;
@ApiModelProperty(value = "到仓详情总数", required = true)
@NotNull(message = "到仓详情总数不能为空")
private Integer quantityAll;
@ApiModelProperty(value = "到仓详情箱数", required = true)
@NotNull(message = "到仓详情箱数不能为空")
private Integer cartonsNum;
@ApiModelProperty(value = "入仓规格类型")
private Integer specificationType;
@ApiModelProperty(value = "入仓货物-包装类型", required = true)
@NotNull(message = "包装类型不能为空")
private String unit;
@ApiModelProperty(value = "入仓货物-箱规 长*宽*高")
private String boxGauge;
@ApiModelProperty(value = "到仓详情体积", required = true)
@NotNull(message = "到仓详情体积不能为空")
private BigDecimal volume;
@ApiModelProperty(value = "到仓详情重量", required = true)
@NotNull(message = "到仓详情重量不能为空")
private BigDecimal weight;
@ApiModelProperty(value = "入仓货物-快递单号")
private String expressNo;
@ApiModelProperty(value = "入仓备注")
@Length(max = 100, message = "备注最多支持100字")
private String remark;
@ApiModelProperty(value = "储位列表")
private List<OrderLocationCreateReqVO> orderLocationCreateReqVOList;
@ApiModelProperty(value = "入仓纪录明细列表")
private List<OrderWarehouseInDetailsVO> orderWarehouseInDetailsVOList;
}
package cn.iocoder.yudao.module.order.vo.orderWarehouseCheck;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.ToString;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.List;
@ApiModel("管理后台 - 到仓修改 Request VO")
@Data
@EqualsAndHashCode
@ToString(callSuper = true)
public class OrderWarehouseCheckUpdateReqVO {
@ApiModelProperty(value = "订单ID", required = true)
@NotNull(message = "订单ID不能为空")
private Long orderId;
@ApiModelProperty(value = "订单项ID", required = true)
@NotNull(message = "订单项id不能为空")
private Long orderItemId;
/**
* 商品ID
*/
@ApiModelProperty(value = "订单项-商品id")
private Long prodId;
/**
* 产品类型
*/
@ApiModelProperty(value = "订单项-产品类型")
private Integer prodType;
/**
* 产品中文标题
*/
@ApiModelProperty(value = "订单项-产品中文标题")
private String prodTitleZh;
/**
* 产品英文标题
*/
@ApiModelProperty(value = "订单项-产品英文标题")
private String prodTitleEn;
/**
* 品牌
*/
@ApiModelProperty(value = "订单项-品牌")
private Long brand;
/**
* 0 无牌 1 有牌 2 中性
*/
@ApiModelProperty(value = "订单项-0 无牌 1 有牌 2 中性")
private Integer brandType;
@ApiModelProperty(value = "收费:无牌价0,有牌价1,中性品牌价2")
private Integer feeType;
@ApiModelProperty(value = "入仓商品特性(可选多个特性ID)")
private String warehouseInProdAttrIds;
/**
* 材质
*/
@ApiModelProperty(value = "材质")
private String material;
@ApiModelProperty(value = "到仓修改详情", required = true)
private List<OrderWarehouseCheckUpdateItemVO> updates;
}
......@@ -15,7 +15,7 @@ public class OrderWarehousePictureBaseVO {
@ApiModelProperty(value = "图片地址")
private String url;
@ApiModelProperty(value = "类型 1订单完成入仓 2 调拨出仓 3调拨到仓 4 订单转异 5订单项入仓 6报关资料")
@ApiModelProperty(value = "类型 1订单完成入仓 2 调拨出仓 3调拨到仓 4 订单转异 5订单项入仓 6报关资料 7 订单项到仓")
private Integer type;
@ApiModelProperty(value = "业务id")
......
......@@ -1522,6 +1522,9 @@
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
......@@ -1667,6 +1670,9 @@
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
......@@ -4467,8 +4473,6 @@
o.audit_result,
o.guan_lian_order_status,
o.transport_id,
-- (select ifnull(sum(ccp.pick_num),0) from ecw_order_cargo_control_pick ccp where ccp.order_id = o.order_id and
-- ccp.status in(1,2,3,4) ) as release_num,
o.release_num,
o.release_ratio,
o.is_cargo_control,
......@@ -4480,6 +4484,9 @@
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
......@@ -4593,8 +4600,6 @@
o.audit_result,
o.guan_lian_order_status,
o.transport_id,
-- (select ifnull(sum(ccp.pick_num),0) from ecw_order_cargo_control_pick ccp where ccp.order_id = o.order_id and
-- ccp.status in(1,2,3,4) ) as release_num,
o.release_num,
o.release_ratio,
o.is_cargo_control,
......@@ -4606,6 +4611,9 @@
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
......@@ -4745,8 +4753,6 @@
o.audit_result,
o.guan_lian_order_status,
o.transport_id,
-- (select ifnull(sum(ccp.pick_num),0) from ecw_order_cargo_control_pick ccp where ccp.order_id = o.order_id and
-- ccp.status in(1,2,3,4) ) as release_num,
o.release_num,
o.release_ratio,
o.is_cargo_control,
......@@ -4758,6 +4764,9 @@
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
......@@ -4879,8 +4888,6 @@
o.audit_result,
o.guan_lian_order_status,
o.transport_id,
-- (select ifnull(sum(ccp.pick_num),0) from ecw_order_cargo_control_pick ccp where ccp.order_id = o.order_id and
-- ccp.status in(1,2,3,4) ) as release_num,
o.release_num,
o.release_ratio,
o.is_cargo_control,
......@@ -4892,6 +4899,9 @@
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
......@@ -5000,6 +5010,9 @@
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
......@@ -5128,6 +5141,9 @@
o.sum_num,
o.sum_volume,
o.sum_weight,
o.check_num,
o.check_volume,
o.check_weight,
o.sum_weight_finished_warehouse_in,
o.sum_volume_finished_warehouse_in,
o.packing_list_url,
......
......@@ -29,12 +29,15 @@ import cn.iocoder.yudao.module.order.convert.order.OrderConvert;
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.dto.*;
import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum;
import cn.iocoder.yudao.module.order.enums.OrderTempLateEnum;
import cn.iocoder.yudao.module.order.enums.TransportTypeShortEnum;
import cn.iocoder.yudao.module.order.service.approval.OrderApprovalService;
import cn.iocoder.yudao.module.order.service.order.OrderBusinessService;
import cn.iocoder.yudao.module.order.service.order.OrderItemService;
import cn.iocoder.yudao.module.order.service.order.OrderQueryService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.service.orderWarehouseApproval.OrderWarehouseApprovalService;
import cn.iocoder.yudao.module.order.vo.approval.OrderSpecialApplyVO;
import cn.iocoder.yudao.module.order.vo.approval.OrderSpecialBatchApplyVO;
import cn.iocoder.yudao.module.order.vo.order.*;
......@@ -103,6 +106,10 @@ public class OrderController {
@Autowired
private OrderQueryService orderQueryService;
@Autowired
private OrderApprovalService orderApprovalService;
@Autowired
private OrderWarehouseApprovalService orderWarehouseApprovalService;
@Autowired
private RoleApi roleApi;
@Autowired
private OrderItemService orderItemService;
......@@ -829,6 +836,7 @@ public class OrderController {
@GetMapping("/getDestCountryByOrderId")
@ApiOperation("根据订单ID查询目的国")
@ApiImplicitParam(name = "orderId", value = "编号", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<String> getDestCountryByOrderId(Long orderId) {
return success(orderQueryService.getDestCountryByOrderId(orderId));
}
......@@ -852,4 +860,57 @@ public class OrderController {
}
@GetMapping("/approvalTypeCheck")
@ApiOperation("校验订单审批是否存在互斥类型:是 或 否 ")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderId", value = "订单id", required = true, example = "1024", dataTypeClass = Long.class),
@ApiImplicitParam(name = "orderItemIdList", value = "订单项id列表(针对品名的审批需要传此参数)", required = false, example = "1024", dataTypeClass = List.class),
@ApiImplicitParam(name = "approvalType", value = "审批类型:见字典表", required = true, example = "1024", dataTypeClass = Integer.class)
})
public CommonResult<Boolean> approvalTypeCheck(Long orderId, List<Long> orderItemIdList, Integer approvalType) {
OrderApprovalTypeEnum approvalTypeEnum = OrderApprovalTypeEnum.valueOf(approvalType);
if (Objects.isNull(approvalTypeEnum)){
// 没有配置相关审批类型则不做校验
return success(Boolean.FALSE);
}
List<Integer> types = approvalTypeEnum.getMutualExclusionValues();
if (Objects.isNull(types)){
// 没有配置相关审批类型则不做校验
return success(Boolean.FALSE);
}
// 枚举配置中的互斥类型集合不能添加新值,这里需要重新定义新集合补充当前审批类型进行查询
List<Integer> typeList = null;
// 包含-1则表示订单不能有任何审批状态存在,所以不用区分类型,查询所有的进行中审批
if (!types.contains(-1)){
typeList = new ArrayList<>(types);
typeList.add(approvalType);
}
// 查询当前订单正在进行的审批
boolean result = orderApprovalService.countProcessingApproval(orderId, orderItemIdList, typeList);
// 入仓相关正在进行的审批业务查询
if (!result){
List<Integer> warehouseApprovalTypeList = null;
if (Objects.nonNull(typeList)){
// 1 入仓修改 2 调仓 3 退仓
warehouseApprovalTypeList = new ArrayList<>();
if (typeList.contains(OrderApprovalTypeEnum.WAREHOUSE_UPDATE.getValue())){
warehouseApprovalTypeList.add(1);
}
if (typeList.contains(OrderApprovalTypeEnum.WAREHOUSE_ADJUST.getValue())){
warehouseApprovalTypeList.add(2);
}
if (typeList.contains(OrderApprovalTypeEnum.WAREHOUSE_ROLLBACK.getValue())){
warehouseApprovalTypeList.add(3);
}
if (warehouseApprovalTypeList.size() == 0){
return success(result);
}
}
result = orderWarehouseApprovalService.countProcessingApproval(orderId, orderItemIdList, warehouseApprovalTypeList);
}
// TODO 当订单互斥所有审批类型时,是否也要对自编号的审批状态进行校验
return success(result);
}
}
......@@ -92,10 +92,6 @@ public class OrderFeeApplicationController {
return error(ORDER_FEE_APPLICATION_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
OrderDO orderDO = orderService.getById(createReqVO.getOrderId());
if (orderDO.getAuditType() != 0) {
throw exception(ORDER_HAS_PROCESSING_APPROVAL, orderDO.getOrderNo());
}
feeApplicationService.createFeeBatchApplication(createReqVO);
redisHelper.delete(redisKey);
return success(true);
......@@ -123,13 +119,15 @@ public class OrderFeeApplicationController {
@PutMapping("/update")
@ApiOperation("更新订单费用申请")
public CommonResult<Boolean> updateFeeApplication(@Valid @RequestBody OrderFeeApplicationUpdateReqVO updateReqVO) {
if (!Objects.isNull(updateReqVO)) {
OrderDO orderDO = orderService.getById(updateReqVO.getOrderId());
if (orderDO.getAuditType() != 0) {
throw exception(ORDER_HAS_PROCESSING_APPROVAL, orderDO.getOrderNo());
}
String redisKey = MessageFormat.format(ORDER_FEE_APPLICATION_KEY, updateReqVO.getOrderId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1){
return error(ORDER_FEE_APPLICATION_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
feeApplicationService.updateFeeApplication(updateReqVO);
redisHelper.delete(redisKey);
return success(true);
}
......
package cn.iocoder.yudao.module.order.controller.admin.orderWarehouseCheck;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.order.dal.dataobject.orderWarehouseCheck.OrderWarehouseCheckDO;
import cn.iocoder.yudao.module.order.service.orderWarehouseCheck.OrderWarehouseCheckService;
import cn.iocoder.yudao.module.order.vo.orderWarehouseCheck.OrderWarehouseCheckUpdateReqVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import javax.validation.Valid;
import java.util.Collections;
import java.util.List;
import java.util.Optional;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
@Validated
@RestController
@Api(tags = "管理后台 - 订单到仓相关接口")
@RequestMapping("/order/order-warehouse-check")
public class OrderWarehouseCheckController {
@Autowired
private OrderWarehouseCheckService service;
@GetMapping("/query")
@ApiOperation("到仓查询")
@ApiImplicitParam(name = "orderItemId", value = "订单项id", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<List<OrderWarehouseCheckDO>> query(@RequestParam("orderItemId") Long orderItemId) {
return success(service.listByOrderItemId(orderItemId));
}
@PostMapping("/force")
@ApiOperation("强制到仓")
@ApiImplicitParam(name = "orderId", value = "订单id", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<Boolean> force(@RequestParam("orderId") Long orderId) {
service.force(orderId);
return success(true);
}
@PostMapping("/revoke")
@ApiOperation("撤销到仓")
@ApiImplicitParam(name = "orderId", value = "订单id", required = true, example = "1024", dataTypeClass = Long.class)
public CommonResult<Boolean> revoke(@RequestParam("orderId") Long orderId) {
service.revoke(orderId);
return success(true);
}
@PutMapping("/update")
@ApiOperation("到仓修改")
public CommonResult<Boolean> update(@Valid @RequestBody OrderWarehouseCheckUpdateReqVO req) {
service.update(req);
return success(true);
}
}
......@@ -306,6 +306,22 @@ public interface CouponMapper extends BaseMapperX<CouponDO> {
"<when test = 'reqVO.status != null'>",
"AND c.status = #{reqVO.status}",
"</when>",
"<when test=\"reqVO.statusList != null and reqVO.statusList.size()>0\">" +
" <when test=\"reqVO.statusList != null and reqVO.statusList.size()==1 \">" +
" AND c.`status` =\n" +
" <foreach item='statusId' index='index' collection='reqVO.statusList' >\n" +
" #{statusId}" +
" </foreach>" +
" </when>" +
" <when test=\"reqVO.types != null and reqVO.statusList.size()>1 \">" +
" AND c.`status` in " +
" <foreach item='statusId' index='index' collection='reqVO.statusList' open='(' separator=',' close=')'>" +
" #{statusId}" +
" </foreach>" +
" </when>" +
"</when>",
"<when test = 'reqVO.overdueStatus != null'>",
"AND c.overdue_status = #{reqVO.overdueStatus}",
"</when>",
......@@ -315,6 +331,26 @@ public interface CouponMapper extends BaseMapperX<CouponDO> {
"<when test = 'reqVO.type != null'>",
"AND c.type = #{reqVO.type}",
"</when>",
"<when test = 'reqVO.validDays != null'>",
"AND c.valid_days = #{reqVO.validDays}",
"</when>",
"<when test=\"reqVO.types != null and reqVO.types.size()>0\">" +
" <when test=\"reqVO.types != null and reqVO.types.size()==1 \">" +
" AND c.`type` =\n" +
" <foreach item='typeId' index='index' collection='reqVO.types' >\n" +
" #{typeId}" +
" </foreach>" +
" </when>" +
" <when test=\"reqVO.types != null and reqVO.types.size()>1 \">" +
" AND c.`type` in " +
" <foreach item='typeId' index='index' collection='reqVO.types' open='(' separator=',' close=')'>" +
" #{typeId}" +
" </foreach>" +
" </when>" +
"</when>",
"<when test = 'reqVO.costType != null'>",
"AND c.cost_type = #{reqVO.costType}",
"</when>",
......@@ -333,6 +369,18 @@ public interface CouponMapper extends BaseMapperX<CouponDO> {
"<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} ",
"</when>",
" <when test='reqVO.beginCreateTime != null' >",
"AND <![CDATA[ c.create_time >= #{reqVO.beginCreateTime} ]]> ",
"</when>",
" <when test='reqVO.endCreateTime != null' >",
"AND <![CDATA[ c.create_time <= #{reqVO.endCreateTime} ]]> ",
"</when>",
"<when test=\"reqVO.creator != null and reqVO.creator != '' \">" +
"AND cr.`nickname` like concat('%',concat(#{reqVO.creator},'%'))",
"</when>",
" order by c.coupon_id desc",
"</script>"
})
......
......@@ -144,6 +144,10 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
"AND t.`audit_status` = #{query.auditStatus}",
"</when>",
"<when test = 'query.packaging != null'>",
"AND t.`packaging` = #{query.packaging}",
"</when>",
"<when test = 'query.titleZh != null and query.titleZh != \"\"'>",
"AND (t.`title_zh` like concat('%',concat(#{query.titleZh},'%')) or t.`title_en` like concat('%',concat(#{query.titleZh},'%')))",
"</when>",
......@@ -166,6 +170,47 @@ public interface ProductMapper extends BaseMapperX<ProductDO> {
// "AND FIND_IN_SET(t.`attr_id`, #{query.attrId})",
"</when>",
"<when test=\"query.materialTypes != null and query.materialTypes.size()>0\">" ,
"<when test=\"query.materialTypes != null and query.materialTypes.size()==1 \">" +
"<foreach item='materialType' index=\"index\" collection='query.materialTypes' >" +
"AND t.`material_type` = #{materialType}" +
"</foreach>" +
"</when>",
"<when test=\"query.materialTypes != null and query.materialTypes.size()>1 \">" +
" AND t.`material_type` in " +
" <foreach item='materialType' index='index' collection='query.materialTypes' open='(' separator=',' close=')'>" +
" #{materialType}" +
" </foreach>" +
"</when>" +
"</when>",
" <when test='query.beginCreateTime != null' >",
"AND <![CDATA[ t.create_time >= #{query.beginCreateTime} ]]> ",
"</when>",
" <when test='query.endCreateTime != null' >",
"AND <![CDATA[ t.create_time <= #{query.endCreateTime} ]]> ",
"</when>",
"<when test=\"query.creator != null and query.creator != '' \">" +
"AND c.`nickname` like concat('%',concat(#{query.creator},'%'))",
"</when>",
"<when test=\"query.titleZhKey != null and query.titleZhKey != '' \">" +
"AND t.`title_zh` like concat('%',concat(#{query.titleZhKey},'%'))",
"</when>",
"<when test=\"query.notTitleZhKey != null and query.notTitleZhKey != '' \">" +
"AND t.`title_zh` not like concat('%',concat(#{query.notTitleZhKey},'%'))",
"</when>",
"<when test=\"query.eqTitleZhKey != null and query.eqTitleZhKey != '' \">" +
"AND t.`title_zh` = #{query.eqTitleZhKey} ",
"</when>",
"<when test=\"query.notEqTitleZhKey != null and query.notEqTitleZhKey != '' \">" +
"AND t.`title_zh` != #{query.notEqTitleZhKey} ",
"</when>",
"order by t.id desc",
"</script>"
......
......@@ -26,9 +26,26 @@ public class ProductReqDTO extends PageParam {
@ApiModelProperty(value = "商品属性id")
//private String attrId;
private List<String> attrId;
@ApiModelProperty(value = "商品材质id")
//private String materialTypes;
private List<String> materialTypes;
@ApiModelProperty(value = "中文标题")
private String titleZh;
@ApiModelProperty(value = "中文标题搜索(包括订单号,麦头,提单号)")
private String titleZhKey;
@ApiModelProperty(value = "反向中文标题搜索(包括订单号,麦头,提单号)不包含的数据")
private String notTitleZhKey;
@ApiModelProperty(value = "中文标题搜索强等于(包括订单号,麦头,提单号)")
private String eqTitleZhKey;
@ApiModelProperty(value = "中文标题搜索强不等于(包括订单号,麦头,提单号)")
private String notEqTitleZhKey;
@ApiModelProperty(value = "英文标题")
private String titleEn;
......@@ -79,6 +96,9 @@ public class ProductReqDTO extends PageParam {
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "创建人")
private String creator;
private boolean filter = true;
/**
......
......@@ -26,6 +26,9 @@ public class CouponPageReqVO extends PageParam {
@ApiModelProperty(value = "类型 1:优惠卷 2:金额-满减 3:方数-满减 4 折扣 5优惠 6 特价 7区间价")
private Integer type;
@ApiModelProperty(value = "类型ids")
private List<Integer> types;
@ApiModelProperty(value = "使用条件(优惠卷专用)")
private BigDecimal cashCondition;
......@@ -115,6 +118,9 @@ public class CouponPageReqVO extends PageParam {
@ApiModelProperty(value = "优惠券状态(0:草稿 1:发布)")
private Integer status;
@ApiModelProperty(value = "优惠券状态ids")
private List<Integer> statusList;
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
@ApiModelProperty(value = "开始创建时间")
private Date beginCreateTime;
......@@ -123,6 +129,9 @@ public class CouponPageReqVO extends PageParam {
@ApiModelProperty(value = "结束创建时间")
private Date endCreateTime;
@ApiModelProperty(value = "创建人")
private String creator;
@ApiModelProperty(value = "关键字")
private String searchKey;
......
......@@ -95,16 +95,18 @@ public class ProductPricePageReqVO extends PageParam {
@ApiModelProperty(value = "始发地城市id")
private Long startCityId;
@ApiModelProperty(value = "目的地城市id")
private Long destCityId;
private List<Long> destCityId;
@ApiModelProperty(value = "运输方式")
private String transportType;
@ApiModelProperty(value = "国家")
private Long destCountryId;
private List<Long> destCountryId;
@ApiModelProperty(value = "目的仓")
private Long destWarehouseId;
private List<Long> destWarehouseId;
@ApiModelProperty(value = "商品编码")
private String productCode;
......@@ -119,4 +121,6 @@ public class ProductPricePageReqVO extends PageParam {
private List<String> existTypeList;
}
......@@ -109,17 +109,29 @@
<if test="params.startCityId != null">
and ew_start.shi = #{params.startCityId}
</if>
<if test="params.destCityId != null">
and ew_dest.shi = #{params.destCityId}
<!--目的地-->
<if test="params.destCityId != null and params.destCityId.size()>0 ">
and ew_dest.`shi` in
<foreach item='destCity' index='index' collection='params.destCityId' open='(' separator=',' close=')'>
#{destCity}
</foreach>
</if>
<!--目的国-->
<if test="params.destCountryId != null">
and ew_dest.guojia=#{params.destCountryId}
<if test="params.destCountryId != null and params.destCountryId.size()>0 ">
and ew_dest.`guojia` in
<foreach item='destCountry' index='index' collection='params.destCountryId' open='(' separator=',' close=')'>
#{destCountry}
</foreach>
</if>
<!--目的仓-->
<if test="params.destWarehouseId != null">
and ew_dest.id=#{params.destWarehouseId}
<if test="params.destWarehouseId != null and params.destWarehouseId.size()>0 ">
and ew_dest.`id` in
<foreach item='destWarehouse' index='index' collection='params.destWarehouseId' open='(' separator=',' close=')'>
#{destWarehouse}
</foreach>
</if>
<if test="params.blacklist != null">
......
......@@ -5,9 +5,13 @@ import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.order.dal.dataobject.approval.OrderApprovalDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO;
import cn.iocoder.yudao.module.shipment.vo.boxApproval.BoxApprovalQueryVO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
/**
* 出货审核 Mapper
......@@ -44,4 +48,18 @@ public interface BoxApprovalMapper extends AbstractMapper<BoxApprovalDO> {
return null;
}
@ResultType(BoxApprovalDO.class)
@Select({
"<script>",
"select",
" a.* ",
"from ecw_box_approval a",
"where ",
"a.shipment_id = #{shipmentId}",
"and (a.order_id is null or (a.order_id is not null and a.order_id = #{orderId}) )",
"order by a.id desc",
"</script>"
})
List<BoxApprovalDO> checkOrderProcessingApproval(@Param("shipmentId") Long shipmentId, @Param("orderId") Long orderId);
}
package cn.iocoder.yudao.module.shipment.listener;
import cn.iocoder.yudao.framework.apollo.core.event.BoxCheckOrderApprovalEvent;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxApprovalDO;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
import cn.iocoder.yudao.module.shipment.enums.BoxApprovalTypeEnum;
import cn.iocoder.yudao.module.shipment.service.box.BoxService;
import cn.iocoder.yudao.module.shipment.service.boxApproval.BoxApprovalService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springframework.context.event.EventListener;
import org.springframework.stereotype.Component;
import java.util.List;
import java.util.Objects;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeResultEnum.*;
/**
* 提供订单最新的进行中审批任务
*
* @author zhengYi
*/
@Component("BoxCheckOrderApprovalListener")
@AllArgsConstructor
@Slf4j
public class BoxCheckOrderApprovalListener {
private final BoxApprovalService boxApprovalService;
private final BoxService boxService;
/**
* 提供订单是否存在进行中的审批校验
*
* @param event 订单信息与结果
*/
@EventListener(BoxCheckOrderApprovalEvent.class)
public void checkOrderApproval(BoxCheckOrderApprovalEvent event) {
BoxDO boxDO = boxService.getOne(new LambdaQueryWrapper<BoxDO>().eq(BoxDO::getSelfNo, event.getSelfNo()));
if (boxDO == null) {
return;
}
List<BoxApprovalDO> boxApprovalDOList = boxApprovalService.checkOrderProcessingApproval(boxDO.getId(), event.getOrderId());
if (Objects.isNull(boxApprovalDOList)) {
return;
}
for (BoxApprovalDO boxApprovalDO : boxApprovalDOList) {
BoxApprovalTypeEnum typeEnum = BoxApprovalTypeEnum.getApprovalTypeByTypeValue(boxApprovalDO.getApprovalType());
if (Objects.isNull(typeEnum)) {
continue;
}
event.setIsExists(true);
switch (typeEnum) {
case PRELOAD:
//预装
event.setAuditType(pre_install_processing.getResult());
event.setAuditResult(pre_install_processing.getDesc());
return;
case SEALING_CABINET:
//装柜
event.setAuditType(closure_processing.getResult());
event.setAuditResult(closure_processing.getDesc());
return;
case UNLOAD_CABINET:
// 卸柜
event.setAuditType(unloading_cabinet_processing.getResult());
event.setAuditResult(unloading_cabinet_processing.getDesc());
return;
case PRELOAD_UMPIRE:
//预装反审
event.setAuditType(pre_install_back_processing.getResult());
event.setAuditResult(pre_install_back_processing.getDesc());
return;
case CUSTOMS_FULL_REFUND:
//报关全退
event.setAuditType(customs_exit_processing.getResult());
event.setAuditResult(customs_exit_processing.getDesc());
return;
case UNLOAD_UMPIRE:
//卸柜反审
event.setAuditType(unloading_cabinet_back_processing.getResult());
event.setAuditResult(unloading_cabinet_back_processing.getDesc());
return;
case SEALING_CABINET_UMPIRE:
//封柜反审
event.setAuditType(closure_back_processing.getResult());
event.setAuditResult(closure_back_processing.getDesc());
return;
case AIR_SORTING:
// 排单分拣
event.setAuditType(sorting_processing.getResult());
event.setAuditResult(sorting_processing.getDesc());
return;
case AIR_SORTING_BACK:
// 排单分拣反审
event.setAuditType(sorting_back_processing.getResult());
event.setAuditResult(sorting_back_processing.getDesc());
return;
case AIR_TO_WAREHOUSE:
// 到仓
event.setAuditType(warehoused_processing.getResult());
event.setAuditResult(warehoused_processing.getDesc());
return;
case AIR_TO_WAREHOUSE_BACK:
// 到仓反审
event.setAuditType(warehoused_back_processing.getResult());
event.setAuditResult(warehoused_back_processing.getDesc());
return;
case AIR_SHIPMENT:
// 出货
event.setAuditType(shipment_processing.getResult());
event.setAuditResult(shipment_processing.getDesc());
return;
case AIR_SHIPMENT_BACK:
// 出货反审
event.setAuditType(shipment_back_processing.getResult());
event.setAuditResult(shipment_back_processing.getDesc());
return;
case CLEARANCE_BACK:
// 撤销清关
event.setAuditType(clearance_back_processing.getResult());
event.setAuditResult(clearance_back_processing.getDesc());
return;
default:
event.setIsExists(false);
}
}
}
}
......@@ -9,6 +9,7 @@ import cn.iocoder.yudao.module.order.dal.dataobject.orderConsignee.OrderConsigne
import cn.iocoder.yudao.module.order.dal.dataobject.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderSplitItem.OrderSplitItemDO;
import cn.iocoder.yudao.module.order.enums.OrderAirTimeEnum;
import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum;
import cn.iocoder.yudao.module.order.enums.OrderSeaTimeEnum;
import cn.iocoder.yudao.module.order.enums.TargetLogEnum;
import cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO;
......@@ -693,7 +694,7 @@ public interface BoxService extends IService<BoxDO> {
void splitWorthConsistencyCheck(List<OrderSplitItemDO> orderAllSplitItemDOList, BigDecimal worth);
void checkOrdersApprovaling(Long shipmentId);
void checkOrdersApprovaling(Long shipmentId, OrderApprovalTypeEnum approvalTypeEnum);
void splitUsed(Long spiltId);
......
......@@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.code.CodeUtils;
......@@ -206,6 +207,7 @@ import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.scheduling.annotation.Async;
import org.springframework.stereotype.Service;
......@@ -222,7 +224,9 @@ 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_IS_APPROVAL_IN_PROCESS;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_LINE_CHANNEL_NOT_NULL;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.WAREHOUSE_ADJUST;
import static cn.iocoder.yudao.module.shipment.enums.BoxAirStatusEnum.TO_WAREHOUSED;
import static cn.iocoder.yudao.module.shipment.enums.BoxStatusEnum.UNLOADED;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
......@@ -393,6 +397,9 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
@Resource
private BoxBookAirService boxBookAirService;
@Resource
private ApplicationContext applicationContext;
private static final Long NIGERIA = 4174L;
private static Map<String, Integer> minNumMap = new HashMap<>();
......@@ -4653,19 +4660,22 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
@Override
public void checkOrdersApprovaling(Long shipmentId) {
public void checkOrdersApprovaling(Long shipmentId, OrderApprovalTypeEnum orderApprovalTypeEnum) {
Set<Long> orderIdSet = boxPreloadGoodsService.getShipOrderIdList(shipmentId);
if (CollectionUtil.isEmpty(orderIdSet)) return;
List<OrderDO> orderDOList = orderQueryService.getOrderList(orderIdSet);
List<String> orderNoList = new ArrayList<>();
orderDOList = orderDOList.stream()
.filter(t -> t.getAuditType() != 0)
.collect(Collectors.toList());
// if (CollectionUtil.isNotEmpty(orderDOList)) {
// throw new ServiceException(500, "出货有订单在审核中");
if (CollectionUtil.isNotEmpty(orderDOList)) {
List<String> orderNoList = orderDOList.stream()
.map(OrderDO::getOrderNo)
.collect(Collectors.toList());
for (OrderDO orderDO : orderDOList) {
OrderApprovalTypeCheckEvent approvalTypeCheckEvent = new OrderApprovalTypeCheckEvent(orderDO.getOrderId(), null, orderApprovalTypeEnum.getValue(), null,false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
orderNoList.add(orderDO.getOrderNo());
}
}
if (CollectionUtil.isNotEmpty(orderNoList) && orderNoList.size() > 0) {
String orderNoStrs = Joiner.on(",").join(orderNoList);
throw new ServiceException(500, "出货有订单(" + orderNoStrs + ")在审核中");
}
......
......@@ -101,4 +101,6 @@ public interface BoxApprovalService extends IService<BoxApprovalDO> {
Integer getBackApprovalType(Long shipmentId);
List<BoxApprovalDO> getBackApprovalList(List<Long> idList);
List<BoxApprovalDO> checkOrderProcessingApproval(Long shipmentId, Long orderId);
}
......@@ -63,6 +63,8 @@ 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.*;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.pre_install;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.sorting;
import static cn.iocoder.yudao.module.order.enums.TargetLogEnum.LOADING;
import static cn.iocoder.yudao.module.order.enums.TargetLogEnum.WITHDRAWAL;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
......@@ -107,8 +109,7 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
// checkApproval(createReqVO.getShipmentId(), approvalType);
//同时只能有一个在审核中
checkApproval(createReqVO.getShipmentId(), null);
//校验订单是否有在审核中的
boxService.checkOrdersApprovaling(createReqVO.getShipmentId());
BoxApprovalDO boxApproval = BoxApprovalConvert.INSTANCE.convert(createReqVO);
boxApproval.setApprovalStatus(BpmProcessInstanceResultEnum.PROCESS.getResult());
......@@ -123,6 +124,8 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
//----------------------------------------预装---------------------------------------
if (createReqVO.getApprovalType() ==
BoxApprovalTypeEnum.PRELOAD.getType()) {
//校验订单是否有在审核中的
boxService.checkOrdersApprovaling(createReqVO.getShipmentId(), pre_install);
//检查是否有预装订单
boxService.checkPreInstallNum(shipmentId);
......@@ -486,7 +489,8 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
else if (createReqVO.getApprovalType() == BoxApprovalTypeEnum.AIR_SORTING.getType()) {
//检查是否有分拣订单
boxService.checkPreInstallNum(shipmentId);
//校验订单是否有在审核中的
boxService.checkOrdersApprovaling(createReqVO.getShipmentId(), sorting);
//分拣
flowKey = WorkFlowEmus.SHIPMENT_ORDER_SORTING.getKey();
StStatusEnum stStatusEnum = StStatusEnum.SORTING_APPROVAL_ING;
......@@ -1630,4 +1634,9 @@ public class BoxApprovalServiceImpl extends AbstractService<BoxApprovalMapper, B
.in(BoxApprovalDO::getApprovalType, backTypeList)
);
}
@Override
public List<BoxApprovalDO> checkOrderProcessingApproval(Long shipmentId, Long orderId) {
return boxApprovalMapper.checkOrderProcessingApproval(shipmentId, orderId);
}
}
......@@ -21,6 +21,7 @@ import cn.iocoder.yudao.module.order.service.order.OrderItemService;
import cn.iocoder.yudao.module.order.service.order.OrderQueryService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.service.orderLabel.OrderLabelService;
import cn.iocoder.yudao.module.order.service.orderWarehouseCheck.OrderWarehouseCheckService;
import cn.iocoder.yudao.module.order.vo.order.OrderQueryVO;
import cn.iocoder.yudao.module.order.vo.orderLabel.OrderLabelQueryVO;
import cn.iocoder.yudao.module.order.vo.orderLocation.OrderLocationCreateReqVO;
......@@ -107,6 +108,10 @@ public class BoxLoadInfoServiceImpl extends AbstractService<BoxLoadInfoMapper, B
@Lazy
private BoxPkgOrderService boxPkgOrderService;
@Resource
@Lazy
private OrderWarehouseCheckService orderWarehouseCheckService;
public static void main(String[] args) {
String number = "NG2200491L-01-1";
int position = number.lastIndexOf("-");
......@@ -663,6 +668,7 @@ public class BoxLoadInfoServiceImpl extends AbstractService<BoxLoadInfoMapper, B
//修改订单状态为已到仓
updateOrderStatusAir(orderIdSet, ulBoxTime, createReqVO.getShipmentId());
// boxService.updateUlBoxTime(createReqVO.getShipmentId(), ulBoxTime);
orderIdSet.forEach(orderWarehouseCheckService::check);
}
......@@ -719,6 +725,7 @@ public class BoxLoadInfoServiceImpl extends AbstractService<BoxLoadInfoMapper, B
.eq(BoxLoadInfoDO::getShipmentId, shipmentId)
);
updateOrderStatusAir(Collections.singletonList(orderId), ulBoxTime, shipmentId);
orderWarehouseCheckService.check(orderId);
}
} else {
//单个卸柜
......@@ -767,6 +774,7 @@ public class BoxLoadInfoServiceImpl extends AbstractService<BoxLoadInfoMapper, B
}
if(CollectionUtil.isNotEmpty(unloadOrderList)) {
updateOrderStatusAir(unloadOrderList, ulBoxTime, shipmentId);
unloadOrderList.forEach(orderWarehouseCheckService::check);
}
}
// boxService.updateUlBoxTime(shipmentId, ulBoxTime);
......@@ -1129,6 +1137,7 @@ public class BoxLoadInfoServiceImpl extends AbstractService<BoxLoadInfoMapper, B
);
updateOrderStatus(Collections.singletonList(orderId), ulBoxTime, shipmentId);
orderWarehouseCheckService.check(orderId);
}
} else {
//单个卸柜
......@@ -1179,6 +1188,7 @@ public class BoxLoadInfoServiceImpl extends AbstractService<BoxLoadInfoMapper, B
}
if(CollectionUtil.isNotEmpty(unloadOrderList)) {
updateOrderStatus(unloadOrderList, ulBoxTime, shipmentId);
unloadOrderList.forEach(orderWarehouseCheckService::check);
}
}
// boxService.updateUlBoxTime(shipmentId, ulBoxTime);
......@@ -1208,6 +1218,7 @@ public class BoxLoadInfoServiceImpl extends AbstractService<BoxLoadInfoMapper, B
//修改订单状态为已到仓
updateOrderStatus(orderIdSet, ulBoxTime, shipmentId);
// boxService.updateUlBoxTime(shipmentId, ulBoxTime);
orderIdSet.forEach(orderWarehouseCheckService::check);
}
@Override
......
package cn.iocoder.yudao.module.shipment.service.boxPreloadGoods;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.apollo.core.event.Order.OrderApprovalTypeCheckEvent;
import cn.iocoder.yudao.framework.common.exception.ServiceException;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.util.collectors.CollectorsUtil;
......@@ -72,6 +73,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.google.common.base.Joiner;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.context.ApplicationContext;
import org.springframework.context.annotation.Lazy;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
......@@ -87,6 +89,8 @@ import java.util.stream.Stream;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_HAS_PROCESSING_APPROVAL;
import static cn.iocoder.yudao.module.order.enums.ErrorCodeConstants.ORDER_IS_APPROVAL_IN_PROCESS;
import static cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum.ORDER_UPDATE;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.*;
/**
......@@ -122,7 +126,8 @@ public class BoxPreloadGoodsServiceImpl extends AbstractService<BoxPreloadGoodsM
BoxLoadInfoService boxLoadInfoService;
@Resource
OrderService orderService;
@Resource
private ApplicationContext applicationContext;
@Resource
OrderQueryService orderQueryService;
@Resource
......@@ -190,7 +195,11 @@ 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(1,2,3,4,5,12,31,32) , false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
//如果都符合,下面展示互斥和关联订单的弹窗
Integer relationStatus = createReqVO.getRelationStatus();
//校验是否是互斥订单
......@@ -424,7 +433,11 @@ 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(1,2,3,4,5,12,31,32) , false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
//校验是否符合预装。
checkInstallAvailable(boxDO, secId, loadList, orderDO, orderItemIdList);
......@@ -2254,6 +2267,11 @@ 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(1,2,3,4,5,12,31,32) , false);
applicationContext.publishEvent(approvalTypeCheckEvent);
if (approvalTypeCheckEvent.getResult()) {
throw exception(ORDER_IS_APPROVAL_IN_PROCESS);
}
if(filterConsigneeDO != null) {
//校验收货人是否是同一个人
OrderConsigneeDO consigneeDO = boxService.getOrderConsignee(orderDO);
......
package cn.iocoder.yudao.module.shipment.vo.boxPreloadGoods;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.module.order.vo.order.WarehouseInInfoVO;
import cn.iocoder.yudao.module.order.vo.orderItem.OrderItemBackVO;
import io.swagger.annotations.ApiModelProperty;
......
......@@ -305,3 +305,6 @@ order.not.is.overseas.warehouse.order=
area.code.not.null=
currency.id.not.null=
order.approval.is.not.exists=
fee.application.not.is.zero=
\ No newline at end of file
......@@ -126,6 +126,9 @@ not.find.currency=No available currency units found
order.warehouse.in.not.exists=order warehouse in not exists
order.warehouse.in.update.not.exists=order warehouse in update data not exists
order.warehouse.approval.not.exists=order warehouse approval not exists
order.warehouse.check.not.exists=order warehouse check not exists
order.warehouse.check.bad.volume=order warehouse check bad volume
order.warehouse.check.bad.weight=order warehouse check bad weight
warehouse.adjust.not.exists=warehouse adjust not exists
shipment.not.exists=Shipment does not exist
shipment.order.exit.not.exists=Order exit information does not exist
......@@ -1116,3 +1119,6 @@ order.not.is.overseas.warehouse.order=This order is already a non overseas wareh
area.code.not.null=The national mobile phone area code cannot be empty
currency.id.not.null=The country ID cannot be empty
order.approval.is.not.exists=Order approval type does not exist
fee.application.not.is.zero=The expense application amount is not 0, and cannot be directly deleted
\ No newline at end of file
......@@ -126,6 +126,9 @@ not.find.currency=\u672A\u627E\u5230\u53EF\u7528\u8D27\u5E01\u5355\u4F4D
order.warehouse.in.not.exists=\u5165\u4ED3\u8D27\u7269\u8BE6\u60C5\u4E0D\u5B58\u5728
order.warehouse.in.update.not.exists=\u6CA1\u6709\u8981\u4FEE\u6539\u7684\u5165\u4ED3\u6570\u636E
order.warehouse.approval.not.exists=\u5165\u4ED3\u5355\u5BA1\u6838\u4E0D\u5B58\u5728
order.warehouse.check.not.exists=\u5230\u4ed3\u8d27\u7269\u8be6\u60c5\u4e0d\u5b58\u5728
order.warehouse.check.bad.volume=\u5230\u4ed3\u8d27\u7269\u4f53\u79ef\u8d85\u51fa
order.warehouse.check.bad.weight=\u5230\u4ed3\u8d27\u7269\u91cd\u91cf\u8d85\u51fa
warehouse.adjust.not.exists=\u8C03\u4ED3\u8BB0\u5F55\u4E0D\u5B58\u5728
shipment.not.exists=\u51FA\u8D27\u4E0D\u5B58\u5728
shipment.order.exit.not.exists=\u8BA2\u5355\u9000\u573A\u4FE1\u606F\u4E0D\u5B58\u5728
......@@ -1116,3 +1119,6 @@ order.not.is.overseas.warehouse.order=\u8be5\u8ba2\u5355\u5df2\u7ecf\u662f\u975e
area.code.not.null=\u56fd\u5bb6\u624b\u673a\u533a\u53f7\u4e0d\u80fd\u4e3a\u7a7a
currency.id.not.null=\u56fd\u5bb6id\u4e0d\u80fd\u4e3a\u7a7a
order.approval.is.not.exists=\u8ba2\u5355\u5ba1\u6279\u7c7b\u578b\u4e0d\u5b58\u5728
fee.application.not.is.zero=\u8d39\u7528\u7533\u8bf7\u91d1\u989d\u4e0d\u4e3a0\uff0c\u4e0d\u80fd\u8fdb\u884c\u76f4\u63a5\u5220\u9664
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