记得上下班打卡 | git大法好,push需谨慎

Commit 5779fdfa authored by 姜秀龙's avatar 姜秀龙

Merge branch 'refs/heads/dev-1.6-shouqianba' into container-test

parents 3ff32db5 4e23bb64
......@@ -76,8 +76,13 @@ public class GoblinFrontController {
@GetMapping("getGoodsDetail")
@ApiOperation("获得商品详情")
public ResponseDto<GoblinFrontGoodDetailVo> getGoodsDetail(@RequestParam(name = "spuId", required = true) String spuId) throws ParseException {
GoblinFrontGoodDetailVo vo = goblinFrontService.getGoodsDetail(spuId);
@ApiImplicitParams({
@ApiImplicitParam(paramType = "query", required = false, dataType = "String", name = "performancesId", value = "演出ID,可选;收钱吧商品(spuType=33)时传入则仅返回该演出已关联的 SKU")
})
public ResponseDto<GoblinFrontGoodDetailVo> getGoodsDetail(
@RequestParam(name = "spuId", required = true) String spuId,
@RequestParam(name = "performancesId", required = false) String performancesId) throws ParseException {
GoblinFrontGoodDetailVo vo = goblinFrontService.getGoodsDetail(spuId, performancesId);
if(vo==null){
return ResponseDto.failure("商品不存在");
}
......
......@@ -10,7 +10,9 @@ import com.liquidnet.service.base.ErrorMapping;
import com.liquidnet.service.base.ResponseDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbAddParam;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinGoods;
import com.liquidnet.service.goblin.entity.GoblinSqbGoodsExt;
import com.liquidnet.service.goblin.mapper.GoblinGoodsMapper;
import com.liquidnet.service.goblin.mapper.GoblinSqbGoodsExtMapper;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtSqbGoodsService;
import com.liquidnet.service.goblin.util.GoblinRedisUtils;
......@@ -48,6 +50,8 @@ public class GoblinStoreMgtSqbGoodsController {
@Autowired
private GoblinSqbGoodsExtMapper goblinSqbGoodsExtMapper;
@Autowired
private GoblinGoodsMapper goblinGoodsMapper;
@Autowired
private SqbBiz goblinShouQianBaService;
/**
......@@ -188,10 +192,52 @@ public class GoblinStoreMgtSqbGoodsController {
}
private boolean existsSqbSpu(String mallSn, String sqbSpuId) {
return goblinSqbGoodsExtMapper.selectCount(new LambdaQueryWrapper<GoblinSqbGoodsExt>()
List<GoblinSqbGoodsExt> extList = goblinSqbGoodsExtMapper.selectList(new LambdaQueryWrapper<GoblinSqbGoodsExt>()
.eq(GoblinSqbGoodsExt::getMallSn, mallSn)
.eq(GoblinSqbGoodsExt::getSqbSpuId, sqbSpuId)
.eq(GoblinSqbGoodsExt::getDelFlg, "0")) > 0;
.eq(GoblinSqbGoodsExt::getDelFlg, "0")
.last("LIMIT 20"));
if (CollectionUtils.isEmpty(extList)) {
return false;
}
// 本地商品已删除但 ext 关系未清理时:允许重新同步(自动软删 ext 记录,避免“已存在”卡死)
boolean hasLiveLocalSpu = false;
for (GoblinSqbGoodsExt ext : extList) {
if (ext == null || StringUtils.isBlank(ext.getSpuId())) {
continue;
}
GoblinGoods localGoods = goblinGoodsMapper.selectOne(new LambdaQueryWrapper<GoblinGoods>()
.eq(GoblinGoods::getSpuId, ext.getSpuId())
.eq(GoblinGoods::getDelFlg, "0")
.select(GoblinGoods::getSpuId)
.last("LIMIT 1"));
if (localGoods != null) {
hasLiveLocalSpu = true;
break;
}
}
if (hasLiveLocalSpu) {
return true;
}
try {
LocalDateTime now = LocalDateTime.now();
for (GoblinSqbGoodsExt ext : extList) {
if (ext == null || ext.getMid() == null) {
continue;
}
GoblinSqbGoodsExt upd = new GoblinSqbGoodsExt();
upd.setMid(ext.getMid());
upd.setDelFlg("1");
upd.setUpdatedAt(now);
upd.setDeletedAt(now);
goblinSqbGoodsExtMapper.updateById(upd);
}
} catch (Exception e) {
log.warn("收钱吧商品管理:清理已删除SPU的ext关系失败, mallSn={}, sqbSpuId={}", mallSn, sqbSpuId, e);
}
return false;
}
private void saveSqbExtRelations(GoblinGoodsInfoVo goodsInfoVo, GoblinSqbPerfGoodsVo sqbGoods) {
......
......@@ -13,8 +13,10 @@ import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.manage.*;
import com.liquidnet.service.goblin.dto.manage.vo.*;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinGoods;
import com.liquidnet.service.goblin.entity.GoblinSqbGoodsExt;
import com.liquidnet.service.goblin.enums.GoblinStoreConf;
import com.liquidnet.service.goblin.mapper.GoblinGoodsMapper;
import com.liquidnet.service.goblin.mapper.GoblinSqbGoodsExtMapper;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtExtraService;
import com.liquidnet.service.goblin.service.manage.IGoblinZhengzaiService;
......@@ -50,6 +52,8 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
IGoblinZhengzaiService goblinZhengzaiService;
@Autowired
GoblinSqbGoodsExtMapper goblinSqbGoodsExtMapper;
@Autowired
GoblinGoodsMapper goblinGoodsMapper;
@Override
public PagedResult<GoblinStoreMgtGoodsListVo> goodsList(GoblinStoreMgtGoodsFilterParam mgtGoodsFilterParam) {
......@@ -538,6 +542,15 @@ public class GoblinStoreMgtGoodsServiceImpl implements IGoblinstoreMgtGoodsServi
String spuId = storeMgtGoodsAddParam.getSpuId();
GoblinGoodsInfoVo updateSpuInfoVo = storeMgtGoodsAddParam.initEditGoodsInfoVo();
// initEditGoodsInfoVo 固定 setSpuType(0),全量更新 Mongo 会把 33 等类型覆盖成 0;以 MySQL 为准保持类型不变
LambdaQueryWrapper<GoblinGoods> spuTypeQ = new LambdaQueryWrapper<GoblinGoods>()
.eq(GoblinGoods::getSpuId, spuId)
.select(GoblinGoods::getSpuType)
.last("LIMIT 1");
GoblinGoods goodsRow = goblinGoodsMapper.selectOne(spuTypeQ);
if (goodsRow != null && goodsRow.getSpuType() != null) {
updateSpuInfoVo.setSpuType(goodsRow.getSpuType());
}
boolean updateTagFlg = false, updateExtagFlg = false, updateArtagFlg = false;
List<GoblinGoodsTagVo> befTagVoList = mgtGoodsInfoVo.getTagVoList();
......
......@@ -17,11 +17,7 @@ import com.liquidnet.service.goblin.dto.GoblinGoodsSpecDto;
import com.liquidnet.service.goblin.dto.manage.GoblinStoreMgtGoodsSqbAddParam;
import com.liquidnet.service.goblin.dto.manage.vo.GoblinMgtCategorySpecVo;
import com.liquidnet.service.goblin.dto.vo.*;
import com.liquidnet.service.goblin.entity.GoblinGoods;
import com.liquidnet.service.goblin.entity.GoblinGoodsSku;
import com.liquidnet.service.goblin.entity.GoblinSqbGoodsExt;
import com.liquidnet.service.goblin.mapper.GoblinGoodsMapper;
import com.liquidnet.service.goblin.mapper.GoblinGoodsSkuMapper;
import com.liquidnet.service.goblin.mapper.GoblinSqbGoodsExtMapper;
import com.liquidnet.service.goblin.service.manage.IGoblinStoreMgtSqbGoodsService;
import com.liquidnet.service.goblin.util.GoblinMongoUtils;
......@@ -54,10 +50,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
@Autowired
GoblinSqbGoodsExtMapper goblinSqbGoodsExtMapper;
@Autowired
private GoblinGoodsMapper goblinGoodsMapper;
@Autowired
private GoblinGoodsSkuMapper goblinGoodsSkuMapper;
@Autowired
private SqbBiz goblinShouQianBaService;
......@@ -319,15 +311,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
GoblinStoreMgtGoodsSqbAddParam initParam = new GoblinStoreMgtGoodsSqbAddParam();
GoblinGoodsInfoVo updateSpuInfoVo = initParam.initEditGoodsInfoVo(mgtGoodsAddParam, mgtGoodsInfoVo);
// Redis 反序列化缺 spuType 时 primitive int 为 0,全量 $set 会误覆盖 Mongo 中的 33 等类型;以 MySQL 为准回填
LambdaQueryWrapper<GoblinGoods> spuTypeQ = new LambdaQueryWrapper<GoblinGoods>()
.eq(GoblinGoods::getSpuId, spuId)
.select(GoblinGoods::getSpuType)
.last("LIMIT 1");
GoblinGoods goodsRow = goblinGoodsMapper.selectOne(spuTypeQ);
if (goodsRow != null && goodsRow.getSpuType() != null) {
updateSpuInfoVo.setSpuType(goodsRow.getSpuType());
}
boolean updateImageFlg = false;
List<String> paramImageList = mgtGoodsAddParam.getConverImages();
......@@ -415,19 +398,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
.filter(ext -> StringUtils.isNotBlank(ext.getSqbSkuId()) && StringUtils.isNotBlank(ext.getSkuId()))
.collect(Collectors.toMap(GoblinSqbGoodsExt::getSqbSkuId, GoblinSqbGoodsExt::getSkuId, (a, b) -> a));
List<String> localSkuIdsForType = new ArrayList<>(new LinkedHashSet<>(sqbSkuToLocalSkuMap.values()));
Map<String, Integer> skuTypeByLocalId = new HashMap<>();
if (!localSkuIdsForType.isEmpty()) {
LambdaQueryWrapper<GoblinGoodsSku> typeQ = new LambdaQueryWrapper<GoblinGoodsSku>()
.in(GoblinGoodsSku::getSkuId, localSkuIdsForType)
.select(GoblinGoodsSku::getSkuId, GoblinGoodsSku::getSkuType);
for (GoblinGoodsSku row : goblinGoodsSkuMapper.selectList(typeQ)) {
if (row.getSkuId() != null && row.getSkuType() != null) {
skuTypeByLocalId.put(row.getSkuId(), row.getSkuType());
}
}
}
boolean updated = false;
LinkedList<Object[]> updateGoodsSkuObjs = CollectionUtil.linkedListObjectArr();
for (MallProductsQueryData.Sku sqbSku : skuResults) {
......@@ -443,10 +413,6 @@ public class GoblinStoreMgtSqbGoodsServiceImpl implements IGoblinStoreMgtSqbGood
if (skuInfoVo == null || !"0".equals(skuInfoVo.getDelFlg())) {
continue;
}
Integer persistedSkuType = skuTypeByLocalId.get(localSkuId);
if (persistedSkuType != null) {
skuInfoVo.setSkuType(persistedSkuType);
}
skuInfoVo.setName(sqbSku.getSkuName());
if (sqbSku.getPrice() != null) {
skuInfoVo.setPrice(SqbAmountUtils.fenToYuan(sqbSku.getPrice()));
......
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