11.27功能修改
parent
6dcaa301f8
commit
39c0db585e
|
@ -0,0 +1,35 @@
|
|||
{
|
||||
"活动ID":"Long",
|
||||
"商品ID":"Long",
|
||||
"活动名称":"String",
|
||||
"商品名称":"String",
|
||||
"商品图片":"String",
|
||||
"活动简介":"String",
|
||||
"商品单位":"String",
|
||||
"商品轮播图":[
|
||||
"String","String"
|
||||
],
|
||||
"活动时间":"date",
|
||||
"策略类型":"string",
|
||||
"商品规格":{
|
||||
"修改商品规格List":[
|
||||
{
|
||||
"团购规格ID":"Long",
|
||||
"拼团价格":"BigDecimal",
|
||||
"拼团库存":"Long",
|
||||
}
|
||||
],
|
||||
"添加商品规格List":[
|
||||
"商品sku":"String",
|
||||
"拼团价格":"BigDecimal",
|
||||
"拼团库存":"Long",
|
||||
]
|
||||
"删除商品规格List":["Long","Long"]
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -7,6 +7,7 @@ import com.muyu.common.core.web.domain.BaseEntity;
|
|||
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoSaveModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoUpdModel;
|
||||
import com.muyu.marketing.domain.model.ActivityUpdTeamModel;
|
||||
import lombok.*;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
|
@ -129,4 +130,22 @@ public class ActivityTeamInfo extends BaseEntity {
|
|||
.strategyId(activityTeamInfoUpdModel.getStrategyId())
|
||||
.build();
|
||||
}
|
||||
public static ActivityTeamInfo activityUpdTeamModel (ActivityUpdTeamModel activityTeamInfo){
|
||||
return ActivityTeamInfo.builder()
|
||||
.id(activityTeamInfo.getId())
|
||||
.productId(activityTeamInfo.getProductId())
|
||||
.name(activityTeamInfo.getName())
|
||||
.productImage(activityTeamInfo.getProductImage())
|
||||
.introduction(activityTeamInfo.getIntroduction())
|
||||
.unit(activityTeamInfo.getUnit())
|
||||
.imageList(activityTeamInfo.getImageList())
|
||||
.createTime(activityTeamInfo.getCreateTime())
|
||||
.strategyType(activityTeamInfo.getStrategyType())
|
||||
.content(activityTeamInfo.getContent())
|
||||
.build();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -3,11 +3,11 @@ package com.muyu.marketing.team.controller;
|
|||
|
||||
import com.muyu.common.core.domain.Result;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||
import com.muyu.marketing.domain.model.ActivityTeamInfoUpdModel;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoUpdReq;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamUpdProductUpdReq;
|
||||
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||
import com.muyu.marketing.domain.resp.TeamInfoFindByIdResp;
|
||||
import com.muyu.marketing.domain.resp.TeamInfoListResp;
|
||||
|
@ -68,4 +68,14 @@ public class ActivityTeamController {
|
|||
activityTeamInfoService.update(ActivityTeamInfoUpdModel.activityTeamInfoUpdReqModelBuild(activityTeamInfoUpdReq));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/updActivityTeamInfo")
|
||||
public Result updActivityTeamInfo (@RequestBody ActivityTeamUpdProductUpdReq activityTeamUpdProductUpdReq){
|
||||
boolean a= activityTeamInfoService.updproduct(ActivityUpdTeamModel.update(activityTeamUpdProductUpdReq));
|
||||
if(a){
|
||||
return Result.success("删除成功");
|
||||
}else{
|
||||
return Result.error("删除失败");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,4 +36,5 @@ public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
|||
boolean update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel);
|
||||
|
||||
|
||||
boolean updproduct(ActivityUpdTeamModel update);
|
||||
}
|
||||
|
|
|
@ -48,4 +48,12 @@ public interface ActivityTeamProductSkuInfoService extends IService<ActivityTeam
|
|||
|
||||
public boolean updateBath(List<ActivityTeamProductSkuReqModel> activityTeamProductSkuReqModelList);
|
||||
|
||||
public boolean updtoBath(List<ActivityTeamUpdModel> activityTeamUpdModels);
|
||||
|
||||
public boolean addBath(List<ActivityTeamAddModel> activityTeamAddModels);
|
||||
|
||||
public boolean delBath(List<Long> ids);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
|
@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|||
import com.muyu.common.core.utils.StringUtils;
|
||||
import com.muyu.common.core.web.page.TableDataInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
import com.muyu.marketing.team.mapper.ActivityTeamInfoMapper;
|
||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
|
@ -15,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.util.Assert;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
|
@ -27,6 +29,8 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
|
||||
@Autowired
|
||||
private ActivityTeamProductSkuInfoService activityTeamProductSkuInfoService;
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;
|
||||
|
||||
@Override
|
||||
public TableDataInfo<ActivityTeamInfoListModel> query(ActivityTeamInfoListQueryModel activityTeamInfoListQueryModel) {
|
||||
|
@ -41,6 +45,7 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
*/
|
||||
Page<ActivityTeamInfo> activityTeamInfoPage = this.page(activityTeamInfoListQueryModel.buildPage(), queryWrapper);
|
||||
List<ActivityTeamInfo> activityTeamInfoList = activityTeamInfoPage.getRecords();
|
||||
|
||||
List<ActivityTeamInfoListModel> activityTeamInfoListModels = activityTeamInfoList.stream()
|
||||
.map(activityTeamInfo -> ActivityTeamInfoListModel.infoBuild(activityTeamInfo,
|
||||
(activityTeamInfoListModelBuilder) -> {
|
||||
|
@ -102,7 +107,27 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
public boolean update(ActivityTeamInfoUpdModel activityTeamInfoUpdModel) {
|
||||
boolean update = this.updateById(ActivityTeamInfo.TeamUpdateBuild(activityTeamInfoUpdModel));
|
||||
io.jsonwebtoken.lang.Assert.isTrue(update,"修改失败");
|
||||
|
||||
|
||||
activityTeamProductSkuInfoService.updateBath(activityTeamInfoUpdModel.getActivityTeamProductSkuModelList());
|
||||
return update;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updproduct(ActivityUpdTeamModel update) {
|
||||
boolean b = this.updateById(ActivityTeamInfo.activityUpdTeamModel(update));
|
||||
io.jsonwebtoken.lang.Assert.isTrue(b,"修改失败");
|
||||
|
||||
List<ActivityTeamUpdModel> activityTeamUpdModels = update.getActivityTeamUpdModels();
|
||||
List<ActivityTeamAddModel> activityTeamAddModels = update.getActivityTeamAddModels();
|
||||
List<Long> ids = update.getIds();
|
||||
|
||||
activityTeamProductSkuInfoService.updtoBath(activityTeamUpdModels);
|
||||
activityTeamProductSkuInfoService.addBath(activityTeamAddModels);
|
||||
activityTeamProductSkuInfoService.delBath(ids);
|
||||
|
||||
return b;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -27,6 +27,8 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
|||
@Autowired
|
||||
private ProjectSkuCache projectSkuCache;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 通过团购活动ID获取团购中最优惠的价格
|
||||
*
|
||||
|
@ -100,4 +102,43 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
|||
public boolean updateBath(List<ActivityTeamProductSkuReqModel> activityTeamProductSkuReqModelList) {
|
||||
return this.updateBatchById(activityTeamProductSkuReqModelList.stream().map(ActivityTeamProductSkuInfo::updateModelBuild).toList());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean updtoBath(List<ActivityTeamUpdModel> activityTeamUpdModels) {
|
||||
List<ActivityTeamProductSkuInfo> list = activityTeamUpdModels.stream().map(activityTeamUpdModel -> {
|
||||
ActivityTeamProductSkuInfo build = ActivityTeamProductSkuInfo.builder()
|
||||
.id(activityTeamUpdModel.getId())
|
||||
.teamPrice(activityTeamUpdModel.getTeamPrice())
|
||||
.teamStock(activityTeamUpdModel.getTeamStock())
|
||||
.remainStock(activityTeamUpdModel.getTeamStock())
|
||||
.build();
|
||||
return build;
|
||||
}).toList();
|
||||
return this.updateBatchById(list);
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean addBath(List<ActivityTeamAddModel> activityTeamAddModels) {
|
||||
List<ActivityTeamProductSkuInfo> list = activityTeamAddModels.stream().map(activityTeamAddModel -> {
|
||||
ActivityTeamProductSkuInfo build = ActivityTeamProductSkuInfo.builder()
|
||||
.productSku(activityTeamAddModel.getProduckSku())
|
||||
.teamPrice(activityTeamAddModel.getTeamPrice())
|
||||
.teamStock(activityTeamAddModel.getTeamStock())
|
||||
.build();
|
||||
|
||||
return build;
|
||||
}).toList();
|
||||
|
||||
return this.saveBatch(list);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean delBath(List<Long> ids) {
|
||||
boolean b = this.removeBatchByIds(ids);
|
||||
return b;
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue