mirror of https://github.com/jeecgboot/jeecg-boot
Merge pull request #142 from LQYBill/fix/skuWeightMongoUpdate
fix : sku weight mongo updatepull/8040/head
commit
69662b4c49
|
@ -8,6 +8,7 @@ import org.codehaus.jettison.json.JSONObject;
|
|||
import org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.*;
|
||||
import org.jeecg.modules.business.domain.api.mabang.doSearchSkuListNew.SkuData;
|
||||
import org.jeecg.modules.business.entity.*;
|
||||
import org.jeecg.modules.business.mongoService.SkuMongoService;
|
||||
import org.jeecg.modules.business.service.*;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
|
@ -39,8 +40,6 @@ public class MabangSkuJob implements Job {
|
|||
@Setter
|
||||
private ISkuListMabangService skuListMabangService;
|
||||
@Autowired
|
||||
private MigrationService migrationService;
|
||||
@Autowired
|
||||
private EmailService emailService;
|
||||
@Autowired
|
||||
private FreeMarkerConfigurer freemarkerConfigurer;
|
||||
|
@ -48,6 +47,8 @@ public class MabangSkuJob implements Job {
|
|||
Environment env;
|
||||
private static final Integer DEFAULT_NUMBER_OF_DAYS = 5;
|
||||
private static final DateType DEFAULT_DATE_TYPE = DateType.CREATE;
|
||||
@Autowired
|
||||
private SkuMongoService skuMongoService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
@ -114,7 +115,7 @@ public class MabangSkuJob implements Job {
|
|||
// mongo sync after transaction
|
||||
for(Sku sku : newSkusMap.keySet()) {
|
||||
try {
|
||||
migrationService.migrateOneSku(sku);
|
||||
skuMongoService.migrateOneSku(sku);
|
||||
} catch (Exception e) {
|
||||
log.error("Error while migrating skuId: {}", sku.getId());
|
||||
log.error(e.getMessage());
|
||||
|
|
|
@ -4,8 +4,8 @@ import lombok.extern.slf4j.Slf4j;
|
|||
import org.codehaus.jettison.json.JSONException;
|
||||
import org.codehaus.jettison.json.JSONObject;
|
||||
import org.jeecg.modules.business.entity.Sku;
|
||||
import org.jeecg.modules.business.mongoService.SkuMongoService;
|
||||
import org.jeecg.modules.business.service.ISkuService;
|
||||
import org.jeecg.modules.business.service.MigrationService;
|
||||
import org.quartz.Job;
|
||||
import org.quartz.JobDataMap;
|
||||
import org.quartz.JobExecutionContext;
|
||||
|
@ -19,11 +19,10 @@ import java.util.List;
|
|||
@Slf4j
|
||||
@Component
|
||||
public class MongoMigrationJob implements Job {
|
||||
|
||||
@Autowired
|
||||
private MigrationService migrationService;
|
||||
@Autowired
|
||||
private ISkuService skuService;
|
||||
@Autowired
|
||||
private SkuMongoService skuMongoService;
|
||||
|
||||
@Override
|
||||
public void execute(JobExecutionContext context) throws JobExecutionException {
|
||||
|
@ -45,13 +44,13 @@ public class MongoMigrationJob implements Job {
|
|||
}
|
||||
if(skuList.isEmpty()) {
|
||||
log.info("Migrating all skus ..");
|
||||
migrationService.migrateSkuData();
|
||||
skuMongoService.migrateSkuData();
|
||||
}
|
||||
else {
|
||||
log.info("Migrating skus: {}", skuList);
|
||||
for(String erpCode : skuList) {
|
||||
Sku sku = skuService.getByErpCode(erpCode);
|
||||
migrationService.migrateOneSku(sku);
|
||||
skuMongoService.migrateOneSku(sku);
|
||||
}
|
||||
}
|
||||
log.info("MongoMigrationJob end ..");
|
||||
|
|
|
@ -3,6 +3,7 @@ package org.jeecg.modules.business.mongoRepository;
|
|||
import org.jeecg.modules.business.model.SkuDocument;
|
||||
import org.springframework.data.mongodb.repository.MongoRepository;
|
||||
import org.springframework.data.mongodb.repository.Query;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @Description: Mongo Repository for Sku Collection
|
||||
|
@ -11,10 +12,10 @@ import org.springframework.data.mongodb.repository.Query;
|
|||
*/
|
||||
public interface SkuRepository extends MongoRepository<SkuDocument, String> {
|
||||
@Query("{'erpCode': ?0}")
|
||||
SkuDocument findByErpCode(String erpCode);
|
||||
List<SkuDocument> findByErpCode(String erpCode);
|
||||
|
||||
@Query("{'skuId': ?0}")
|
||||
SkuDocument findBySkuId(String skuId);
|
||||
List<SkuDocument> findBySkuId(String skuId);
|
||||
|
||||
long count();
|
||||
|
||||
|
|
|
@ -6,12 +6,13 @@ import org.jeecg.modules.business.entity.SkuPrice;
|
|||
import org.jeecg.modules.business.entity.SkuWeight;
|
||||
import org.jeecg.modules.business.model.SkuDocument;
|
||||
import org.jeecg.modules.business.vo.SkuOrderPage;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public interface SkuMongoService {
|
||||
SkuDocument findByErpCode(String erpCode);
|
||||
SkuDocument findBySkuId(String skuId);
|
||||
List<SkuDocument> findByErpCode(String erpCode);
|
||||
List<SkuDocument> findBySkuId(String skuId);
|
||||
|
||||
void findAndReplace(String field, String value, SkuDocument skuDocument);
|
||||
|
||||
|
@ -34,4 +35,9 @@ public interface SkuMongoService {
|
|||
void updateSkuFromMabangSync(Sku sku);
|
||||
|
||||
List<SkuOrderPage> textSearch(String keywords);
|
||||
|
||||
@Transactional
|
||||
void migrateSkuData();
|
||||
|
||||
void migrateOneSku(Sku sku);
|
||||
}
|
||||
|
|
|
@ -1,14 +1,11 @@
|
|||
package org.jeecg.modules.business.mongoService.impl;
|
||||
|
||||
import com.mongodb.client.result.UpdateResult;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.business.entity.Sku;
|
||||
import org.jeecg.modules.business.entity.SkuDeclaredValue;
|
||||
import org.jeecg.modules.business.entity.SkuPrice;
|
||||
import org.jeecg.modules.business.entity.SkuWeight;
|
||||
import org.jeecg.modules.business.entity.*;
|
||||
import org.jeecg.modules.business.model.SkuDocument;
|
||||
import org.jeecg.modules.business.mongoRepository.SkuRepository;
|
||||
import org.jeecg.modules.business.mongoService.SkuMongoService;
|
||||
import org.jeecg.modules.business.service.*;
|
||||
import org.jeecg.modules.business.vo.SkuOrderPage;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.mongodb.core.FindAndModifyOptions;
|
||||
|
@ -16,6 +13,7 @@ import org.springframework.data.mongodb.core.FindAndReplaceOptions;
|
|||
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||
import org.springframework.data.mongodb.core.query.*;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
@ -25,18 +23,28 @@ import java.util.stream.Collectors;
|
|||
@Component
|
||||
@Slf4j
|
||||
public class SkuMongoServiceImpl implements SkuMongoService {
|
||||
@Autowired
|
||||
private ISkuService skuService;
|
||||
@Autowired
|
||||
private MongoTemplate mongoTemplate;
|
||||
@Autowired
|
||||
private SkuRepository skuRepository;
|
||||
@Autowired
|
||||
private ISkuWeightService skuWeightService;
|
||||
@Autowired
|
||||
private ISkuDeclaredValueService skuDeclaredValueService;
|
||||
@Autowired
|
||||
private ISkuPriceService skuPriceService;
|
||||
@Autowired
|
||||
private ISensitiveAttributeService sensitiveAttributeService;
|
||||
|
||||
@Override
|
||||
public SkuDocument findByErpCode(String erpCode) {
|
||||
public List<SkuDocument> findByErpCode(String erpCode) {
|
||||
return skuRepository.findByErpCode(erpCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SkuDocument findBySkuId(String skuId) {
|
||||
public List<SkuDocument> findBySkuId(String skuId) {
|
||||
return skuRepository.findBySkuId(skuId);
|
||||
}
|
||||
|
||||
|
@ -126,7 +134,26 @@ public class SkuMongoServiceImpl implements SkuMongoService {
|
|||
|
||||
@Override
|
||||
public void upsertSkuWeight(SkuWeight skuWeight) {
|
||||
SkuDocument skuDocument = findBySkuId(skuWeight.getSkuId());
|
||||
List<SkuDocument> skuDocuments = findBySkuId(skuWeight.getSkuId());
|
||||
SkuDocument skuDocument;
|
||||
if(skuDocuments == null || skuDocuments.isEmpty()) {
|
||||
log.error(" SkuDocument with skuId was {} not found.", skuWeight.getSkuId());
|
||||
String obsoleteErpCode = skuService.getById(skuWeight.getSkuId()).getErpCode();
|
||||
List<SkuDocument> obsoleteDocuments = findByErpCode(obsoleteErpCode);
|
||||
if(obsoleteDocuments != null && !obsoleteDocuments.isEmpty()) {
|
||||
log.error("Deleting obsolete SkuDocuments with erpCode : {} ", obsoleteErpCode);
|
||||
obsoleteDocuments.forEach(obsoleteDocument -> deleteBySkuId(obsoleteDocument.getSkuId()));
|
||||
}
|
||||
log.info("Pulling Sku from DB to Mongo");
|
||||
migrateOneSku(skuService.getById(skuWeight.getSkuId()));
|
||||
}
|
||||
else if(skuDocuments.size() > 1) {
|
||||
log.error("Multiple SkuDocument with skuId was {} found.", skuWeight.getSkuId());
|
||||
skuDocuments.forEach(document -> deleteBySkuId(document.getSkuId()));
|
||||
log.info("Pulling Sku from DB to Mongo");
|
||||
migrateOneSku(skuService.getById(skuWeight.getSkuId()));
|
||||
}
|
||||
skuDocument = findBySkuId(skuWeight.getSkuId()).get(0);
|
||||
Date latestWeightInDB = Optional.ofNullable(skuDocument.getLatestSkuWeight())
|
||||
.map(SkuDocument.LatestSkuWeight::getEffectiveDate)
|
||||
.orElse(null);
|
||||
|
@ -255,4 +282,117 @@ public class SkuMongoServiceImpl implements SkuMongoService {
|
|||
.orElse(null));
|
||||
return skuOrderPage;
|
||||
}
|
||||
|
||||
@Transactional
|
||||
@Override
|
||||
public void migrateSkuData() {
|
||||
List<Sku> skuList = skuService.listSkus();
|
||||
log.info("MigrateSkuData: migrating {} skus.", skuList.size());
|
||||
|
||||
int count = 0;
|
||||
for(Sku sku : skuList) {
|
||||
if(count == 0) {
|
||||
log.info("MigrateSkuData progressions: [----------] 0%");
|
||||
}
|
||||
if(count == skuList.size() / 10) {
|
||||
log.info("MigrateSkuData progressions: [█---------] 10%");
|
||||
}
|
||||
if(count == skuList.size() / 5) {
|
||||
log.info("MigrateSkuData progressions: [██--------] 20%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 3) {
|
||||
log.info("MigrateSkuData progressions: [███-------] 30%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 4) {
|
||||
log.info("MigrateSkuData progressions: [████------] 40%");
|
||||
}
|
||||
if(count == skuList.size() / 2) {
|
||||
log.info("MigrateSkuData progressions: [█████-----] 50%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 6) {
|
||||
log.info("MigrateSkuData progressions: [██████----] 60%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 7) {
|
||||
log.info("MigrateSkuData progressions: [███████---] 70%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 8) {
|
||||
log.info("MigrateSkuData progressions: [█████████-] 90%");
|
||||
}
|
||||
if(count == skuList.size() - 1) {
|
||||
log.info("MigrateSkuData progressions: [██████████] 100%");
|
||||
}
|
||||
count++;
|
||||
try {
|
||||
migrateOneSku(sku);
|
||||
} catch (Exception e) {
|
||||
log.error("Error while migrating skuId: {}", sku.getId());
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void migrateOneSku(Sku sku) {
|
||||
|
||||
SkuWeight latestWeight = skuWeightService.getBySkuId(sku.getId());
|
||||
SkuDeclaredValue latestDeclaredValue = skuDeclaredValueService.getLatestBySkuId(sku.getId());
|
||||
SkuPrice latestPrice = skuPriceService.getLatestBySkuId(sku.getId());
|
||||
SensitiveAttribute sensitiveAttribute = sensitiveAttributeService.getById(sku.getSensitiveAttributeId());
|
||||
|
||||
if(sensitiveAttribute == null) {
|
||||
log.error("SensitiveAttribute not found for skuId: {}", sku.getId());
|
||||
throw new RuntimeException("SensitiveAttribute not found for skuId: " + sku.getId());
|
||||
}
|
||||
|
||||
SkuDocument skuDocument = SkuDocument.builder()
|
||||
.skuId(sku.getId())
|
||||
.createBy(sku.getCreateBy())
|
||||
.createTime(sku.getCreateTime())
|
||||
.updateBy(sku.getUpdateBy())
|
||||
.updateTime(sku.getUpdateTime())
|
||||
.erpCode(sku.getErpCode())
|
||||
.zhName(sku.getZhName())
|
||||
.enName(sku.getEnName())
|
||||
.invoiceName(sku.getInvoiceName())
|
||||
.availableAmount(sku.getAvailableAmount())
|
||||
.purchasingAmount(sku.getPurchasingAmount())
|
||||
.imageSource(sku.getImageSource())
|
||||
.shippingDiscount(sku.getShippingDiscount())
|
||||
.serviceFee(sku.getServiceFee())
|
||||
.status(sku.getStatus())
|
||||
.moq(sku.getMoq())
|
||||
.isGift(sku.getIsGift())
|
||||
.sensitiveAttribute(SkuDocument.SensitiveAttribute.builder()
|
||||
.zhName(sensitiveAttribute.getZhName())
|
||||
.enName(sensitiveAttribute.getEnName())
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
if(latestWeight != null) {
|
||||
skuDocument.setLatestSkuWeight(SkuDocument.LatestSkuWeight.builder()
|
||||
.weight(latestWeight.getWeight())
|
||||
.effectiveDate(latestWeight.getEffectiveDate())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
if(latestPrice != null) {
|
||||
skuDocument.setLatestSkuPrice(SkuDocument.LatestSkuPrice.builder()
|
||||
.date(latestPrice.getDate())
|
||||
.price(latestPrice.getPrice())
|
||||
.discountedPrice(latestPrice.getDiscountedPrice())
|
||||
.threshold(latestPrice.getThreshold())
|
||||
.priceRmb(latestPrice.getPriceRmb())
|
||||
.discountedPriceRmb(latestPrice.getDiscountedPriceRmb())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
if(latestDeclaredValue != null) {
|
||||
skuDocument.setLatestDeclaredValue(SkuDocument.LatestDeclaredValue.builder()
|
||||
.declaredValue(latestDeclaredValue.getDeclaredValue())
|
||||
.effectiveDate(latestDeclaredValue.getEffectiveDate())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
findAndReplace("erpCode", sku.getErpCode(), skuDocument);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,143 +0,0 @@
|
|||
package org.jeecg.modules.business.service;
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.jeecg.modules.business.entity.*;
|
||||
import org.jeecg.modules.business.model.SkuDocument;
|
||||
import org.jeecg.modules.business.mongoRepository.SkuRepository;
|
||||
import org.jeecg.modules.business.mongoService.SkuMongoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Slf4j
|
||||
@Service
|
||||
public class MigrationService {
|
||||
// MySql
|
||||
@Autowired
|
||||
ISensitiveAttributeService sensitiveAttributeService;
|
||||
@Autowired
|
||||
ISkuService skuService;
|
||||
@Autowired
|
||||
ISkuDeclaredValueService skuDeclaredValueService;
|
||||
@Autowired
|
||||
ISkuWeightService skuWeightService;
|
||||
@Autowired
|
||||
ISkuPriceService skuPriceService;
|
||||
@Autowired
|
||||
SkuMongoService skuMongoService;
|
||||
// Mongo
|
||||
@Autowired
|
||||
private SkuRepository skuRepository;
|
||||
|
||||
@Transactional
|
||||
public void migrateSkuData() {
|
||||
List<Sku> skuList = skuService.listSkus();
|
||||
log.info("MigrateSkuData: migrating {} skus.", skuList.size());
|
||||
|
||||
int count = 0;
|
||||
for(Sku sku : skuList) {
|
||||
if(count == 0) {
|
||||
log.info("MigrateSkuData progressions: [----------] 0%");
|
||||
}
|
||||
if(count == skuList.size() / 10) {
|
||||
log.info("MigrateSkuData progressions: [█---------] 10%");
|
||||
}
|
||||
if(count == skuList.size() / 5) {
|
||||
log.info("MigrateSkuData progressions: [██--------] 20%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 3) {
|
||||
log.info("MigrateSkuData progressions: [███-------] 30%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 4) {
|
||||
log.info("MigrateSkuData progressions: [████------] 40%");
|
||||
}
|
||||
if(count == skuList.size() / 2) {
|
||||
log.info("MigrateSkuData progressions: [█████-----] 50%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 6) {
|
||||
log.info("MigrateSkuData progressions: [██████----] 60%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 7) {
|
||||
log.info("MigrateSkuData progressions: [███████---] 70%");
|
||||
}
|
||||
if(count == skuList.size() / 10 * 8) {
|
||||
log.info("MigrateSkuData progressions: [█████████-] 90%");
|
||||
}
|
||||
if(count == skuList.size() - 1) {
|
||||
log.info("MigrateSkuData progressions: [██████████] 100%");
|
||||
}
|
||||
count++;
|
||||
try {
|
||||
migrateOneSku(sku);
|
||||
} catch (Exception e) {
|
||||
log.error("Error while migrating skuId: {}", sku.getId());
|
||||
log.error(e.getMessage());
|
||||
}
|
||||
}
|
||||
}
|
||||
public void migrateOneSku(Sku sku) {
|
||||
|
||||
SkuWeight latestWeight = skuWeightService.getBySkuId(sku.getId());
|
||||
SkuDeclaredValue latestDeclaredValue = skuDeclaredValueService.getLatestBySkuId(sku.getId());
|
||||
SkuPrice latestPrice = skuPriceService.getLatestBySkuId(sku.getId());
|
||||
SensitiveAttribute sensitiveAttribute = sensitiveAttributeService.getById(sku.getSensitiveAttributeId());
|
||||
|
||||
if(sensitiveAttribute == null) {
|
||||
log.error("SensitiveAttribute not found for skuId: {}", sku.getId());
|
||||
throw new RuntimeException("SensitiveAttribute not found for skuId: " + sku.getId());
|
||||
}
|
||||
|
||||
SkuDocument skuDocument = SkuDocument.builder()
|
||||
.skuId(sku.getId())
|
||||
.createBy(sku.getCreateBy())
|
||||
.createTime(sku.getCreateTime())
|
||||
.updateBy(sku.getUpdateBy())
|
||||
.updateTime(sku.getUpdateTime())
|
||||
.erpCode(sku.getErpCode())
|
||||
.zhName(sku.getZhName())
|
||||
.enName(sku.getEnName())
|
||||
.invoiceName(sku.getInvoiceName())
|
||||
.availableAmount(sku.getAvailableAmount())
|
||||
.purchasingAmount(sku.getPurchasingAmount())
|
||||
.imageSource(sku.getImageSource())
|
||||
.shippingDiscount(sku.getShippingDiscount())
|
||||
.serviceFee(sku.getServiceFee())
|
||||
.status(sku.getStatus())
|
||||
.moq(sku.getMoq())
|
||||
.isGift(sku.getIsGift())
|
||||
.sensitiveAttribute(SkuDocument.SensitiveAttribute.builder()
|
||||
.zhName(sensitiveAttribute.getZhName())
|
||||
.enName(sensitiveAttribute.getEnName())
|
||||
.build()
|
||||
)
|
||||
.build();
|
||||
if(latestWeight != null) {
|
||||
skuDocument.setLatestSkuWeight(SkuDocument.LatestSkuWeight.builder()
|
||||
.weight(latestWeight.getWeight())
|
||||
.effectiveDate(latestWeight.getEffectiveDate())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
if(latestPrice != null) {
|
||||
skuDocument.setLatestSkuPrice(SkuDocument.LatestSkuPrice.builder()
|
||||
.date(latestPrice.getDate())
|
||||
.price(latestPrice.getPrice())
|
||||
.discountedPrice(latestPrice.getDiscountedPrice())
|
||||
.threshold(latestPrice.getThreshold())
|
||||
.priceRmb(latestPrice.getPriceRmb())
|
||||
.discountedPriceRmb(latestPrice.getDiscountedPriceRmb())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
if(latestDeclaredValue != null) {
|
||||
skuDocument.setLatestDeclaredValue(SkuDocument.LatestDeclaredValue.builder()
|
||||
.declaredValue(latestDeclaredValue.getDeclaredValue())
|
||||
.effectiveDate(latestDeclaredValue.getEffectiveDate())
|
||||
.build()
|
||||
);
|
||||
}
|
||||
skuMongoService.findAndReplace("skuId", sku.getId(), skuDocument);
|
||||
}
|
||||
}
|
|
@ -50,14 +50,27 @@ public class ClientSkuServiceImpl extends ServiceImpl<ClientSkuMapper, ClientSku
|
|||
}
|
||||
String internalCode = erpCode.substring(index+1);
|
||||
String clientId = clientService.getClientIdByCode(internalCode);
|
||||
if(clientId == null) {
|
||||
if (clientId != null) {
|
||||
log.info("Associating sku \"{}\" with client \"{}\" : \"{}\". ", sku.getErpCode(), internalCode, clientId);
|
||||
addClientSku(clientId, sku.getId());
|
||||
continue;
|
||||
}
|
||||
if(!internalCode.equals("MD")) {
|
||||
log.info("Couldn't associate sku \"{}\" with any client. ", erpCode);
|
||||
unknownSkuErpCode.add(erpCode);
|
||||
continue;
|
||||
}
|
||||
log.info("Associating sku \"{}\" with client \"{}\" : \"{}\". ", sku.getErpCode(),internalCode, clientId);
|
||||
addClientSku(clientId, sku.getId());
|
||||
}
|
||||
if(sku.getZhName().contains("灯")) {
|
||||
clientId = clientService.getClientIdByCode("MD-Lumiart");
|
||||
log.info("Associating sku \"{}\" with client \"{}\" : \"{}\". ", sku.getErpCode(), internalCode, "MD-Lumiart");
|
||||
addClientSku(clientId, sku.getId());
|
||||
}
|
||||
if(sku.getZhName().contains("袜")) {
|
||||
clientId = clientService.getClientIdByCode("MD-Lou");
|
||||
log.info("Associating sku \"{}\" with client \"{}\" : \"{}\". ", sku.getErpCode(), internalCode, "MD-Lou");
|
||||
addClientSku(clientId, sku.getId());
|
||||
}
|
||||
}
|
||||
return unknownSkuErpCode;
|
||||
}
|
||||
|
||||
|
|
|
@ -70,8 +70,6 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
|||
@Autowired
|
||||
private EmailService emailService;
|
||||
@Autowired
|
||||
private MigrationService migrationService;
|
||||
@Autowired
|
||||
private SkuMongoService skuMongoService;
|
||||
@Autowired
|
||||
private FreeMarkerConfigurer freemarkerConfigurer;
|
||||
|
@ -537,7 +535,7 @@ public class SkuListMabangServiceImpl extends ServiceImpl<SkuListMabangMapper, S
|
|||
// mongo sync after transaction
|
||||
for(Sku sku : newSkusMap.keySet()) {
|
||||
try {
|
||||
migrationService.migrateOneSku(sku);
|
||||
skuMongoService.migrateOneSku(sku);
|
||||
} catch (Exception e) {
|
||||
log.error("Error while migrating skuId: {}", sku.getId());
|
||||
log.error(e.getMessage());
|
||||
|
|
Loading…
Reference in New Issue