Commit 63389435 authored by zhengyi's avatar zhengyi

Merge remote-tracking branch 'origin/release-fix' into release-fix

# Conflicts:
#	yudao-module-order/yudao-module-order-core/src/main/java/cn/iocoder/yudao/module/order/service/orderPickup/OrderPickupServiceImpl.java
#	yudao-server/src/main/resources/i18n/messages.properties
#	yudao-server/src/main/resources/i18n/messages_en.properties
#	yudao-server/src/main/resources/i18n/messages_zh.properties
parents fc2de1a7 f7df0151
-- 增加区号
alter table ecw_region add COLUMN area_code varchar(32) DEFAULT NULL comment '区号';
INSERT INTO `system_dict_data` (`sort`, `value`, `label`, `label_en`, `dict_type`, `status`, `color_type`, `css_class`, `remark`, `creator`, `create_time`, `updater`, `update_time`, `deleted`)
VALUES (33, '33', '客户合并', 'Customer Merge', 'customer_operate_type', 0, 'default', '', NULL, '1', now(), '115', now(), b'0');
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.module.customer.controller.admin.customer;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.StrUtil;
import cn.iocoder.boot.module.order.api.OrderApi;
import cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -13,6 +14,7 @@ import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customer.CustomerConvert;
......@@ -38,6 +40,7 @@ import cn.iocoder.yudao.module.customer.service.customerContacts.CustomerContact
import cn.iocoder.yudao.module.customer.service.customerCredit.CustomerCreditService;
import cn.iocoder.yudao.module.customer.service.customerLevel.CustomerLevelService;
import cn.iocoder.yudao.module.customer.service.customerLevelLog.CustomerLevelLogServiceImpl;
import cn.iocoder.yudao.module.customer.service.customerOperateLog.CustomerOperateLogService;
import cn.iocoder.yudao.module.customer.service.customerPublicCatchLog.CustomerPublicCatchLogService;
import cn.iocoder.yudao.module.customer.service.zhongPao.ZhongPaoService;
import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerContactsCreateReqVO;
......@@ -46,6 +49,7 @@ import cn.iocoder.yudao.module.customer.vo.customer.customerContacts.CustomerCon
import cn.iocoder.yudao.module.customer.vo.customer.vo.*;
import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankBackVO;
import cn.iocoder.yudao.module.customer.vo.customerBank.CustomerBankQueryVO;
import cn.iocoder.yudao.module.customer.vo.customerOperateLog.CustomerOperateLogCreateReqVO;
import cn.iocoder.yudao.module.ecw.api.paramValid.ParamValidatorApi;
import cn.iocoder.yudao.module.ecw.enums.CustomerContactsDefaultEnum;
import cn.iocoder.yudao.module.ecw.enums.CustomerCreateFromEnum;
......@@ -115,6 +119,9 @@ public class CustomerController {
@Resource
private AdminUserApi adminUserApi;
@Resource
private OrderApi orderApi;
@Resource
private CountryService countryService;
......@@ -174,6 +181,9 @@ public class CustomerController {
@Resource
private CustomerLevelLogServiceImpl customerLevelLogService;
@Resource
private CustomerOperateLogService customerOperateLogService;
public CustomerController() {
}
......@@ -450,9 +460,51 @@ public class CustomerController {
//合并信用日志 8
customerService.doMergeCustomerCreditLog(customerDO1.getId(),
customerDO2.getId());
//合并订单
orderApi.mergeOrder(customerDO1.getId(), customerDO2.getId());
//合并操作日志 9
customerService.doMergeCustomerOperateLog(customerDO1.getId(),
customerDO2.getId());
// customerService.doMergeCustomerOperateLog(customerDO1.getId(),
// customerDO2.getId());
// 纪录客户合并日志
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customerDO1.getId())
.setNumber(customerDO1.getNumber())
.setName(customerDO1.getName())
.setOldCustomerService(null)
.setNewCustomerService(customerDO1.getCustomerService())
.setOldEstimateEnterOpenSeaTime(null)
.setNewEstimateEnterOpenSeaTime(customerDO1.getEstimateEnterOpenSeaTime())
.setOrderId(null)
.setOrderNo(null)
.setOperateType(CustomerOperateTypeEnum.CUSTOMER_MERGE.getValue())
.setRemark(String.format("将客户【%d-%s-%s】合并到此客户", customerDO2.getId(), customerDO2.getNumber(), customerDO2.getName()));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO);
//纪录被删除的客户的日志
CustomerOperateLogCreateReqVO customerOperateLogCreateReqVO2 = new CustomerOperateLogCreateReqVO()
.setOperator(loginUser == null ? null : loginUser.getId())
.setOperatorName(loginUser == null ? null : loginUser.getNickname())
.setCustomerId(customerDO2.getId())
.setNumber(customerDO2.getNumber())
.setName(customerDO2.getName())
.setOldCustomerService(null)
.setNewCustomerService(customerDO2.getCustomerService())
.setOldEstimateEnterOpenSeaTime(null)
.setNewEstimateEnterOpenSeaTime(customerDO2.getEstimateEnterOpenSeaTime())
.setOrderId(null)
.setOrderNo(null)
.setOperateType(CustomerOperateTypeEnum.CUSTOMER_MERGE.getValue())
.setRemark(String.format("将此客户合并到主客户【%d-%s-%s】", customerDO1.getId(), customerDO1.getNumber(), customerDO1.getName()));
customerOperateLogService.createOperateLog(customerOperateLogCreateReqVO2);
return true;
}
......
......@@ -67,6 +67,11 @@ public enum CustomerOperateTypeEnum {
CUSTOMER_UPDATE_SETUP(32, "设置客户设置"),
CUSTOMER_MERGE(33, "客户合并"),
DELETE(100, "删除"),
......
......@@ -59,4 +59,6 @@ public class RegionBaseVO {
private String importCurrency4;
@ApiModelProperty(value = "应收额币种", required = false)
private String importCurrency5;
@ApiModelProperty(value = "区号", required = false)
private String areaCode;
}
package cn.iocoder.yudao.module.ecw.dal.dataobject.region;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
......@@ -93,4 +92,8 @@ public class RegionDO extends BaseDO {
* 进口国应收额币种
*/
private String importCurrency5;
/**
* 区号
*/
private String areaCode;
}
......@@ -21,4 +21,13 @@ public interface OrderApi {
* 根据订单id获取所有订单项
*/
List<OrderItemRespDTO> getOrderItemsByOrderId(Long orderId);
/**
* 合并订单
* @param customerIdSaved 保留客户id
* @param customerIdDeleted 删除客户id
* @return 是否合并成功
*/
boolean mergeOrder(Long customerIdSaved, Long customerIdDeleted);
}
......@@ -3,16 +3,16 @@ package cn.iocoder.yudao.module.order.api;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.boot.module.order.api.OrderApi;
import cn.iocoder.boot.module.order.api.dto.*;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.service.customer.CustomerService;
import cn.iocoder.yudao.module.order.convert.orderConsignor.OrderConsignorConvert;
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.orderItem.OrderItemDO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderObjective.OrderObjectiveDO;
import cn.iocoder.yudao.module.order.service.order.OrderConsigneeService;
import cn.iocoder.yudao.module.order.service.order.OrderConsignorService;
import cn.iocoder.yudao.module.order.service.order.OrderObjectiveService;
import cn.iocoder.yudao.module.order.service.order.OrderService;
import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.order.impl.OrderItemServiceImpl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import org.springframework.beans.BeanUtils;
......@@ -20,6 +20,7 @@ import org.springframework.stereotype.Service;
import org.springframework.validation.annotation.Validated;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
......@@ -30,6 +31,10 @@ public class OrderApiImpl implements OrderApi {
@Resource
private OrderService orderService;
@Resource
private OrderBusinessService orderBusinessService;
@Resource
private CustomerService customerService;
@Resource
private OrderObjectiveService objectiveService;
@Resource
private OrderConsigneeService orderConsigneeService;
......@@ -92,4 +97,58 @@ public class OrderApiImpl implements OrderApi {
}
return null;
}
@Override
public boolean mergeOrder(Long customerIdSaved, Long customerIdDeleted) {
CustomerDO customerDeleted = customerService.getById(customerIdDeleted);
CustomerDO customerSaved = customerService.getById(customerIdSaved);
// 将customerId=customerIdDeleted的订单的customerId更新为customerIdSaved
List<OrderDO> list = orderService.selectList(new LambdaQueryWrapperX<OrderDO>().eq(OrderDO::getCustomerId, customerIdDeleted));
if (CollectionUtil.isNotEmpty(list)) {
for (OrderDO order : list) {
order.setCustomerId(customerIdSaved);
order.setUpdateTime(new Date());
orderService.updateById(order);
// 保存操作日志
orderBusinessService.addOrderOperateLog(order.getOrderId(), "合并客户-归属人",
String.format("将此订单的客户由【%d-%s-%s】合并为【%d-%s-%s】", customerDeleted.getId(), customerDeleted.getNumber(), customerDeleted.getName(),
customerSaved.getId(), customerSaved.getNumber(), customerSaved.getName()));
}
}
// 修改收货人
List<OrderConsigneeDO> orderConsigneeDOList = orderConsigneeService.selectList(new LambdaQueryWrapperX<OrderConsigneeDO>().eq(OrderConsigneeDO::getCustomerId, customerIdDeleted));
if (CollectionUtil.isNotEmpty(orderConsigneeDOList)) {
for (OrderConsigneeDO orderConsigneeDO : orderConsigneeDOList) {
orderConsigneeDO.setCustomerId(customerIdSaved);
orderConsigneeDO.setCustomerNumber(customerSaved.getNumber());
orderConsigneeService.updateById(orderConsigneeDO);
// 保存操作日志
orderBusinessService.addOrderOperateLog(orderConsigneeDO.getOrderId(), "合并客户-收货人",
String.format("将此订单的收货人客户由【%d-%s-%s】合并为【%d-%s-%s】", customerDeleted.getId(), customerDeleted.getNumber(), customerDeleted.getName(),
customerSaved.getId(), customerSaved.getNumber(), customerSaved.getName()));
}
}
// 修改发货人
List<OrderConsignorDO> orderConsignorDOList = orderConsignorService.selectList(new LambdaQueryWrapperX<OrderConsignorDO>().eq(OrderConsignorDO::getCustomerId, customerIdDeleted));
if (CollectionUtil.isNotEmpty(orderConsignorDOList)) {
for (OrderConsignorDO orderConsignorDO : orderConsignorDOList) {
orderConsignorDO.setCustomerId(customerIdSaved);
orderConsignorDO.setCustomerNumber(customerSaved.getNumber());
orderConsignorService.updateById(orderConsignorDO);
// 保存操作日志
orderBusinessService.addOrderOperateLog(orderConsignorDO.getOrderId(), "合并客户-发货人",
String.format("将此订单的发货人客户由【%d-%s-%s】合并为【%d-%s-%s】", customerDeleted.getId(), customerDeleted.getNumber(), customerDeleted.getName(),
customerSaved.getId(), customerSaved.getNumber(), customerSaved.getName()));
}
}
return false;
}
}
......@@ -5,8 +5,6 @@ import cn.iocoder.yudao.framework.mybatis.core.mapper.AbstractMapper;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQuery;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.order.dal.dataobject.orderException.OrderExceptionDO;
import cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO;
import cn.iocoder.yudao.module.order.vo.order.OrderQueryVO;
import cn.iocoder.yudao.module.order.vo.order.StatisticsOrderVO;
import cn.iocoder.yudao.module.order.vo.orderException.OrderBackVO;
import cn.iocoder.yudao.module.order.vo.orderException.OrderExceptionBackVO;
......@@ -17,7 +15,6 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.ResultType;
import org.apache.ibatis.annotations.Select;
import java.util.List;
......@@ -40,7 +37,7 @@ public interface OrderExceptionMapper extends AbstractMapper<OrderExceptionDO> {
//.eqIfPresent(OrderExceptionDO::getOrderExceptionRemark, vo.getOrderExceptionRemark())
//.eqIfPresent(OrderExceptionDO::getOrderExceptionAmount, vo.getOrderExceptionAmount())
//.eqIfPresent(OrderExceptionDO::getOrderExceptionAttr, vo.getOrderExceptionAttr())
.eqIfPresent(OrderExceptionDO::getOrderExceptionStatus, vo.getOrderExceptionStatus())
.eqIfPresent(OrderExceptionDO::getOrderExceptionStatus, vo.getOrderExceptionStatusList())
.betweenIfPresent(OrderExceptionDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(OrderExceptionDO::getId));
}
......@@ -56,7 +53,7 @@ public interface OrderExceptionMapper extends AbstractMapper<OrderExceptionDO> {
.eqIfPresent(OrderExceptionDO::getOrderId, vo.getOrderId())
//.eqIfPresent(OrderExceptionDO::getOrderNumber, vo.getOrderNumber())
.eqIfPresent(OrderExceptionDO::getOrderExceptionType, vo.getOrderExceptionType())
.eqIfPresent(OrderExceptionDO::getOrderExceptionStatus, vo.getOrderExceptionStatus())
.eqIfPresent(OrderExceptionDO::getOrderExceptionStatus, vo.getOrderExceptionStatusList())
.betweenIfPresent(OrderExceptionDO::getCreateTime, vo.getBeginCreateTime(), vo.getEndCreateTime())
.orderByDesc(OrderExceptionDO::getId));
}
......
......@@ -433,13 +433,11 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
queryWrapper.inIfPresent("e.order_exception_type", reqVo.getOrderExceptionType());
}
queryWrapper.eqIfPresent("tot.order_exception_status", reqVo.getOrderExceptionStatus());
queryWrapper.inIfPresent("tot.order_exception_status", reqVo.getOrderExceptionStatusList());
if (StringUtils.isNotBlank(reqVo.getConsignor())) {
queryWrapper.eq("r.customer_id", reqVo.getConsignor());
}
if (StringUtils.isNotBlank(reqVo.getProductRecord())) {
queryWrapper.eqIfPresent("o.product_record", reqVo.getProductRecord());
}
queryWrapper.eq(StrUtil.isNotBlank(reqVo.getSalesmanId()), "o.salesman_id", reqVo.getSalesmanId());
if (null != reqVo.getCustomerIds() && reqVo.getCustomerIds().size() > 0) {
......@@ -494,6 +492,9 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
//商品类型
queryWrapper.in(null != reqVo.getGoodsTypes(), "m.prod_type", reqVo.getGoodsTypes());
//备案
queryWrapper.in(null != reqVo.getProductRecord(), "o.product_record", reqVo.getProductRecord());
queryWrapper.orderByDesc("e.id");
return orderExceptionMapper.getOrderExceptionExcelList(queryWrapper, reqVo.getOrderExceptionType(), startTime, endTime);
......@@ -2533,13 +2534,10 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
queryWrapper.inIfPresent("eo.objective_country_id", reqVo.getDestCountryIds());
}
queryWrapper.eqIfPresent("s.order_exception_status", reqVo.getOrderExceptionStatus());
queryWrapper.inIfPresent("s.order_exception_status", reqVo.getOrderExceptionStatusList());
if (StringUtils.isNotBlank(reqVo.getConsignor())) {
queryWrapper.eq("oc.customer_id", reqVo.getConsignor());
}
if (StringUtils.isNotBlank(reqVo.getProductRecord())) {
queryWrapper.eqIfPresent("a.product_record", reqVo.getProductRecord());
}
//queryWrapper.eq(StrUtil.isNotBlank(reqVo.getSalesmanId()), "a.salesman_id", reqVo.getSalesmanId());
if (null != reqVo.getCustomerIds() && reqVo.getCustomerIds().size() > 0) {
......@@ -2602,6 +2600,8 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
queryWrapper.in(null != reqVo.getTypes(), "a.type", reqVo.getTypes());
//商品类型
queryWrapper.in(null != reqVo.getGoodsTypes(), "m.prod_type", reqVo.getGoodsTypes());
//备案
queryWrapper.in(null != reqVo.getProductRecord(), "a.product_record", reqVo.getProductRecord());
queryWrapper.orderByDesc("b.id");
......@@ -2664,13 +2664,10 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
queryWrapper.inIfPresent("eo.objective_country_id", reqVo.getDestCountryIds());
}
queryWrapper.eqIfPresent("s.order_exception_status", reqVo.getOrderExceptionStatus());
queryWrapper.inIfPresent("s.order_exception_status", reqVo.getOrderExceptionStatusList());
if (StringUtils.isNotBlank(reqVo.getConsignor())) {
queryWrapper.eq("oc.customer_id", reqVo.getConsignor());
}
if (StringUtils.isNotBlank(reqVo.getProductRecord())) {
queryWrapper.eqIfPresent("a.product_record", reqVo.getProductRecord());
}
//queryWrapper.eq(StrUtil.isNotBlank(reqVo.getSalesmanId()), "a.salesman_id", reqVo.getSalesmanId());
if (null != reqVo.getCustomerIds() && reqVo.getCustomerIds().size() > 0) {
......@@ -2726,6 +2723,9 @@ public class OrderExceptionServiceImpl extends AbstractService<OrderExceptionMap
//商品类型
queryWrapper.in(null != reqVo.getGoodsTypes(), "m.prod_type", reqVo.getGoodsTypes());
//备案
queryWrapper.in(null != reqVo.getProductRecord(), "a.product_record", reqVo.getProductRecord());
StatisticsOrderVO vo = orderExceptionMapper.statisticsExceptionOrder(queryWrapper, reqVo.getOrderExceptionType(), startTime, endTime);
if (Objects.nonNull(vo)) {
vo.setTotalVolume(new BigDecimal(vo.getTotalVolume()).setScale(2, RoundingMode.HALF_UP).toString());
......
......@@ -25,6 +25,7 @@ import cn.iocoder.yudao.module.order.dto.OrderBackInfoDto;
import cn.iocoder.yudao.module.order.enums.*;
import cn.iocoder.yudao.module.order.service.order.*;
import cn.iocoder.yudao.module.order.service.orderCargoControlPick.OrderCargoControlPickService;
import cn.iocoder.yudao.module.order.vo.orderConsignee.OrderConsigneeBackVO;
import cn.iocoder.yudao.module.order.vo.orderPickup.*;
import cn.iocoder.yudao.module.order.vo.orderTime.OrderTimeQueryVO;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
......@@ -622,8 +623,9 @@ public class OrderPickupServiceImpl extends AbstractService<OrderPickupMapper, O
Long aLong = orderPickupMapper.selectCount(OrderPickupDO::getOrderId, createReqVO.getOrderId());
OrderDO order = orderService.selectOne(OrderDO::getOrderNo, createReqVO.getOrderId());
OrderBackInfoDto orderDO = orderQueryService.info(order.getOrderId());
if (orderDO.getConsigneeVO() == null || orderDO.getConsigneeVO().getHarvestMethod() == 2) {
OrderConsigneeBackVO consigneeVO = orderDO.getConsigneeVO();
Integer harvestMethod = consigneeVO == null ? orderDO.getHarvestMethod() : consigneeVO.getHarvestMethod();
if (Objects.isNull(harvestMethod) || harvestMethod == 2) {
if (StringUtils.isNotBlank(orderDO.getTidanNo())) {
errorOrderNo.add(orderDO.getOrderNo() + "(" + orderDO.getTidanNo() + ")");
} else {
......
......@@ -48,13 +48,13 @@ public class OrderExceptionQueryVO {
private List<String> orderExceptionType;
@ApiModelProperty(value = "异常状态")
private Integer orderExceptionStatus;
private List<Integer> orderExceptionStatusList;
@ApiModelProperty(value = "发货人")
private String consignor;
@ApiModelProperty(value = "备案")
private String productRecord;
/* @ApiModelProperty(value = "备案")
private String productRecord;*/
@ApiModelProperty(value = "1:入仓时间2:处理时间")
private String dateType;
......@@ -118,4 +118,7 @@ public class OrderExceptionQueryVO {
@ApiModelProperty(value = "商品类型")
private List<Long> goodsTypes;
@ApiModelProperty(value = "备案")
private List<Integer> productRecord;
}
......@@ -249,6 +249,9 @@
<sql id="orderQuerySql">
<include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -672,9 +675,6 @@
</foreach>
)
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.number != null and query.number != '' ">
AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
from ecw_order_item oi
......@@ -849,6 +849,9 @@
<sql id="myOrderQuerySql">
<include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -1096,9 +1099,6 @@
)
</if>
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.number != null and query.number != '' ">
AND (o.`number` like concat("%",concat(#{query.number},"%")) or o.order_id in( select distinct oi.order_id
from ecw_order_item oi
......@@ -1798,6 +1798,9 @@
<sql id="myOrderQuery">
<include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -2355,9 +2358,7 @@
<if test="query.consignorPhone != null and query.consignorPhone != '' ">
AND nor.`phone` = #{query.consignorPhone}
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.consigneeId != null ">
AND nee.`customer_id` = #{query.consigneeId}
</if>
......@@ -2595,6 +2596,9 @@
<sql id="orderQuery">
<include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -3211,9 +3215,6 @@
<if test="query.consignorPhone != null and query.consignorPhone != '' ">
AND nor.`phone` = #{query.consignorPhone}
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.consigneeId != null ">
AND nee.`customer_id` = #{query.consigneeId}
</if>
......@@ -3543,6 +3544,9 @@
<sql id="issuedOrderQuery">
<include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -4097,9 +4101,6 @@
<if test="query.consignorId != null ">
AND nor.`customer_id` = #{query.consignorId}
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.consigneeId != null ">
AND nee.`customer_id` = #{query.consigneeId}
</if>
......@@ -5184,6 +5185,9 @@
</select>
<sql id="appOrderQurey">
<include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.isNeat == false ">
AND o.sum_num <![CDATA[ < ]]> o.cost->>'$.totalNum'
</if>
......@@ -5327,9 +5331,6 @@
<if test="query.pdaDestWareIds != null and query.pdaDestWareIds != '' ">
AND FIND_IN_SET(ew_dest.`id`, #{query.pdaDestWareIds})
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.isExternalWarehouse != null">
AND o.`is_external_warehouse` = #{query.isExternalWarehouse}
</if>
......@@ -6077,8 +6078,6 @@
from (
select
o.*,
-- (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,
occ.`name` as cargo_control_name,
occ.dial_code as cargo_control_country_code,
occ.phone as cargo_control_phone,
......@@ -6094,6 +6093,10 @@
left join ecw_order_cargo_control occ
on occ.order_id = nor.order_id and occ.is_actual = 1 and occ.deleted = 0
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
<include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.status != null">
AND o.`status` = #{query.status}
</if>
......@@ -6329,9 +6332,6 @@
<if test="query.beginCreateTime != null and query.endCreateTime != null ">
AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.beginPickTime != null and query.endPickTime != null ">
AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and
op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})
......@@ -6556,8 +6556,6 @@
from (
select
o.*,
-- (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,
occ.`name` as cargo_control_name,
......@@ -6575,6 +6573,10 @@
left join ecw_order_cargo_control occ
on occ.order_id = nor.order_id and occ.is_actual = 1 and occ.deleted = 0
where o.deleted = 0 and o.in_warehouse_state != 211 and o.in_warehouse_state != 208 and o.status != 10
<include refid="dynamicQuery"/>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.status != null">
AND o.`status` = #{query.status}
</if>
......@@ -6810,9 +6812,7 @@
<if test="query.beginCreateTime != null and query.endCreateTime != null ">
AND o.`create_time` between #{query.beginCreateTime} and #{query.endCreateTime}
</if>
<if test="query.packageType != null and query.packageType != '' ">
AND CONCAT(',',o.package_type,',') REGEXP CONCAT(',',REPLACE(#{query.packageType},',',',|,'), ',')
</if>
<if test="query.beginPickTime != null and query.endPickTime != null ">
AND o.order_id in(select distinct op.order_id from ecw_order_cargo_control_pick op where op.deleted = 0 and
op.status in(1,3) and op.`create_time` between #{query.beginPickTime} and #{query.endPickTime})
......
......@@ -121,5 +121,6 @@ public interface ErrorCodeConstants {
ErrorCode CASE_NUM_IN_MERGE_PKG = new ErrorCode(1109010058,"case.num.in.merge.pkg");
ErrorCode ORDER_IN_MERGE_PKG = new ErrorCode(1109010059,"order.already.in.merge.pkg");
ErrorCode BOX_UPDATE_REPEAT_COMMIT = new ErrorCode(1109010060, "box.update.repeat.commit");
}
\ No newline at end of file
......@@ -9,6 +9,7 @@ import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.order.dal.dataobject.approval.OrderApprovalDO;
import cn.iocoder.yudao.module.order.enums.ApprovalResultStatusEnum;
import cn.iocoder.yudao.module.order.enums.OrderApprovalTypeEnum;
......@@ -32,11 +33,16 @@ import javax.annotation.Resource;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.io.IOException;
import java.text.MessageFormat;
import java.util.Collection;
import java.util.List;
import java.util.concurrent.TimeUnit;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.EXPORT;
import static cn.iocoder.yudao.module.shipment.controller.admin.constant.Constant.BOX_UPDATE_KEY;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.BOX_UPDATE_REPEAT_COMMIT;
@Validated
@RestController
......@@ -53,6 +59,8 @@ public class BoxApprovalController {
@Resource
private OrderApprovalService orderApprovalService;
@Resource
private RedisHelper redisHelper;
/*
创建出货审批流程
*/
......@@ -62,7 +70,20 @@ public class BoxApprovalController {
//@PreAuthorize("@ss.hasPermission('ecw:box-approval:create')")
public CommonResult<Long> createBoxApproval(
@Valid @RequestBody BoxApprovalCreateReqVO createReqVO) {
return success(boxApprovalService.createBoxApproval(createReqVO));
String redisKey = MessageFormat.format(BOX_UPDATE_KEY, createReqVO.getShipmentId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1) {
return error(BOX_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
try {
Long id = boxApprovalService.createBoxApproval(createReqVO);
return success(id);
}catch (Exception e){
throw e;
} finally {
redisHelper.delete(redisKey);
}
}
@PostMapping("/approvalDetail")
......
package cn.iocoder.yudao.module.shipment.controller.admin;
import cn.hutool.core.collection.CollectionUtil;
import cn.iocoder.yudao.framework.i18n.core.I18nMessage;
import cn.iocoder.yudao.framework.idempotent.core.annotation.Idempotent;
import cn.iocoder.yudao.framework.limiter.dynamic.DynamicRateLimiter;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.module.ecw.dal.dataobject.region.RegionDO;
import cn.iocoder.yudao.module.order.dto.ContainerNumberSummaryDto;
import cn.iocoder.yudao.module.order.dto.OrderCostSummaryDto;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.order.vo.order.OrderBackPageVO;
import cn.iocoder.yudao.module.order.vo.order.OrderBackVO;
import cn.iocoder.yudao.module.order.vo.orderSplit.OrderSplitBackVO;
import cn.iocoder.yudao.module.shipment.convert.BoxConvert;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxDO;
import cn.iocoder.yudao.module.shipment.enums.SlStatueEnum;
import cn.iocoder.yudao.module.shipment.vo.boxTally.BoxOrderLocationUpdateReq;
import cn.iocoder.yudao.module.shipment.vo.boxTally.BoxTallyBackVO;
import cn.iocoder.yudao.module.system.api.file.FileMakeApi;
import cn.iocoder.yudao.module.system.api.file.dto.FileMakeReqDTO;
import cn.iocoder.yudao.module.system.enums.download.DownloadTypeEnum;
import cn.iocoder.yudao.module.system.enums.sms.SmsSceneEnum;
import com.alibaba.excel.EasyExcel;
import com.alibaba.excel.ExcelWriter;
import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.excel.write.metadata.fill.FillConfig;
import com.alibaba.fastjson.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
......@@ -35,18 +28,22 @@ import io.swagger.annotations.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.io.*;
import java.math.BigDecimal;
import java.text.MessageFormat;
import java.util.*;
import java.util.concurrent.TimeUnit;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.BOX_REPORT_NOT_EXIST;
import static cn.iocoder.yudao.module.shipment.controller.admin.constant.Constant.BOX_UPDATE_KEY;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.BOX_UPDATE_REPEAT_COMMIT;
import cn.iocoder.yudao.module.shipment.vo.box.*;
import cn.iocoder.yudao.module.shipment.service.box.BoxService;
......@@ -62,6 +59,9 @@ public class BoxController {
@Resource
private BoxService boxService;
@Resource
private RedisHelper redisHelper;
@Resource
private FileMakeApi fileMakeApi;
......@@ -105,7 +105,19 @@ public class BoxController {
@DynamicRateLimiter(base = "#Headers['Authorization']", permits = 1)
@Idempotent(timeout = 5)
public CommonResult<Boolean> updateBox(@Valid @RequestBody BoxUpdateReqVO updateReqVO) {
boxService.updateBox(updateReqVO);
String redisKey = MessageFormat.format(BOX_UPDATE_KEY, updateReqVO.getId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1) {
return error(BOX_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
try {
boxService.updateBox(updateReqVO);
} catch (Exception e) {
throw e;
} finally {
redisHelper.delete(redisKey);
}
return success(true);
}
......@@ -129,7 +141,7 @@ public class BoxController {
})
@PreAuthorize("@ss.hasPermission('shipment:box:update')")
public CommonResult<Boolean> shipConfigure(@RequestParam("shipmentId") Long shipmentId, @RequestParam("saExmtStatus") Integer saExmtStatus,
@RequestParam("operateType") Integer operateType, @RequestParam(name = "configTime", required = false) String configTime) {
@RequestParam("operateType") Integer operateType, @RequestParam(name = "configTime", required = false) String configTime) {
boxService.shipConfigure(shipmentId, saExmtStatus, operateType, configTime);
return success(true);
}
......@@ -268,7 +280,7 @@ public class BoxController {
@PreAuthorize("@ss.hasPermission('shipment:box:export')")
@OperateLog(type = EXPORT)
public void exportBoxExcel(@Valid BoxQueryVO query,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<BoxExportVO> list = boxService.getExportBoxList(query);
// 导出 Excel
ExcelUtils.write(response, "海运导出出货.xls", "shipment", BoxExportVO.class, list);
......@@ -279,7 +291,7 @@ public class BoxController {
@PreAuthorize("@ss.hasPermission('shipment:box:export:seaAir')")
@OperateLog(type = EXPORT)
public void exportBoxExcelSeaAir(@Valid BoxQueryVO query,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<BoxExportVO> list = boxService.getExportBoxList(query);
// 导出 Excel
ExcelUtils.write(response, "海空导出出货.xls", "shipment", BoxExportVO.class, list);
......@@ -290,7 +302,7 @@ public class BoxController {
@PreAuthorize("@ss.hasPermission('shipment:box:export:air')")
@OperateLog(type = EXPORT)
public void exportBoxExcelAir(@Valid BoxQueryVO query,
HttpServletResponse response) throws IOException {
HttpServletResponse response) throws IOException {
List<BoxExportVO> list = boxService.getExportBoxList(query);
// 导出 Excel
ExcelUtils.write(response, "空运导出出货.xls", "shipment", BoxExportVO.class, list);
......@@ -330,7 +342,7 @@ public class BoxController {
public CommonResult exportOrderSummary(BoxSettlementQueryVO query, HttpServletResponse response) throws Exception {
FileMakeReqDTO reqDTO = new FileMakeReqDTO();
JSONObject jsonObject = new JSONObject();
jsonObject.put("query",JSONObject.toJSONString(query));
jsonObject.put("query", JSONObject.toJSONString(query));
reqDTO.setType(DownloadTypeEnum.SHIPMENT_SUMMERY_EXCEL_EXPORT.getType());
reqDTO.setName("出货应收报表");
reqDTO.setFileSuffix("xlsx");
......
package cn.iocoder.yudao.module.shipment.controller.admin;
import cn.iocoder.yudao.framework.mybatis.core.vo.PageVO;
import cn.iocoder.yudao.framework.redis.helper.RedisHelper;
import cn.iocoder.yudao.module.shipment.convert.BoxCustomsConvert;
import cn.iocoder.yudao.module.shipment.dal.dataobject.BoxCustomsDO;
import cn.iocoder.yudao.module.shipment.service.boxCustoms.BoxCustomsService;
......@@ -15,14 +16,21 @@ import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.annotations.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.text.MessageFormat;
import java.util.*;
import java.io.IOException;
import java.util.concurrent.TimeUnit;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.error;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import static cn.iocoder.yudao.framework.operatelog.core.enums.OperateTypeEnum.*;
import static cn.iocoder.yudao.module.shipment.controller.admin.constant.Constant.BOX_UPDATE_KEY;
import static cn.iocoder.yudao.module.shipment.enums.ErrorCodeConstants.BOX_UPDATE_REPEAT_COMMIT;
@Validated
@RestController
......@@ -33,6 +41,9 @@ public class BoxCustomsController {
@Resource
private BoxCustomsService boxCustomsService;
@Resource
private RedisHelper redisHelper;
@PostMapping("/create")
@ApiOperation("创建报关,use this")
// @PreAuthorize("@ss.hasPermission('ecw:box-customs:create')")
......@@ -44,7 +55,19 @@ public class BoxCustomsController {
@ApiOperation("更新报关, use this")
// @PreAuthorize("@ss.hasPermission('ecw:box-customs:update')")
public CommonResult<Boolean> updateBoxCustoms(@Valid @RequestBody BoxCustomsUpdateReqVO updateReqVO) {
boxCustomsService.updateBoxCustoms(updateReqVO);
String redisKey = MessageFormat.format(BOX_UPDATE_KEY, updateReqVO.getShipmentId().toString());
Long count = redisHelper.incrBy(redisKey, 1);
if (count > 1) {
return error(BOX_UPDATE_REPEAT_COMMIT);
}
redisHelper.expire(redisKey, 1, TimeUnit.MINUTES);
try {
boxCustomsService.updateBoxCustoms(updateReqVO);
}catch (Exception e){
throw e;
} finally {
redisHelper.delete(redisKey);
}
return success(true);
}
......
package cn.iocoder.yudao.module.shipment.controller.admin.constant;
public interface Constant {
String BOX_UPDATE_KEY = "jiedao:box:update:{0}";
}
......@@ -290,3 +290,7 @@ order.not.update.departure=
order.not.update.transport=
order.pre.installation.unpackaged.container.not.update=
order.sorting.not.shipment.not.update=
box.update.repeat.commit=
\ No newline at end of file
......@@ -1096,4 +1096,7 @@ order.not.update.dest.country=Not allowed to modify the destination country
order.not.update.departure=Not allowed to modify the origin location
order.not.update.transport=No modification of transportation method allowed
order.pre.installation.unpackaged.container.not.update=Order pre installed without container, order information cannot be modified
order.sorting.not.shipment.not.update=Order sorting not shipped, order information cannot be modified
\ No newline at end of file
order.sorting.not.shipment.not.update=Order sorting not shipped, order information cannot be modified
box.update.repeat.commit=Duplicate submission of self assigned number status modification
\ No newline at end of file
......@@ -1095,4 +1095,7 @@ order.not.update.dest.country=\u4e0d\u5141\u8bb8\u4fee\u6539\u76ee\u7684\u56fd
order.not.update.departure=\u4e0d\u5141\u8bb8\u4fee\u6539\u59cb\u53d1\u5730
order.not.update.transport=\u4e0d\u5141\u8bb8\u4fee\u6539\u8fd0\u8f93\u65b9\u5f0f
order.pre.installation.unpackaged.container.not.update=\u8ba2\u5355\u9884\u88c5\u672a\u88c5\u67dc, \u8ba2\u5355\u4fe1\u606f\u65e0\u6cd5\u4fee\u6539
order.sorting.not.shipment.not.update=\u8ba2\u5355\u5206\u62e3\u672a\u51fa\u8d27, \u8ba2\u5355\u4fe1\u606f\u65e0\u6cd5\u4fee\u6539
\ No newline at end of file
order.sorting.not.shipment.not.update=\u8ba2\u5355\u5206\u62e3\u672a\u51fa\u8d27, \u8ba2\u5355\u4fe1\u606f\u65e0\u6cd5\u4fee\u6539
box.update.repeat.commit=\u81ea\u7f16\u53f7\u72b6\u6001\u4fee\u6539\u91cd\u590d\u63d0\u4ea4
\ No newline at end of file
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