|
@@ -76,11 +76,10 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public boolean saveAsDraft(SecondGoodsVo goods) {
|
|
public boolean saveAsDraft(SecondGoodsVo goods) {
|
|
|
|
+ SecondGoods secondGoods = new SecondGoods();
|
|
|
|
+ BeanUtils.copyProperties(goods, secondGoods);
|
|
// 设置商品状态为草稿
|
|
// 设置商品状态为草稿
|
|
- goods.setUserId(1);
|
|
|
|
goods.setGoodsStatus(0); // TODO: 使用常量或枚举代替硬编码
|
|
goods.setGoodsStatus(0); // TODO: 使用常量或枚举代替硬编码
|
|
- goods.setCreatedUserId(1);
|
|
|
|
- goods.setUpdatedUserId(1);
|
|
|
|
// 保存商品基本信息
|
|
// 保存商品基本信息
|
|
if (!save(goods)) {
|
|
if (!save(goods)) {
|
|
return false; // 保存失败直接返回
|
|
return false; // 保存失败直接返回
|
|
@@ -96,14 +95,22 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
|
|
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public boolean createBasicInfo(SecondGoodsVo goodsDTO) {
|
|
|
|
|
|
+ public boolean createBasicInfo(SecondGoodsVo goodsDTO,Integer editFlag) {
|
|
// 实现基本信息保存逻辑
|
|
// 实现基本信息保存逻辑
|
|
SecondGoods goods = new SecondGoods();
|
|
SecondGoods goods = new SecondGoods();
|
|
- BeanUtils.copyProperties(goods, goodsDTO);
|
|
|
|
|
|
+ BeanUtils.copyProperties(goodsDTO, goods);
|
|
|
|
|
|
- // 保存商品基本信息
|
|
|
|
- if (!save(goods)) {
|
|
|
|
- return false; // 保存失败直接返回
|
|
|
|
|
|
+ if (editFlag == 1){
|
|
|
|
+ goods.setId(goodsDTO.getId());
|
|
|
|
+ // 保存商品基本信息
|
|
|
|
+ if (!updateById(goods)) {
|
|
|
|
+ return false; // 保存失败直接返回
|
|
|
|
+ }
|
|
|
|
+ } else {
|
|
|
|
+ // 保存商品基本信息
|
|
|
|
+ if (!save(goods)) {
|
|
|
|
+ return false; // 保存失败直接返回
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
// 获取保存后的商品ID,用于后续业务处理
|
|
// 获取保存后的商品ID,用于后续业务处理
|
|
@@ -153,7 +160,7 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
*/
|
|
*/
|
|
private boolean performContentReviews(SecondGoods goods, SecondGoodsVo goodsDTO) {
|
|
private boolean performContentReviews(SecondGoods goods, SecondGoodsVo goodsDTO) {
|
|
// 文本审核
|
|
// 文本审核
|
|
- Map<String, String> textCheckResult = TextCheckUtil.check(goodsDTO.getDescribe());
|
|
|
|
|
|
+ Map<String, String> textCheckResult = TextCheckUtil.check(goodsDTO.getDescription());
|
|
if (!"200".equals(textCheckResult.get("code"))) {
|
|
if (!"200".equals(textCheckResult.get("code"))) {
|
|
// 文本审核不通过
|
|
// 文本审核不通过
|
|
goods.setGoodsStatus(2); // 审核失败
|
|
goods.setGoodsStatus(2); // 审核失败
|
|
@@ -399,6 +406,7 @@ public class SecondGoodsServiceImpl extends ServiceImpl<SecondGoodsMapper, Secon
|
|
if (userId != null) {
|
|
if (userId != null) {
|
|
LambdaUpdateWrapper<LifeCollect> updateWrapper = new LambdaUpdateWrapper<>();
|
|
LambdaUpdateWrapper<LifeCollect> updateWrapper = new LambdaUpdateWrapper<>();
|
|
updateWrapper.eq(LifeCollect::getUserId, "user_"+phone)
|
|
updateWrapper.eq(LifeCollect::getUserId, "user_"+phone)
|
|
|
|
+ // TODo 商品ID
|
|
.eq(LifeCollect::getGoodsId, goods.getId());
|
|
.eq(LifeCollect::getGoodsId, goods.getId());
|
|
if (lifeCollectMapper.selectCount(updateWrapper) > 0) {
|
|
if (lifeCollectMapper.selectCount(updateWrapper) > 0) {
|
|
goods.setCollectStatus(1);
|
|
goods.setCollectStatus(1);
|