Commit a8ce13fc authored by lanbaoming's avatar lanbaoming

2024-05-23提交

parent 13545881
......@@ -93,5 +93,54 @@ public interface CustomerContactsMapper extends BaseMapperX<CustomerContactsDO>
"order by cc.update_time desc ",
"</script>"
})
IPage<CustomerContactsDto> selectBySearchKey(IPage page, @Param("searchKey") String searchKey, @Param("type") String type, @Param("ids") Collection<Long> ids, @Param("customerId") Long customerId);
IPage<CustomerContactsDto> selectBySearchKey(IPage page,
@Param("searchKey") String searchKey,
@Param("type") String type,
@Param("ids") Collection<Long> ids,
@Param("customerId") Long customerId);
@ResultType(CustomerContactsDto.class)
@Select({
"<script>",
"select",
"c.*, ",
"c.id as customer_id, ",
"c.name as customer_name, ",
"c.name_en as customer_name_en, ",
"cc.* , ",
"cc.id as customer_contacts_id, ",
"cc.name as contacts_name, ",
"cc.name_en as contacts_name_en ",
"from ecw_customer_contacts cc ",
"left join ecw_customer c ",
"on cc.customer_id = c.id ",
"where ",
"cc.deleted = 0 and cc.customer_id is not null ",
"<when test = 'searchKey != null and searchKey != \"\" '>",
"and CONCAT(IFNULL(cc.`name`,''),IFNULL(cc.`name_en`,''),IFNULL(cc.`phone_new`,''),IFNULL(cc.`email`,''),IFNULL(c.`company`,''),IFNULL(c.`company_en`,'')) like concat('%', concat(#{searchKey}, '%'))",
"</when>",
"<when test = 'type != null and type != \"\" '>",
"and FIND_IN_SET(#{type}, c.type) ",
"</when>",
"<when test = 'ids != null and ids.size()>0'>",
"AND cc.`id` in ",
"<foreach item='id' index='index' collection='ids' open='(' separator=',' close=')'>#{id}</foreach>",
"</when>",
"<when test = 'customerId != null'>",
"and c.id = #{customerId}",
"</when>",
"<when test = 'UserId != null'>",
"and c.customer_service = #{UserId} and is_in_open_sea=0",
"</when>",
"order by cc.update_time desc ",
"</script>"
})
//lanbm 2024-05-22 过滤客户经理函数
IPage<CustomerContactsDto> selectBySearchKey2(IPage page,
@Param("searchKey") String searchKey,
@Param("type") String type,
@Param("ids") Collection<Long> ids,
@Param("customerId") Long customerId,
@Param("UserId") Long UserId);
}
......@@ -82,4 +82,7 @@ public class CustomerContactsDto {
@ApiModelProperty(value = "是否公海客户")
private Boolean isInOpenSea;
}
......@@ -109,6 +109,15 @@ public interface CustomerContactsService extends IService<CustomerContactsDO> {
*/
PageResult<CustomerContactsDto> selectBySearchKey(String searchKey, String type, Collection<Long> ids, Long customerId, PageParam page);
/*
lanbm 2024-05-23 添加的客户选择函数
*/
PageResult<CustomerContactsDto> selectBySearchKey2(
String searchKey, String type, Collection<Long> ids,
Long customerId, PageParam page, Long UserId);
/**
* 根据客户ID更新EMAIL和公司名称
......
......@@ -148,7 +148,24 @@ public class CustomerContactsServiceImpl extends AbstractService<CustomerContact
@Override
public PageResult<CustomerContactsDto> selectBySearchKey(String searchKey, String type, Collection<Long> ids, Long customerId, PageParam page) {
IPage<CustomerContactsDto> mpPage = MyBatisUtils.buildPage(page);
customerContactsMapper.selectBySearchKey(mpPage, searchKey, type, ids, customerId);
customerContactsMapper.selectBySearchKey(mpPage, searchKey,
type, ids, customerId);
return PageResult.of(mpPage);
}
@Override
public PageResult<CustomerContactsDto> selectBySearchKey2(
String searchKey,
String type,
Collection<Long> ids,
Long customerId,
PageParam page,
Long UserId) {
IPage<CustomerContactsDto> mpPage = MyBatisUtils.buildPage(page);
customerContactsMapper.selectBySearchKey2(mpPage, searchKey,
type, ids, customerId,UserId);
return PageResult.of(mpPage);
}
......
......@@ -6,6 +6,7 @@ import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.excel.util.ExcelUtils;
import cn.iocoder.yudao.framework.operatelog.core.annotations.OperateLog;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.customer.convert.customerContacts.CustomerContactsConvert;
import cn.iocoder.yudao.module.customer.dal.dataobject.customer.CustomerDO;
import cn.iocoder.yudao.module.customer.dal.dataobject.customerContacts.CustomerContactsDO;
......@@ -139,12 +140,21 @@ public class CustomerContactsController {
@ApiImplicitParam(name = "ids", value = "编号列表", example = "1024,2048", dataTypeClass = List.class),
@ApiImplicitParam(name = "customerId", value = "客户ID", example = "1024", dataTypeClass = Long.class)
})
public CommonResult<PageResult<CustomerContactsDto>> selectBySearchKey(@RequestParam(value = "searchKey", required = false) String searchKey,
@RequestParam(value = "type", required = false) String type,
@RequestParam(value = "ids", required = false) Collection<Long> ids,
@RequestParam(value = "customerId", required = false) Long customerId
public CommonResult<PageResult<CustomerContactsDto>> selectBySearchKey(
@RequestParam(value = "searchKey", required = false) String searchKey,
@RequestParam(value = "type", required = false) String type,
@RequestParam(value = "ids", required = false) Collection<Long> ids,
@RequestParam(value = "customerId", required = false) Long customerId
, PageParam page) {
return success(customerContactsService.selectBySearchKey(searchKey, type, ids, customerId, page));
//lanbm 2024-05-22修改报价单联系人选择
/*
return success(customerContactsService.selectBySearchKey(searchKey,
type, ids, customerId, page));*/
//当前用户ID
Long loginUserId = SecurityFrameworkUtils.getLoginUserId();
return success(customerContactsService.selectBySearchKey2(searchKey,
type, ids, customerId, page,loginUserId));
}
}
......@@ -950,6 +950,7 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
boxAirCheckoutBackVO.setOperator(getUserName(boxAirCheckoutDO.getCreator()));
boxBackVO.setRealNum(boxAirCheckoutDO.getRealNum());
}
//lanbm 2024-05-22
boxBackVO.setPlanNum(getPlanNum(id));
boxBackVO.setRealNum(getRealNum(id));
......@@ -1437,22 +1438,39 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
return boxBackVO;
}
/*
获取计划数
*/
public Integer getPlanNum(Long id) {
int planNum = 0;
List<BoxMergePkgDO> boxMergePkgDOS = boxMergePkgService.selectList(BoxMergePkgDO::getShipmentId, id);
List<BoxPreloadGoodsDO> boxPreloadGoodsDOS = boxPreloadGoodsService.selectList(new LambdaQueryWrapperX<BoxPreloadGoodsDO>().eq(BoxPreloadGoodsDO::getShipmentId, id).eq(BoxPreloadGoodsDO::getIsRemove, 0));
List<Long> preloadOrderIds = boxPreloadGoodsDOS.stream().map(BoxPreloadGoodsDO::getOrderId).distinct().collect(Collectors.toList());
//ecw_box_merge_pkg 合包箱表
List<BoxMergePkgDO> boxMergePkgDOS =
boxMergePkgService.selectList(BoxMergePkgDO::getShipmentId, id);
//预装货物 ecw_box_preload_goods
List<BoxPreloadGoodsDO> boxPreloadGoodsDOS =
boxPreloadGoodsService.selectList(
new LambdaQueryWrapperX<BoxPreloadGoodsDO>().eq(BoxPreloadGoodsDO::getShipmentId, id).eq(BoxPreloadGoodsDO::getIsRemove, 0));
List<Long> preloadOrderIds =
boxPreloadGoodsDOS.stream().map(BoxPreloadGoodsDO::getOrderId).distinct().collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(boxMergePkgDOS)) {
List<Long> pkgIds = boxMergePkgDOS.stream().map(BoxMergePkgDO::getId).collect(Collectors.toList());
List<BoxPkgOrderDO> boxPkgOrderDOS = boxPkgOrderService.selectList(BoxPkgOrderDO::getPkgId, pkgIds);
List<Long> pkgIds = boxMergePkgDOS.stream().
map(BoxMergePkgDO::getId).collect(Collectors.toList());
List<BoxPkgOrderDO> boxPkgOrderDOS =
boxPkgOrderService.selectList(BoxPkgOrderDO::getPkgId, pkgIds);
if (CollectionUtil.isNotEmpty(boxPkgOrderDOS)) {
List<Long> pkgOrderIds = boxPkgOrderDOS.stream().map(BoxPkgOrderDO::getOrderId).collect(Collectors.toList());
List<Long> pkgOrderIds =
boxPkgOrderDOS.stream().map(BoxPkgOrderDO::getOrderId).collect(Collectors.toList());
preloadOrderIds.removeAll(pkgOrderIds);
}
planNum = planNum + boxMergePkgDOS.size();
}
if (CollectionUtil.isNotEmpty(preloadOrderIds)) {
List<OrderDO> orderDOS = orderService.selectList(OrderDO::getOrderId, preloadOrderIds);
List<OrderDO> orderDOS =
orderService.selectList(OrderDO::getOrderId, preloadOrderIds);
planNum = planNum + orderDOS.stream().mapToInt(OrderDO::getSumNum).sum();
}
return planNum;
......@@ -5058,11 +5076,18 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
orderService.finishOrderSortingReverseReviewUnlock(null, orderIds);
}
/*
获取实际数
*/
@Override
public Integer getRealNum(Long shipmentId) {
int realNum = 0;
List<BoxMergePkgDO> boxMergePkgDOS = boxMergePkgService.selectList(BoxMergePkgDO::getShipmentId, shipmentId);
List<BoxPreloadGoodsDO> boxPreloadGoodsDOS = boxPreloadGoodsService.selectList(new LambdaQueryWrapperX<BoxPreloadGoodsDO>().eq(BoxPreloadGoodsDO::getShipmentId, shipmentId).eq(BoxPreloadGoodsDO::getIsRemove, 0));
List<BoxMergePkgDO> boxMergePkgDOS =
boxMergePkgService.selectList(BoxMergePkgDO::getShipmentId, shipmentId);
List<BoxPreloadGoodsDO> boxPreloadGoodsDOS =
boxPreloadGoodsService.selectList(
new LambdaQueryWrapperX<BoxPreloadGoodsDO>().eq(BoxPreloadGoodsDO::getShipmentId, shipmentId).eq(BoxPreloadGoodsDO::getIsRemove, 0));
List<Long> preloadOrderIds = boxPreloadGoodsDOS.stream().map(BoxPreloadGoodsDO::getOrderId).distinct().collect(Collectors.toList());
if (CollectionUtil.isNotEmpty(boxMergePkgDOS)) {
for (BoxMergePkgDO boxMergePkgDO : boxMergePkgDOS) {
......@@ -5086,10 +5111,12 @@ public class BoxServiceImpl extends AbstractService<BoxMapper, BoxDO> implements
}
if (CollectionUtil.isNotEmpty(preloadOrderIds)) {
Long notInMergeOrderCount = boxLoadInfoService.selectCount(new LambdaQueryWrapperX<BoxLoadInfoDO>()
.eq(BoxLoadInfoDO::getShipmentId, shipmentId)
.in(BoxLoadInfoDO::getOrderId, preloadOrderIds)
);
Long notInMergeOrderCount =
boxLoadInfoService.selectCount(
new LambdaQueryWrapperX<BoxLoadInfoDO>()
.eq(BoxLoadInfoDO::getShipmentId, shipmentId)
.in(BoxLoadInfoDO::getOrderId, preloadOrderIds)
);
realNum = realNum + (notInMergeOrderCount == null ? 0 : notInMergeOrderCount.intValue());
}
return realNum;
......
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