2204A-cyj(客户端拼团列表)
parent
46a7e2e8db
commit
e4580e8bd1
|
@ -0,0 +1,57 @@
|
||||||
|
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);
|
||||||
|
};
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -66,7 +66,6 @@ public class ActivityTeamProductSkuInfo extends BaseEntity {
|
||||||
.productId(activityTeamProductSkuAddModel.getProductId())
|
.productId(activityTeamProductSkuAddModel.getProductId())
|
||||||
.teamId(activityTeamProductSkuAddModel.getTeamId())
|
.teamId(activityTeamProductSkuAddModel.getTeamId())
|
||||||
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
.teamStock(activityTeamProductSkuAddModel.getTeamStock())
|
||||||
// .remainStock(activityTeamProductSkuAddModel.getTeamStock())
|
|
||||||
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
|
.teamPrice(activityTeamProductSkuAddModel.getTeamPrice())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
|
@ -37,7 +37,7 @@ public class ActivityTeamProductSkuUpdModel {
|
||||||
/**
|
/**
|
||||||
* 规格SKU
|
* 规格SKU
|
||||||
*/
|
*/
|
||||||
private String productSku;
|
private String productSku;
|
||||||
/**
|
/**
|
||||||
* 团购价格
|
* 团购价格
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -6,6 +6,7 @@ package com.muyu.marketing.domain.resp;
|
||||||
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.muyu.common.core.web.domain.BaseEntity;
|
import com.muyu.common.core.web.domain.BaseEntity;
|
||||||
|
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoSelectModel;
|
import com.muyu.marketing.domain.model.ActivityTeamInfoSelectModel;
|
||||||
import lombok.AllArgsConstructor;
|
import lombok.AllArgsConstructor;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
@ -26,6 +27,7 @@ import java.util.List;
|
||||||
@EqualsAndHashCode(callSuper = true)
|
@EqualsAndHashCode(callSuper = true)
|
||||||
public class ActivityTeamInfoResp extends BaseEntity {
|
public class ActivityTeamInfoResp extends BaseEntity {
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团活动id
|
* 拼团活动id
|
||||||
*/
|
*/
|
||||||
|
@ -107,4 +109,22 @@ public class ActivityTeamInfoResp extends BaseEntity {
|
||||||
.strategyId(teamSelectModel.getStrategyId())
|
.strategyId(teamSelectModel.getStrategyId())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
/** 构造 */
|
||||||
|
public static ActivityTeamInfoResp client(ActivityTeamInfo activityTeamInfo) {
|
||||||
|
return ActivityTeamInfoResp.builder()
|
||||||
|
.teamId(activityTeamInfo.getId())
|
||||||
|
.name(activityTeamInfo.getName())
|
||||||
|
.productId(activityTeamInfo.getProductId())
|
||||||
|
.productImage(activityTeamInfo.getProductImage())
|
||||||
|
.introduction(activityTeamInfo.getIntroduction())
|
||||||
|
.unit(activityTeamInfo.getUnit())
|
||||||
|
.imageList(activityTeamInfo.getImageList())
|
||||||
|
.endTime(activityTeamInfo.getEndTime())
|
||||||
|
.sort(activityTeamInfo.getSort())
|
||||||
|
.content(activityTeamInfo.getContent())
|
||||||
|
.status(activityTeamInfo.getStatus())
|
||||||
|
.strategyType(activityTeamInfo.getStrategyType())
|
||||||
|
.strategyId(activityTeamInfo.getStrategyId())
|
||||||
|
.build();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,6 +9,9 @@ import lombok.NoArgsConstructor;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 拼团活动展示Resp
|
||||||
|
*/
|
||||||
@Data
|
@Data
|
||||||
@Builder
|
@Builder
|
||||||
@NoArgsConstructor
|
@NoArgsConstructor
|
||||||
|
@ -86,4 +89,5 @@ public class TeamInfoListResp {
|
||||||
.teamStock(activityTeamInfoListModel.getTeamStock())
|
.teamStock(activityTeamInfoListModel.getTeamStock())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,7 +43,7 @@ public class TeamProjectSkuInfoResp {
|
||||||
.ruleId(skuInfo.getId())
|
.ruleId(skuInfo.getId())
|
||||||
.sku(skuInfo.getProductSku())
|
.sku(skuInfo.getProductSku())
|
||||||
.teamPrice(skuInfo.getTeamPrice())
|
.teamPrice(skuInfo.getTeamPrice())
|
||||||
// .teamStock(skuInfo.getTeamStock())
|
.teamStock(skuInfo.getTeamStock())
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,7 +1,9 @@
|
||||||
package com.muyu.marketing.team.controller;
|
package com.muyu.marketing.team.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.github.pagehelper.PageInfo;
|
||||||
import com.muyu.common.core.domain.Result;
|
import com.muyu.common.core.domain.Result;
|
||||||
|
import com.muyu.common.core.utils.PageUtils;
|
||||||
import com.muyu.common.core.web.page.TableDataInfo;
|
import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
import com.muyu.marketing.domain.model.ActivityTeamInfoAddModel;
|
||||||
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
import com.muyu.marketing.domain.model.ActivityTeamInfoListModel;
|
||||||
|
@ -31,6 +33,20 @@ public class ActivityTeamController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ActivityTeamInfoService activityTeamInfoService;;
|
private ActivityTeamInfoService activityTeamInfoService;;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 客户端拼团列表
|
||||||
|
*/
|
||||||
|
@PostMapping("/clientList")
|
||||||
|
public Result<PageInfo<ActivityTeamInfoResp>> clientList(@RequestBody TeamInfoListReq teamInfoListReq){
|
||||||
|
PageUtils.startPage(teamInfoListReq.getPageNum(),teamInfoListReq.getPageSize());
|
||||||
|
List<ActivityTeamInfoResp> activityTeamInfoRespList=activityTeamInfoService.clientList(teamInfoListReq);
|
||||||
|
PageInfo<ActivityTeamInfoResp> pageInfo = new PageInfo<>(activityTeamInfoRespList);
|
||||||
|
return Result.success(pageInfo);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询营销团购活动列表
|
* 查询营销团购活动列表
|
||||||
* @param teamInfoListReq 活动查询入参
|
* @param teamInfoListReq 活动查询入参
|
||||||
|
@ -54,7 +70,7 @@ public class ActivityTeamController {
|
||||||
* @param activityTeamInfoSaveReq 添加请求对象
|
* @param activityTeamInfoSaveReq 添加请求对象
|
||||||
* @return 结果集
|
* @return 结果集
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping("/add")
|
||||||
public Result<String> save(@RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq) {
|
public Result<String> save(@RequestBody ActivityTeamInfoSaveReq activityTeamInfoSaveReq) {
|
||||||
activityTeamInfoService.save(ActivityTeamInfoAddModel.addReqBuild(activityTeamInfoSaveReq));
|
activityTeamInfoService.save(ActivityTeamInfoAddModel.addReqBuild(activityTeamInfoSaveReq));
|
||||||
return Result.success();
|
return Result.success();
|
||||||
|
|
|
@ -5,6 +5,10 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
import com.muyu.marketing.domain.model.*;
|
import com.muyu.marketing.domain.model.*;
|
||||||
import com.muyu.marketing.domain.req.ActivityTeamProductSkuInfoUpdReq;
|
import com.muyu.marketing.domain.req.ActivityTeamProductSkuInfoUpdReq;
|
||||||
|
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamInfoResp;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 拼团活动
|
* 拼团活动
|
||||||
|
@ -35,4 +39,7 @@ public interface ActivityTeamInfoService extends IService<ActivityTeamInfo> {
|
||||||
*/
|
*/
|
||||||
void updateTeamInfo(ActivityTeamInfoUpdModel activityTeamInfoUpdModel);
|
void updateTeamInfo(ActivityTeamInfoUpdModel activityTeamInfoUpdModel);
|
||||||
|
|
||||||
|
/** 客户端列表*/
|
||||||
|
List<ActivityTeamInfoResp> clientList(TeamInfoListReq teamInfoListReq);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,17 @@ import com.muyu.common.core.web.page.TableDataInfo;
|
||||||
import com.muyu.marketing.domain.ActivityTeamInfo;
|
import com.muyu.marketing.domain.ActivityTeamInfo;
|
||||||
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
import com.muyu.marketing.domain.ActivityTeamProductSkuInfo;
|
||||||
import com.muyu.marketing.domain.model.*;
|
import com.muyu.marketing.domain.model.*;
|
||||||
import com.muyu.marketing.domain.req.ActivityTeamProductSkuInfoUpdReq;
|
import com.muyu.marketing.domain.req.TeamInfoListReq;
|
||||||
|
import com.muyu.marketing.domain.resp.ActivityTeamInfoResp;
|
||||||
import com.muyu.marketing.team.mapper.ActivityTeamInfoMapper;
|
import com.muyu.marketing.team.mapper.ActivityTeamInfoMapper;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
import com.muyu.marketing.team.service.ActivityTeamInfoService;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
import com.muyu.marketing.team.service.ActivityTeamOpenInfoService;
|
||||||
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
import com.muyu.marketing.team.service.ActivityTeamProductSkuInfoService;
|
||||||
import org.checkerframework.checker.units.qual.A;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.util.Assert;
|
import org.springframework.util.Assert;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -91,6 +92,7 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
||||||
*/
|
*/
|
||||||
@Override
|
@Override
|
||||||
public ActivityTeamInfoSelectModel selectTeamInfo(Long teamId) {
|
public ActivityTeamInfoSelectModel selectTeamInfo(Long teamId) {
|
||||||
|
activityTeamOpenInfoService.getById(teamId);
|
||||||
//根据拼团活动id 查询拼团活动
|
//根据拼团活动id 查询拼团活动
|
||||||
ActivityTeamInfo activityTeamInfo = this.getById(teamId);
|
ActivityTeamInfo activityTeamInfo = this.getById(teamId);
|
||||||
//查询活动中的 商品sku集合
|
//查询活动中的 商品sku集合
|
||||||
|
@ -136,8 +138,28 @@ public class ActivityTeamInfoServiceImpl extends ServiceImpl<ActivityTeamInfoMap
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/** 客户端列表*/
|
||||||
|
@Override
|
||||||
|
public List<ActivityTeamInfoResp> clientList(TeamInfoListReq teamInfoListReq) {
|
||||||
|
LambdaQueryWrapper<ActivityTeamInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||||
|
//查询活动状态
|
||||||
|
if (null != teamInfoListReq.getStatus() && ! "".equals(teamInfoListReq.getStatus())){
|
||||||
|
queryWrapper.eq(ActivityTeamInfo::getStatus,teamInfoListReq.getStatus());
|
||||||
|
}
|
||||||
|
if (null != teamInfoListReq.getKeyWord() && ! "".equals(teamInfoListReq.getKeyWord())){
|
||||||
|
queryWrapper.eq(ActivityTeamInfo::getStatus,teamInfoListReq.getStatus());
|
||||||
|
}
|
||||||
|
//拼团列表
|
||||||
|
List<ActivityTeamInfo> activityTeamInfos = this.list(queryWrapper);
|
||||||
|
//构造成Resp
|
||||||
|
ArrayList<ActivityTeamInfoResp> activityTeamInfoResps = new ArrayList<>();
|
||||||
|
activityTeamInfos.forEach(activityTeamInfo -> {
|
||||||
|
ActivityTeamInfoResp client = ActivityTeamInfoResp.client(activityTeamInfo);
|
||||||
|
activityTeamInfoResps.add(client);
|
||||||
|
});
|
||||||
|
|
||||||
|
return activityTeamInfoResps;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue