50 changed files with 968 additions and 479 deletions
@ -0,0 +1,8 @@ |
|||||||
|
package com.logpm.trunkline.service; |
||||||
|
|
||||||
|
public interface IAdvanceOrderMqService { |
||||||
|
|
||||||
|
void advanceOrder(String msg); |
||||||
|
|
||||||
|
void advanceOrderOuPai(String msg); |
||||||
|
} |
@ -0,0 +1,360 @@ |
|||||||
|
package com.logpm.trunkline.service.impl; |
||||||
|
|
||||||
|
import cn.hutool.core.collection.CollUtil; |
||||||
|
import cn.hutool.core.convert.Convert; |
||||||
|
import cn.hutool.core.date.DateUtil; |
||||||
|
import cn.hutool.core.util.ObjectUtil; |
||||||
|
import cn.hutool.core.util.StrUtil; |
||||||
|
import cn.hutool.json.JSONArray; |
||||||
|
import cn.hutool.json.JSONObject; |
||||||
|
import cn.hutool.json.JSONUtil; |
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
||||||
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
||||||
|
import com.logpm.distribution.entity.DistributionParcelListEntity; |
||||||
|
import com.logpm.distribution.feign.IDistributionParcelListClient; |
||||||
|
import com.logpm.distribution.feign.IDistributionStockArticleClient; |
||||||
|
import com.logpm.factorydata.enums.BrandEnums; |
||||||
|
import com.logpm.trunkline.entity.TrunklineAdvanceDetailEntity; |
||||||
|
import com.logpm.trunkline.entity.TrunklineAdvanceEntity; |
||||||
|
import com.logpm.trunkline.entity.TrunklineDetailProductEntity; |
||||||
|
import com.logpm.trunkline.service.IAdvanceOrderMqService; |
||||||
|
import com.logpm.trunkline.service.ITrunklineAdvanceDetailService; |
||||||
|
import com.logpm.trunkline.service.ITrunklineAdvanceService; |
||||||
|
import com.logpm.trunkline.service.ITrunklineCarsLoadService; |
||||||
|
import com.logpm.trunkline.service.ITrunklineDetailProductService; |
||||||
|
import lombok.AllArgsConstructor; |
||||||
|
import lombok.extern.slf4j.Slf4j; |
||||||
|
import org.springblade.core.secure.utils.AuthUtil; |
||||||
|
import org.springframework.stereotype.Service; |
||||||
|
import org.springframework.transaction.annotation.Transactional; |
||||||
|
|
||||||
|
import java.util.ArrayList; |
||||||
|
import java.util.Date; |
||||||
|
import java.util.HashMap; |
||||||
|
import java.util.HashSet; |
||||||
|
import java.util.List; |
||||||
|
import java.util.Map; |
||||||
|
import java.util.Set; |
||||||
|
|
||||||
|
@Service |
||||||
|
@Slf4j |
||||||
|
@AllArgsConstructor |
||||||
|
public class AdvanceOrderMqServiceImpl implements IAdvanceOrderMqService { |
||||||
|
|
||||||
|
private final ITrunklineAdvanceService advanceService; |
||||||
|
private final ITrunklineAdvanceDetailService advanceDetailService; |
||||||
|
private final ITrunklineDetailProductService detailProductService; |
||||||
|
private final ITrunklineCarsLoadService trunklineCarsLoadService; |
||||||
|
private final IDistributionStockArticleClient stockArticleClient; |
||||||
|
private final IDistributionParcelListClient parcelListClient; |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public void advanceOrder(String msg) { |
||||||
|
if (StrUtil.isNotBlank(msg)) { |
||||||
|
JSONObject entries = JSONUtil.parseObj(msg); |
||||||
|
JSONArray details = entries.getJSONArray("details"); |
||||||
|
TrunklineAdvanceEntity advanceEntity = JSONUtil.toBean(entries, TrunklineAdvanceEntity.class); |
||||||
|
LambdaQueryWrapper<TrunklineAdvanceEntity> eq = Wrappers.<TrunklineAdvanceEntity>lambdaQuery() |
||||||
|
.eq(TrunklineAdvanceEntity::getOrderCode, advanceEntity.getOrderCode()); |
||||||
|
if (StrUtil.isNotEmpty(advanceEntity.getTrainNumber())) { |
||||||
|
eq.eq(TrunklineAdvanceEntity::getTrainNumber, advanceEntity.getTrainNumber()); |
||||||
|
} |
||||||
|
// 暂存单 订单自编号 + 车次号 唯一
|
||||||
|
List<TrunklineAdvanceEntity> advanceEntities = advanceService.list(eq); |
||||||
|
|
||||||
|
// 暂存单存在 并且未开单 则将新数据添加到原来的暂存单上
|
||||||
|
// 如果已开单则新增暂存单
|
||||||
|
if (CollUtil.isNotEmpty(advanceEntities) && ObjectUtil.equal(advanceEntity.getWaybillStatus(), "0")) { |
||||||
|
TrunklineAdvanceEntity entity = advanceEntities.get(0); |
||||||
|
if (ObjectUtil.isNotEmpty(entity)) { |
||||||
|
advanceEntity.setId(entity.getId()); |
||||||
|
// advanceEntity.setTotalNum(entity.getTotalNum() + advanceEntity.getTotalNum());
|
||||||
|
} |
||||||
|
} |
||||||
|
Set<String> packageCodeSet = new HashSet<>(); |
||||||
|
if (CollUtil.isNotEmpty(details)) { |
||||||
|
// 使用HashSet代替ArrayList以优化内存使用和检查重复值
|
||||||
|
Set<String> orderPackageCodes = new HashSet<>(); |
||||||
|
details.forEach(detail -> { |
||||||
|
try { |
||||||
|
// 更具描述性的变量命名
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(detail); |
||||||
|
TrunklineAdvanceDetailEntity entity = JSONUtil.toBean(jsonObject, TrunklineAdvanceDetailEntity.class); |
||||||
|
// 检查转换后的实体不为null,且其orderPackageCode非null
|
||||||
|
if (!ObjectUtil.isAllEmpty(entity, entity.getOrderPackageCode())) { |
||||||
|
orderPackageCodes.add(entity.getOrderPackageCode()); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
// 异常处理,可根据实际情况记录日志或进行其他处理
|
||||||
|
log.error("暂存单转换时发生异常: " + detail + ",异常:" + e.getMessage()); |
||||||
|
} |
||||||
|
}); |
||||||
|
// 查询数据库,校验订单包件编码是否重复
|
||||||
|
if (CollUtil.isNotEmpty(orderPackageCodes)) { |
||||||
|
Map<String, String> packageCodeByCodes = advanceDetailService.findPackageCodeByCodes(orderPackageCodes); |
||||||
|
if (CollUtil.isNotEmpty(packageCodeByCodes)) { |
||||||
|
packageCodeSet.addAll(packageCodeByCodes.keySet()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
if (ObjectUtil.isNotNull(advanceEntity)) { |
||||||
|
String orderCode = advanceEntity.getOrderCode(); |
||||||
|
if (StrUtil.isNotEmpty(orderCode) && orderCode.contains("遗")) { |
||||||
|
advanceEntity.setLegacyStatus("1"); |
||||||
|
} |
||||||
|
// 暂存单不存在则新增,暂存单存在则将暂存单明细往原暂存单中添加
|
||||||
|
if (ObjectUtil.isEmpty(advanceEntity.getId())) { |
||||||
|
advanceEntity.setCreateUserName(AuthUtil.getNickName()); |
||||||
|
advanceService.save(advanceEntity); |
||||||
|
} else { |
||||||
|
advanceService.updateById(advanceEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
if (ObjectUtil.isNotEmpty(advanceEntity) && CollUtil.isNotEmpty(details)) { |
||||||
|
List<TrunklineAdvanceDetailEntity> advanceDetailEntityList = new ArrayList<>(); |
||||||
|
List<TrunklineDetailProductEntity> detailProductEntityList = new ArrayList<>(); |
||||||
|
for (Object detailObj : details) { |
||||||
|
JSONObject detail = JSONUtil.parseObj(detailObj); |
||||||
|
TrunklineAdvanceDetailEntity advanceDetailEntity = JSONUtil.toBean(detail, TrunklineAdvanceDetailEntity.class); |
||||||
|
if (ObjectUtil.isNotNull(advanceDetailEntity)) { |
||||||
|
if (CollUtil.isNotEmpty(packageCodeSet) && packageCodeSet.contains(advanceDetailEntity.getOrderPackageCode())) { |
||||||
|
// 金牌如果是重复包条,则单独处理
|
||||||
|
if (ObjectUtil.equal(advanceEntity.getBrand(), BrandEnums.JP.getValue())) { |
||||||
|
// 金牌按DD单号+包条确定唯一值
|
||||||
|
List<TrunklineAdvanceDetailEntity> list = advanceDetailService.list(Wrappers.<TrunklineAdvanceDetailEntity>lambdaQuery() |
||||||
|
.eq(TrunklineAdvanceDetailEntity::getOrderPackageCode, advanceDetailEntity.getOrderPackageCode()) |
||||||
|
.eq(TrunklineAdvanceDetailEntity::getOrderCode, advanceEntity.getOrderCode()) |
||||||
|
); |
||||||
|
if (CollUtil.isNotEmpty(list)) { |
||||||
|
// 订单+包件重复则不处理这条数据
|
||||||
|
log.error("金牌,订单+包条码重复,订单:{},包条码:{}", advanceEntity.getOrderCode(), advanceDetailEntity.getOrderPackageCode()); |
||||||
|
continue; |
||||||
|
} else { |
||||||
|
// 包件码重复,订单+包件不重复,设置预留字段1 为 1
|
||||||
|
advanceDetailEntity.setReserve1("1"); |
||||||
|
} |
||||||
|
} else { |
||||||
|
log.error("非金牌,包条码重复,包条码:{}", advanceDetailEntity.getOrderPackageCode()); |
||||||
|
continue; |
||||||
|
} |
||||||
|
} |
||||||
|
advanceDetailEntity.setAdvanceId(advanceEntity.getId()); |
||||||
|
// 设置发货时间为当前时间
|
||||||
|
if (StrUtil.isEmpty(advanceDetailEntity.getSendDateStr())) { |
||||||
|
advanceDetailEntity.setSendDateStr(DateUtil.today()); |
||||||
|
} |
||||||
|
advanceDetailEntityList.add(advanceDetailEntity); |
||||||
|
JSONArray items = detail.getJSONArray("items"); |
||||||
|
if (CollUtil.isNotEmpty(items)) { |
||||||
|
for (Object itemObj : items) { |
||||||
|
JSONObject item = JSONUtil.parseObj(itemObj); |
||||||
|
TrunklineDetailProductEntity detailProductEntity = JSONUtil.toBean(item, TrunklineDetailProductEntity.class); |
||||||
|
if (ObjectUtil.isNotNull(detailProductEntity)) { |
||||||
|
detailProductEntityList.add(detailProductEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
advanceDetailService.saveBatch(advanceDetailEntityList); |
||||||
|
// 发送入库包件处理无数据装车数据
|
||||||
|
trunklineCarsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(advanceEntity)); |
||||||
|
detailProductService.saveBatch(detailProductEntityList); |
||||||
|
|
||||||
|
// 发送报表数据广播
|
||||||
|
Long warehouseId = advanceEntity.getWarehouseId(); |
||||||
|
String warehouseName = advanceEntity.getWarehouseName(); |
||||||
|
String dealerCode = advanceEntity.getDealerCode(); |
||||||
|
String dealerName = advanceEntity.getDealerName(); |
||||||
|
advanceDetailService.sendReportBasicdataFanout(AuthUtil.getNickName(), AuthUtil.getUserId(), warehouseId, warehouseName, new Date(), advanceDetailEntityList, dealerCode, dealerName); |
||||||
|
|
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
@Override |
||||||
|
@Transactional(rollbackFor = Exception.class) |
||||||
|
public void advanceOrderOuPai(String msg) { |
||||||
|
if (StrUtil.isNotBlank(msg)) { |
||||||
|
JSONObject entries = JSONUtil.parseObj(msg); |
||||||
|
JSONArray details = entries.getJSONArray("details"); |
||||||
|
TrunklineAdvanceEntity advanceEntity = JSONUtil.toBean(entries, TrunklineAdvanceEntity.class); |
||||||
|
LambdaQueryWrapper<TrunklineAdvanceEntity> eq = Wrappers.<TrunklineAdvanceEntity>lambdaQuery() |
||||||
|
.eq(TrunklineAdvanceEntity::getOrderCode, advanceEntity.getOrderCode()); |
||||||
|
if (StrUtil.isNotEmpty(advanceEntity.getTrainNumber())) { |
||||||
|
eq.eq(TrunklineAdvanceEntity::getTrainNumber, advanceEntity.getTrainNumber()); |
||||||
|
} |
||||||
|
// 暂存单 订单自编号 + 车次号 唯一
|
||||||
|
List<TrunklineAdvanceEntity> advanceEntities = advanceService.list(eq); |
||||||
|
|
||||||
|
// 暂存单存在 并且未开单 则将新数据添加到原来的暂存单上
|
||||||
|
// 如果已开单则新增暂存单
|
||||||
|
// 订单 修改最终客户信息
|
||||||
|
if (CollUtil.isNotEmpty(advanceEntities)) { |
||||||
|
TrunklineAdvanceEntity entity = advanceEntities.get(0); |
||||||
|
if (ObjectUtil.isNotEmpty(entity)) { |
||||||
|
// 如果存在则只修改客户信息
|
||||||
|
if (StrUtil.isNotEmpty(advanceEntity.getCustomerName())) { |
||||||
|
entity.setCustomerName(advanceEntity.getCustomerName()); |
||||||
|
} |
||||||
|
if (StrUtil.isNotEmpty(advanceEntity.getCustomerAddress())) { |
||||||
|
entity.setCustomerAddress(advanceEntity.getCustomerAddress()); |
||||||
|
} |
||||||
|
if (StrUtil.isNotEmpty(advanceEntity.getCustomerPhone())) { |
||||||
|
entity.setCustomerPhone(advanceEntity.getCustomerPhone()); |
||||||
|
} |
||||||
|
advanceService.updateById(entity); |
||||||
|
// 修改在库订单信息 未预约的数据 reservation_status = 10 才更新
|
||||||
|
if (ObjectUtil.isAllNotEmpty(entity.getOrderCode(), advanceEntity.getCustomerName(), advanceEntity.getCustomerAddress(), advanceEntity.getCustomerPhone())) { |
||||||
|
try { |
||||||
|
JSONObject jsonObject = new JSONObject(); |
||||||
|
jsonObject.set("orderCode", entity.getOrderCode()); |
||||||
|
jsonObject.set("customerName", advanceEntity.getCustomerName()); |
||||||
|
jsonObject.set("customerAddress", advanceEntity.getCustomerAddress()); |
||||||
|
jsonObject.set("customerPhone", advanceEntity.getCustomerPhone()); |
||||||
|
stockArticleClient.updateCustomerAllByOrderCode(JSONUtil.toJsonStr(jsonObject)); |
||||||
|
} catch (Exception e) { |
||||||
|
log.error("更新在库订单失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
if (ObjectUtil.isNotNull(advanceEntity)) { |
||||||
|
String orderCode = advanceEntity.getOrderCode(); |
||||||
|
if (StrUtil.isNotEmpty(orderCode) && orderCode.contains("遗")) { |
||||||
|
advanceEntity.setLegacyStatus("1"); |
||||||
|
} |
||||||
|
// 暂存单不存在则新增,暂存单存在则将暂存单明细往原暂存单中添加
|
||||||
|
if (ObjectUtil.isEmpty(advanceEntity.getId())) { |
||||||
|
advanceEntity.setCreateUserName(AuthUtil.getNickName()); |
||||||
|
advanceService.save(advanceEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
Map<String, String> packageCodeMap = new HashMap<>(); |
||||||
|
Map<String, Set<String>> parcelListMap = new HashMap<>(); |
||||||
|
if (CollUtil.isNotEmpty(details)) { |
||||||
|
// 使用HashSet代替ArrayList以优化内存使用和检查重复值
|
||||||
|
Set<String> orderPackageCodes = new HashSet<>(); |
||||||
|
details.forEach(detail -> { |
||||||
|
try { |
||||||
|
// 更具描述性的变量命名
|
||||||
|
JSONObject jsonObject = JSONUtil.parseObj(detail); |
||||||
|
TrunklineAdvanceDetailEntity entity = JSONUtil.toBean(jsonObject, TrunklineAdvanceDetailEntity.class); |
||||||
|
// 检查转换后的实体不为null,且其orderPackageCode非null
|
||||||
|
if (!ObjectUtil.isAllEmpty(entity, entity.getOrderPackageCode())) { |
||||||
|
orderPackageCodes.add(entity.getOrderPackageCode()); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
// 异常处理,可根据实际情况记录日志或进行其他处理
|
||||||
|
log.error("暂存单转换时发生异常: " + detail + ",异常:" + e.getMessage()); |
||||||
|
} |
||||||
|
}); |
||||||
|
// 查询数据库,校验订单包件编码是否重复
|
||||||
|
if (CollUtil.isNotEmpty(orderPackageCodes)) { |
||||||
|
packageCodeMap = advanceDetailService.findPackageCodeByCodes(orderPackageCodes); |
||||||
|
try { |
||||||
|
if (CollUtil.isNotEmpty(packageCodeMap)) { |
||||||
|
parcelListMap = parcelListClient.findPackageCodeByCodes(packageCodeMap.keySet()); |
||||||
|
} |
||||||
|
} catch (Exception e) { |
||||||
|
log.error("查询包件表失败"); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
// 包件 修改 品类信息 物料名称
|
||||||
|
if (ObjectUtil.isNotEmpty(advanceEntity) && CollUtil.isNotEmpty(details)) { |
||||||
|
List<TrunklineAdvanceDetailEntity> advanceDetailEntityList = new ArrayList<>(); |
||||||
|
List<DistributionParcelListEntity> parcelListEntityList = new ArrayList<>(); |
||||||
|
List<TrunklineDetailProductEntity> detailProductEntityList = new ArrayList<>(); |
||||||
|
Set<String> productCodes = new HashSet<>(); |
||||||
|
for (Object detailObj : details) { |
||||||
|
JSONObject detail = JSONUtil.parseObj(detailObj); |
||||||
|
TrunklineAdvanceDetailEntity advanceDetailEntity = JSONUtil.toBean(detail, TrunklineAdvanceDetailEntity.class); |
||||||
|
if (ObjectUtil.isNotNull(advanceDetailEntity)) { |
||||||
|
if (CollUtil.isNotEmpty(packageCodeMap) && StrUtil.isNotEmpty(advanceDetailEntity.getOrderPackageCode()) |
||||||
|
&& packageCodeMap.containsKey(advanceDetailEntity.getOrderPackageCode())) { |
||||||
|
if (!ObjectUtil.isAllEmpty(advanceDetailEntity.getFirstPackName(), advanceDetailEntity.getSecondPackName(), |
||||||
|
advanceDetailEntity.getThirdPackName(), advanceDetailEntity.getMaterialName())) { |
||||||
|
TrunklineAdvanceDetailEntity updatedetailEntity = new TrunklineAdvanceDetailEntity(); |
||||||
|
updatedetailEntity.setId(Convert.toLong(packageCodeMap.get(advanceDetailEntity.getOrderPackageCode()))); |
||||||
|
updatedetailEntity.setFirstPackName(advanceDetailEntity.getFirstPackName()); |
||||||
|
updatedetailEntity.setFirstPackCode(advanceDetailEntity.getFirstPackCode()); |
||||||
|
updatedetailEntity.setSecondPackName(advanceDetailEntity.getSecondPackName()); |
||||||
|
updatedetailEntity.setSecondPackCode(advanceDetailEntity.getSecondPackCode()); |
||||||
|
updatedetailEntity.setThirdPackName(advanceDetailEntity.getThirdPackName()); |
||||||
|
updatedetailEntity.setThirdPackCode(advanceDetailEntity.getThirdPackCode()); |
||||||
|
updatedetailEntity.setMaterialName(advanceDetailEntity.getMaterialName()); |
||||||
|
updatedetailEntity.setMaterialCode(advanceDetailEntity.getMaterialCode()); |
||||||
|
advanceDetailEntityList.add(updatedetailEntity); |
||||||
|
} |
||||||
|
if (CollUtil.isNotEmpty(parcelListMap) && parcelListMap.containsKey(advanceDetailEntity.getOrderPackageCode())) { |
||||||
|
Set<String> strings = parcelListMap.get(advanceDetailEntity.getOrderPackageCode()); |
||||||
|
for (String string : strings) { |
||||||
|
DistributionParcelListEntity parcelListEntity = new DistributionParcelListEntity(); |
||||||
|
parcelListEntity.setId(Convert.toLong(string)); |
||||||
|
parcelListEntity.setFirsts(advanceDetailEntity.getFirstPackName()); |
||||||
|
parcelListEntity.setSecond(advanceDetailEntity.getSecondPackName()); |
||||||
|
parcelListEntity.setThirdProduct(advanceDetailEntity.getThirdPackName()); |
||||||
|
parcelListEntity.setMaterialName(advanceDetailEntity.getMaterialName()); |
||||||
|
parcelListEntity.setMaterialCode(advanceDetailEntity.getMaterialCode()); |
||||||
|
parcelListEntityList.add(parcelListEntity); |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
} else { |
||||||
|
advanceDetailEntity.setAdvanceId(advanceEntity.getId()); |
||||||
|
// 设置发货时间为当前时间
|
||||||
|
if (StrUtil.isEmpty(advanceDetailEntity.getSendDateStr())) { |
||||||
|
advanceDetailEntity.setSendDateStr(DateUtil.today()); |
||||||
|
} |
||||||
|
advanceDetailEntityList.add(advanceDetailEntity); |
||||||
|
} |
||||||
|
|
||||||
|
JSONArray items = detail.getJSONArray("items"); |
||||||
|
if (CollUtil.isNotEmpty(items)) { |
||||||
|
for (Object itemObj : items) { |
||||||
|
JSONObject item = JSONUtil.parseObj(itemObj); |
||||||
|
TrunklineDetailProductEntity detailProductEntity = JSONUtil.toBean(item, TrunklineDetailProductEntity.class); |
||||||
|
if (ObjectUtil.isNotNull(detailProductEntity)) { |
||||||
|
productCodes.add(detailProductEntity.getProductCode()); |
||||||
|
detailProductEntityList.add(detailProductEntity); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
||||||
|
if (CollUtil.isNotEmpty(parcelListEntityList)) { |
||||||
|
parcelListClient.saveorUpdateBatchByOP(parcelListEntityList); |
||||||
|
} |
||||||
|
if (CollUtil.isNotEmpty(advanceDetailEntityList)) { |
||||||
|
advanceDetailService.saveOrUpdateBatch(advanceDetailEntityList); |
||||||
|
} |
||||||
|
// 发送入库包件处理无数据装车数据
|
||||||
|
trunklineCarsLoadService.sendRabbitMessageLoadScanData(JSONUtil.toJsonStr(advanceEntity)); |
||||||
|
if (CollUtil.isNotEmpty(detailProductEntityList)) { |
||||||
|
if (ObjectUtil.isAllNotEmpty(packageCodeMap, productCodes)) { |
||||||
|
List<TrunklineDetailProductEntity> list = detailProductService.list(Wrappers.<TrunklineDetailProductEntity>lambdaQuery() |
||||||
|
.in(TrunklineDetailProductEntity::getUnitNo, packageCodeMap.keySet()) |
||||||
|
.in(TrunklineDetailProductEntity::getProductCode, productCodes) |
||||||
|
); |
||||||
|
if (CollUtil.isNotEmpty(list)) { |
||||||
|
for (TrunklineDetailProductEntity productEntity : detailProductEntityList) { |
||||||
|
for (TrunklineDetailProductEntity detailProductEntity : list) { |
||||||
|
if (ObjectUtil.equal(productEntity.getProductCode(), detailProductEntity.getProductCode())) { |
||||||
|
productEntity.setId(detailProductEntity.getId()); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
detailProductService.saveOrUpdateBatch(detailProductEntityList); |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
} |
||||||
|
|
||||||
|
} |
@ -0,0 +1,12 @@ |
|||||||
|
local key = KEYS[1] |
||||||
|
local value = ARGV[1] |
||||||
|
local expireTime = tonumber(ARGV[2]) |
||||||
|
|
||||||
|
local exists = redis.call("EXISTS", key) |
||||||
|
|
||||||
|
if exists == 1 then |
||||||
|
return 1 |
||||||
|
end |
||||||
|
|
||||||
|
redis.call("SETEX", key, expireTime, value) |
||||||
|
return 0 |
Loading…
Reference in new issue