Browse Source

Merge remote-tracking branch 'origin/新增商家端' into 新增商家端

# Conflicts:
#	blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java
#	blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java
#	blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java
master
pref_mail@163.com 8 months ago
parent
commit
1d469902f9
  1. 3
      blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java
  2. 7
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java
  3. 8
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml
  4. 63
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java
  5. 11
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java
  6. 6
      blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java

3
blade-service-api/logpm-business-conversion-api/src/main/java/com/logpm/business/entity/DistributionBusinessPreOrderEntity.java

@ -267,6 +267,9 @@ public class DistributionBusinessPreOrderEntity extends TenantEntity {
@ApiModelProperty(value = "配送车次号") @ApiModelProperty(value = "配送车次号")
private String distrCarNumber; private String distrCarNumber;
@ApiModelProperty(value = "预约单号")
private String reservationCode;
@ApiModelProperty(value = "是否入库 0 没有入库 1 已入库") @ApiModelProperty(value = "是否入库 0 没有入库 1 已入库")
private Integer inWarehouse;// private Integer inWarehouse;//

7
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.java

@ -51,5 +51,12 @@ public interface DistributionBusinessPreOrderMapper extends BaseMapper<Distribut
*/ */
IPage<DistributionBusinessPreOrderVO> pageList(IPage<DistributionBusinessPreOrderVO> page, DistributionBusinessPreOrderDTO param); IPage<DistributionBusinessPreOrderVO> pageList(IPage<DistributionBusinessPreOrderVO> page, DistributionBusinessPreOrderDTO param);
/**
* 删除商家端数据
* @param k
* @param deletedPackageList
* @return
*/
Integer deleteBusinessPreOrder(String reservationCode, List<String> deletedPackageList);
List<DistributionBusinessPreOrderEntity> list(@Param("queryrderDTO") BusinessPreListDTO queryrderDTO); List<DistributionBusinessPreOrderEntity> list(@Param("queryrderDTO") BusinessPreListDTO queryrderDTO);
} }

8
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/mapper/DistributionBusinessPreOrderMapper.xml

@ -1,6 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.logpm.distribution.mapper.DistributionBusinessPreOrderMapper"> <mapper namespace="com.logpm.distribution.mapper.DistributionBusinessPreOrderMapper">
<delete id="deleteBusinessPreOrder">
DELETE FROM logpm_business_pre_order WHERE reservation_code = #{reservationCode}
AND order_package_code IN
<foreach
collection="orderPackageList" item="orderPackageCode" open="(" separator="," close=")">
#{orderPackageCode}
</foreach>
</delete>
<select id="pageList" resultType="com.logpm.business.vo.DistributionBusinessPreOrderVO"> <select id="pageList" resultType="com.logpm.business.vo.DistributionBusinessPreOrderVO">

63
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/receiver/BusinessPreOrderDataQueueHandler.java

@ -2,6 +2,7 @@ package com.logpm.distribution.receiver;
import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder; import com.baomidou.dynamic.datasource.toolkit.DynamicDataSourceContextHolder;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.logpm.business.entity.DistributionBusinessPreOrderEntity; import com.logpm.business.entity.DistributionBusinessPreOrderEntity;
import com.logpm.distribution.entity.DistributionDeliveryListEntity; import com.logpm.distribution.entity.DistributionDeliveryListEntity;
import com.logpm.distribution.entity.DistributionParcelListEntity; import com.logpm.distribution.entity.DistributionParcelListEntity;
@ -14,6 +15,7 @@ import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.RabbitConstant; import org.springblade.common.constant.RabbitConstant;
import org.springblade.core.tool.api.R; import org.springblade.core.tool.api.R;
import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.BeanUtil;
import org.springblade.core.tool.utils.Func;
import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.ObjectUtil;
import org.springblade.system.entity.Tenant; import org.springblade.system.entity.Tenant;
import org.springblade.system.feign.ISysClient; import org.springblade.system.feign.ISysClient;
@ -25,6 +27,8 @@ import org.springframework.stereotype.Component;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
@Slf4j @Slf4j
@RabbitListener(queues = RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_QUEUE) @RabbitListener(queues = RabbitConstant.BUSINESS_PRE_CONVERSION_DATA_QUEUE)
@ -114,7 +118,7 @@ public class BusinessPreOrderDataQueueHandler {
} }
public void saveOtherDataBase(List<DistributionBusinessPreOrderEntity> dataResult, String maillName) { public void saveOtherDataBase(List<DistributionBusinessPreOrderEntity> dataResult, String maillName) {
String method = "########################saveOtherDataBase";
R<Tenant> tenantByName = sysClient.getTenantByName(maillName); R<Tenant> tenantByName = sysClient.getTenantByName(maillName);
if(tenantByName.isSuccess()){ if(tenantByName.isSuccess()){
Tenant tenant = tenantByName.getData(); Tenant tenant = tenantByName.getData();
@ -122,19 +126,58 @@ public class BusinessPreOrderDataQueueHandler {
log.info(">>>>>>>>>>>>> BusinessPreOrderDataQueueHandler 租户不存在"); log.info(">>>>>>>>>>>>> BusinessPreOrderDataQueueHandler 租户不存在");
return; return;
} }
if (dataResult.isEmpty()) {
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : dataResult) { log.info(method+"dataResult 参数错误");
distributionBusinessPreOrderEntity.setTenantId(tenant.getTenantId());
} }
DynamicDataSourceContextHolder.push(tenant.getTenantId()); DynamicDataSourceContextHolder.push(tenant.getTenantId());
Map<Integer, List<DistributionBusinessPreOrderEntity>> map = dataResult.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getInWarehouse));
List<DistributionBusinessPreOrderEntity> list = distributionBusinessPreOrderService.list(); if (Func.isNotEmpty(map.get(1))){
//存在需要进行删除的数据
distributionBusinessPreOrderService.saveBatch(dataResult); List<DistributionBusinessPreOrderEntity> deleteList = map.get(1);
if (!deleteList.isEmpty()) {
Map<String, List<DistributionBusinessPreOrderEntity>> deletedMap = deleteList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode));
deletedMap.forEach((k,v)->{
List<String> deletedPackageList = v.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList());
log.info("删除商家端数据>>>>reservationCode:{}",deletedPackageList);
if (!deletedPackageList.isEmpty()){
//进行删除
Integer row = distributionBusinessPreOrderService.deleteBusinessPreOrder(k,deletedPackageList);
log.info("删除商家端数据>>>>row:{}",row);
}
});
}
}
if (Func.isNotEmpty(map.get(2))){
//存在可能变更的数据
List<DistributionBusinessPreOrderEntity> mapList = map.get(2);
Map<String, List<DistributionBusinessPreOrderEntity>> saveData = mapList.stream().collect(Collectors.groupingBy(DistributionBusinessPreOrderEntity::getReservationCode));
List<DistributionBusinessPreOrderEntity> existData= new ArrayList<>();
if (!saveData.isEmpty()) {
//查询是否存在重复
saveData.forEach((k,v)->{
List<DistributionBusinessPreOrderEntity> list = distributionBusinessPreOrderService.list(Wrappers.<DistributionBusinessPreOrderEntity>query().lambda()
.eq(DistributionBusinessPreOrderEntity::getReservationCode, k)
.in(DistributionBusinessPreOrderEntity::getOrderPackageCode, v.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList()))
);
if (!list.isEmpty()) {
//已经存在数据
existData.addAll(list);
}
});
}
if (!existData.isEmpty()){
//二者比较取差集
mapList = mapList.stream().filter(m -> !existData.stream().map(DistributionBusinessPreOrderEntity::getOrderPackageCode).collect(Collectors.toList()).contains(m.getOrderPackageCode())).collect(Collectors.toList());
}
if (!mapList.isEmpty()){
for (DistributionBusinessPreOrderEntity distributionBusinessPreOrderEntity : mapList) {
distributionBusinessPreOrderEntity.setTenantId(tenant.getTenantId());
}
distributionBusinessPreOrderService.saveBatch(mapList);
}
}
DynamicDataSourceContextHolder.poll(); DynamicDataSourceContextHolder.poll();
} }

11
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/IDistributionBusinessPreOrderService.java

@ -22,12 +22,19 @@ public interface IDistributionBusinessPreOrderService extends BaseService<Distri
/** /**
* 查询DistributionBusinessPreOrder列表 * 查询DistributionBusinessPreOrder列表
* @param distributionBusinessPreOrderEntity * @param distributionBusinessPreOrderDTO
* @param query * @param page
* @return * @return
*/ */
IPage<DistributionBusinessPreOrderVO> pacgeList(Map<String, Object> distributionBusinessPreOrderDTO, IPage<DistributionBusinessPreOrderVO> page); IPage<DistributionBusinessPreOrderVO> pacgeList(Map<String, Object> distributionBusinessPreOrderDTO, IPage<DistributionBusinessPreOrderVO> page);
/**
* 删除商家端数据
* @param k
* @param deletedPackageList
* @return
*/
Integer deleteBusinessPreOrder(String k, List<String> deletedPackageList);
List<DistributionBusinessPreOrderVO> list(BusinessPreListDTO queryrderDTO); List<DistributionBusinessPreOrderVO> list(BusinessPreListDTO queryrderDTO);
} }

6
blade-service/logpm-distribution/src/main/java/com/logpm/distribution/service/impl/IDistributionBusinessPreOrderServiceImpl.java

@ -40,6 +40,12 @@ public class IDistributionBusinessPreOrderServiceImpl extends BaseServiceImpl<Di
return baseMapper.pageList(page,param); return baseMapper.pageList(page,param);
} }
@Override
public Integer deleteBusinessPreOrder(String k, List<String> deletedPackageList) {
return baseMapper.deleteBusinessPreOrder(k,deletedPackageList);
}
/** /**

Loading…
Cancel
Save