|
@@ -21,6 +21,7 @@ import com.abi.qms.platform.service.QrPackageService;
|
|
|
import com.abi.task.common.api.exception.BusinessException;
|
|
|
import com.abi.task.common.tablestore.TableStorePlusUtils;
|
|
|
import com.abi.task.common.tablestore.common.TableStoreEntity;
|
|
|
+import com.abi.task.common.utils.PojoConverterUtils;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
import com.baomidou.mybatisplus.core.toolkit.IdWorker;
|
|
|
import com.rabbitmq.client.Channel;
|
|
@@ -327,27 +328,19 @@ public class GenerateCodeConsumer {
|
|
|
* 批量新增tableStore,码表
|
|
|
*/
|
|
|
private void saveTableStore(QrPackageBatch qrPackageBatch, List<QrData> codeList) {
|
|
|
- List<TableStoreEntity> codeSave = new ArrayList<>();
|
|
|
- for (QrData qrData:codeList) {
|
|
|
- List<QrInnerData> innerDataList = qrData.getInnerDataList();
|
|
|
- for (QrInnerData qrInnerData:innerDataList) {
|
|
|
- QrCode qrCode = new QrCode();
|
|
|
- //码
|
|
|
- qrCode.setCode(qrInnerData.getCode());
|
|
|
- //批次id
|
|
|
- qrCode.setBatchNumberId(qrPackageBatch.getId());
|
|
|
- //码包id
|
|
|
- qrCode.setPackageId(qrPackageBatch.getPackageId());
|
|
|
- //创建时间
|
|
|
- qrCode.setCreateTime(LocalDateTime.now());
|
|
|
- //已生成码包位置
|
|
|
- qrCode.setCodeIndex(qrInnerData.getCodeIndex());
|
|
|
- //生成码库列id
|
|
|
- qrCode.setQrRepertoryColumnId(qrInnerData.getQrRepertoryColumnId());
|
|
|
- codeSave.add(qrCode);
|
|
|
- }
|
|
|
- }
|
|
|
- tableStorePlusUtils.putRow(codeSave);
|
|
|
+ List<TableStoreEntity> qrCodes = new ArrayList<>();
|
|
|
+ codeList.forEach(sout-> {
|
|
|
+ List<QrInnerData> innerDataList = sout.getInnerDataList();
|
|
|
+ List<QrCode> qrCodeCope = PojoConverterUtils.copyList(innerDataList, QrCode.class);
|
|
|
+ // 批次号 码包
|
|
|
+ qrCodeCope.forEach(stable->{
|
|
|
+ stable.setBatchNumberId(qrPackageBatch.getId());
|
|
|
+ stable.setPackageId(qrPackageBatch.getPackageId());
|
|
|
+ stable.setCreateTime(LocalDateTime.now());
|
|
|
+ });
|
|
|
+ qrCodes.addAll(qrCodeCope);
|
|
|
+ });
|
|
|
+ tableStorePlusUtils.putRow(qrCodes);
|
|
|
}
|
|
|
|
|
|
/**
|