feat(): 完善修改功能

1127/masongjia
masongjia 2024-11-29 16:49:28 +08:00
parent 907b0d1356
commit a0c45eb624
7 changed files with 138 additions and 7 deletions

57
doc/策略.md 100644
View File

@ -0,0 +1,57 @@
1. 选择商品 商品详情 立即参团 邀请参团 支付尾款 查看订单
2. 选择商品 商品详情 一键开团 选择规格 邀请参团 支付尾款 查看订单
3. 重新开团
---------------------------------------------------
1. 商品详情 销量 库存 浏览量 评价1
2. 还差几人成团
3. 收藏
---------------------------------------------------

View File

@ -0,0 +1,58 @@
package com.muyu.gateway.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.HttpStatus;
import org.springframework.http.server.reactive.ServerHttpRequest;
import org.springframework.http.server.reactive.ServerHttpResponse;
import org.springframework.web.cors.reactive.CorsUtils;
import org.springframework.web.server.ServerWebExchange;
import org.springframework.web.server.WebFilter;
import org.springframework.web.server.WebFilterChain;
import reactor.core.publisher.Mono;
/**
*
*
* @author ruoyi
*/
@Configuration
public class CorsConfig
{
/**
* header
*/
private static final String ALLOWED_HEADERS = "X-Requested-With, Content-Type, Authorization, credential, X-XSRF-TOKEN, token, Admin-Token, App-Token";
private static final String ALLOWED_METHODS = "GET,POST,PUT,DELETE,OPTIONS,HEAD";
private static final String ALLOWED_ORIGIN = "*";
private static final String ALLOWED_EXPOSE = "*";
private static final String MAX_AGE = "18000L";
@Bean
public WebFilter corsFilter()
{
return (ServerWebExchange ctx, WebFilterChain chain) -> {
ServerHttpRequest request = ctx.getRequest();
if (CorsUtils.isCorsRequest(request))
{
ServerHttpResponse response = ctx.getResponse();
HttpHeaders headers = response.getHeaders();
headers.add("Access-Control-Allow-Headers", ALLOWED_HEADERS);
headers.add("Access-Control-Allow-Methods", ALLOWED_METHODS);
headers.add("Access-Control-Allow-Origin", ALLOWED_ORIGIN);
headers.add("Access-Control-Expose-Headers", ALLOWED_EXPOSE);
headers.add("Access-Control-Max-Age", MAX_AGE);
headers.add("Access-Control-Allow-Credentials", "true");
if (request.getMethod() == HttpMethod.OPTIONS)
{
response.setStatusCode(HttpStatus.OK);
return Mono.empty();
}
}
return chain.filter(ctx);
};
}
}

View File

@ -61,6 +61,7 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
.teamId(activityTeamProductSkuAddModel.getTeamId())
.productId(activityTeamProductSkuAddModel.getProductId())
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
.productSku(activityTeamProductSkuAddModel.getSku())
.remainStock(activityTeamProductSkuAddModel.getTeamStock())
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
.build();

View File

@ -90,6 +90,7 @@ public class ActivityTeamInfoUpdModel {
.status(activityTeamInfoUpdRequest.getStatus())
.strategyType(activityTeamInfoUpdRequest.getStrategyType())
.strategyId(activityTeamInfoUpdRequest.getStrategyId())
.activityTeamProductSkuInfoAllUpdModel(ActivityTeamProductSkuInfoAllUpdModel.activityTeamProductSkuInfoAllUpdModelBulider(activityTeamInfoUpdRequest.getActivityTeamProductSkuInfoAllUpdRequest()))
.build();
}

View File

@ -1,12 +1,12 @@
package com.muyu.marketing.team.controller;
import com.dtflys.forest.annotation.Get;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.muyu.common.core.domain.Result;
import com.muyu.common.core.web.page.TableDataInfo;
import com.muyu.marketing.domain.ActivityTeamInfo;
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
import com.muyu.marketing.domain.model.ActivityTeamInfoModel;
import com.muyu.marketing.domain.model.ActivityTeamInfoUpdModel;
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
import com.muyu.marketing.domain.req.ActivityTeamInfoUpdRequest;
@ -83,4 +83,10 @@ public class ActivityTeamController {
this.activityTeamInfoService.activityTeamInfoUpd(ActivityTeamInfoUpdModel.ActivityTeamInfoUpdModelBulider(activityTeamInfoUpdRequest));
return Result.success("修改成功");
}
@GetMapping("/marketinglist")
public Result marketinglist(){
List<ActivityTeamInfo> list = activityTeamInfoService.list(new LambdaQueryWrapper<ActivityTeamInfo>());
return Result.success(list);
}
}

View File

@ -81,9 +81,13 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
@Override
public void save(ActivityTeamInfoAddModel activityTeamInfoAddModel) {
ActivityTeamInfo activityTeamInfo = ActivityTeamInfo.addModelBuild(activityTeamInfoAddModel);
Assert.isTrue(this.save(activityTeamInfo), StringUtils.format("团购活动添加失败:[{}]", activityTeamInfoAddModel));
List<ActivityTeamProductSkuAddModel> teamProductSkuAddModelList = activityTeamInfoAddModel.getActivityTeamProductSkuAddModelList();
teamProductSkuAddModelList.forEach(activityTeamProductSkuAddModel -> activityTeamProductSkuAddModel.setTeamId(activityTeamInfo.getId()));
this.activityTeamProductSkuInfoService.batchSave(teamProductSkuAddModelList);
}
@ -114,15 +118,13 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
List<ActivityTeamProductSkuAddModel> teamProductSkuAddModelList =
activityTeamInfoUpdModel.getActivityTeamProductSkuInfoAllUpdModel().getActivityTeamProductSkuAddModelList();
teamProductSkuAddModelList.forEach(
activityTeamProductSkuAddModel -> activityTeamProductSkuAddModel.setTeamId(activityTeamInfoUpdModel.getId()));
teamProductSkuAddModelList.forEach(activityTeamProductSkuAddModel -> activityTeamProductSkuAddModel.setTeamId(activityTeamInfoUpdModel.getId()));
this.activityTeamProductSkuInfoService.batchSave(teamProductSkuAddModelList);
this.activityTeamProductSkuInfoService.activityTeamProductSkuInfoUpd(activityTeamInfoUpdModel
.getActivityTeamProductSkuInfoAllUpdModel().getActivityTeamProductSkuInfoUpdModelList());
}

View File

@ -76,7 +76,13 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
if (activityTeamProductSkuAddModelList == null || activityTeamProductSkuAddModelList.isEmpty()) {
throw new ServiceException("入参添加商品规格模型,不可为空");
}
this.saveBatch(activityTeamProductSkuAddModelList.stream().map(ActivityTeamProductSkuInfo::modelBuild).toList());
this.saveBatch(
activityTeamProductSkuAddModelList.stream()
.map(ActivityTeamProductSkuInfo::modelBuild)
.toList()
);
}
@ -102,8 +108,8 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
List<ActivityTeamProductSkuInfo> list = activityTeamProductSkuInfoUpdModelList
.stream().map(ActivityTeamProductSkuInfo::ActivityTeamProductSkuInfoUpdBuilder)
.toList();
this.updateBatchById(list);
this.updateBatchById(list);
}