12.3功能修改
parent
39c0db585e
commit
6e2314ab3b
|
@ -0,0 +1,32 @@
|
|||
参团:
|
||||
商品列表
|
||||
商品列表接口
|
||||
选择商品
|
||||
商品详情接口
|
||||
一键参团
|
||||
添加数据,修改库存接口
|
||||
前端数据回显
|
||||
回显接口
|
||||
生成订单
|
||||
|
||||
通过时间统计订单 判断是否成功
|
||||
|
||||
|
||||
|
||||
拼团商品详情
|
||||
商品详情接口
|
||||
评价接口
|
||||
统计接口
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
|
@ -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);
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,7 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
|
@ -77,6 +78,12 @@ public class ActivityTeamDetailModel {
|
|||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
|
|
|
@ -8,6 +8,7 @@ import lombok.Builder;
|
|||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
|
@ -52,6 +53,12 @@ public class TeamInfoFindByIdResp {
|
|||
*/
|
||||
|
||||
private String imageList;
|
||||
|
||||
private BigDecimal productPrice;
|
||||
/**
|
||||
* 剩余库存
|
||||
*/
|
||||
private Long remainStock;
|
||||
/**
|
||||
* 活动结束时间
|
||||
*/
|
||||
|
@ -77,6 +84,9 @@ public class TeamInfoFindByIdResp {
|
|||
* 策略类型
|
||||
*/
|
||||
private String strategyType;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 策略ID
|
||||
*/
|
||||
|
@ -102,6 +112,8 @@ public class TeamInfoFindByIdResp {
|
|||
.status(activityTeamDetailModel.getStatus())
|
||||
.strategyType(activityTeamDetailModel.getStrategyType())
|
||||
.strategyId(activityTeamDetailModel.getStrategyId())
|
||||
.remainStock(activityTeamDetailModel.getRemainStock())
|
||||
.productPrice(activityTeamDetailModel.getProductPrice())
|
||||
.build();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,9 +1,6 @@
|
|||
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.ActivityTeamInfo;
|
||||
import com.muyu.marketing.domain.model.*;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoSaveReq;
|
||||
import com.muyu.marketing.domain.req.ActivityTeamInfoUpdReq;
|
||||
|
@ -14,22 +11,17 @@ import com.muyu.marketing.domain.resp.TeamInfoListResp;
|
|||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 营销团购活动控制层
|
||||
*
|
||||
* @author DongZeLiang
|
||||
* @date 2024-11-20 14:25
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/team")
|
||||
public class ActivityTeamController {
|
||||
|
||||
@Autowired
|
||||
private ActivityTeamInfoService activityTeamInfoService;;
|
||||
|
||||
/**
|
||||
* 查询营销团购活动列表
|
||||
* @param teamInfoListReq 活动查询入参
|
||||
|
@ -46,8 +38,6 @@ public class ActivityTeamController {
|
|||
}}
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 添加团购活动
|
||||
* @param activityTeamInfoSaveReq 添加请求对象
|
||||
|
@ -58,7 +48,6 @@ public class ActivityTeamController {
|
|||
activityTeamInfoService.save(ActivityTeamInfoAddModel.addReqBuild(activityTeamInfoSaveReq));
|
||||
return Result.success();
|
||||
}
|
||||
|
||||
@PostMapping("/findById/{id}")
|
||||
public Result<TeamInfoFindByIdResp> findTeamById(@PathVariable Long id){
|
||||
return Result.success(TeamInfoFindByIdResp.teamInfoFindByIdBuild(activityTeamInfoService.findDetailById(id)));
|
||||
|
@ -68,7 +57,6 @@ 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));
|
||||
|
|
|
@ -0,0 +1,10 @@
|
|||
package com.muyu.marketing.team.satery;
|
||||
|
||||
public interface ActivityTeamStratey {
|
||||
public void openTeam(Long activityTeamId);
|
||||
public void ApplyTeam(Long activityTeamId);
|
||||
public void addTeam(Long teamId,Long number);
|
||||
public void backTeam(Long teamId);
|
||||
public void settle(Long team);
|
||||
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
package com.muyu.marketing.team.satery.impl;
|
||||
|
||||
public class ActivityTeamStrateyImpl {
|
||||
|
||||
|
||||
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
package com.muyu.marketing.team.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.muyu.common.core.enums.market.team.TeamOpenTypeEnum;
|
||||
import com.muyu.marketing.domain.ActivityTeamOpenInfo;
|
||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||
|
||||
public interface ActivityTeamOpenInfoService extends IService<ActivityTeamOpenInfo> {
|
||||
|
||||
/**
|
||||
|
|
|
@ -108,7 +108,6 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
boolean update = this.updateById(ActivityTeamInfo.TeamUpdateBuild(activityTeamInfoUpdModel));
|
||||
io.jsonwebtoken.lang.Assert.isTrue(update,"修改失败");
|
||||
|
||||
|
||||
activityTeamProductSkuInfoService.updateBath(activityTeamInfoUpdModel.getActivityTeamProductSkuModelList());
|
||||
return update;
|
||||
}
|
||||
|
@ -117,17 +116,12 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
|||
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;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,7 +11,6 @@ import org.springframework.stereotype.Service;
|
|||
@Service
|
||||
public class ActivityTeamOpenInfoServiceImpl extends ServiceImpl<ActivityTeamOpenInfoMapper, ActivityTeamOpenInfo>
|
||||
implements ActivityTeamOpenInfoService {
|
||||
|
||||
/**
|
||||
* 通过活动ID和开团类型查询开团数量
|
||||
*
|
||||
|
|
|
@ -51,7 +51,6 @@ public class ActivityTeamProductSkuInfoServiceImpl extends ServiceImpl<ActivityT
|
|||
}
|
||||
return discountPriceModelOptional.get();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过活动ID获取 剩余库存
|
||||
*
|
||||
|
|
|
@ -7,6 +7,8 @@ spring:
|
|||
application:
|
||||
# 应用名称
|
||||
name: muyu-activity
|
||||
main:
|
||||
allow-circular-references: true
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
|
|
|
@ -86,6 +86,11 @@ public class CommentInfoController extends BaseController {
|
|||
return toAjax(commentInfoService.save(CommentInfo.saveBuild(commentInfoSaveReq)));
|
||||
}
|
||||
|
||||
@PostMapping("/tocomment/{id}")
|
||||
public Result<List<CommentInfo>> commentInfoResult(@PathVariable Long id){
|
||||
return Result.success(commentInfoService.commentInfoId(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改商品评论
|
||||
*/
|
||||
|
|
|
@ -19,4 +19,5 @@ public interface CommentInfoService extends IService<CommentInfo> {
|
|||
*/
|
||||
public List<CommentInfo> list(CommentInfo commentInfo);
|
||||
|
||||
List<CommentInfo> commentInfoId(Long id);
|
||||
}
|
||||
|
|
|
@ -54,4 +54,13 @@ public class CommentInfoServiceImpl extends ServiceImpl<CommentInfoMapper, Comme
|
|||
|
||||
return list(queryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<CommentInfo> commentInfoId(Long id) {
|
||||
LambdaQueryWrapper<CommentInfo> commentInfoLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
commentInfoLambdaQueryWrapper.eq(CommentInfo::getProjectId,id);
|
||||
List<CommentInfo> list = this.list(commentInfoLambdaQueryWrapper);
|
||||
return list;
|
||||
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue