Browse Source

1、补充文创好物订单详情

2、补充文创好物是否被收藏
master
Augcl 8 months ago
parent
commit
a8f64e5695
4 changed files with 87 additions and 13 deletions
  1. +9
    -2
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/travelController/IndexApiController.java
  2. +21
    -0
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiBean/WaresApiBean.java
  3. +4
    -1
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/IndexApiService.java
  4. +53
    -10
      jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/IndexApiServiceImpl.java

+ 9
- 2
jeecg-boot-module-system/src/main/java/org/jeecg/modules/api/travelController/IndexApiController.java View File

@ -148,8 +148,8 @@ public class IndexApiController {
//获取文创好物详情 //获取文创好物详情
@ApiOperation(value="文创好物-获取商品详情", notes="文创好物-获取商品详情") @ApiOperation(value="文创好物-获取商品详情", notes="文创好物-获取商品详情")
@RequestMapping(value = "/queryWaresById", method = {RequestMethod.GET}) @RequestMapping(value = "/queryWaresById", method = {RequestMethod.GET})
public Result<?> queryWaresById(String waresId){
return indexApiService.queryWaresById(waresId);
public Result<?> queryWaresById(String token, String waresId){
return indexApiService.queryWaresById(token, waresId);
} }
//查询文创好物订单信息 //查询文创好物订单信息
@ -159,6 +159,13 @@ public class IndexApiController {
return indexApiService.queryWaresOrderList(token, status, pageBean); return indexApiService.queryWaresOrderList(token, status, pageBean);
} }
//查询文创好物订单详情
@ApiOperation(value="文创好物-查询文创好物订单详情", notes="文创好物-查询文创好物订单详情")
@RequestMapping(value = "/queryWaresOrderById", method = {RequestMethod.GET})
public Result<?> queryWaresOrderById(@RequestHeader("X-Access-Token") String token, String waresOrderId){
return indexApiService.queryWaresOrderById(token, waresOrderId);
}
//创建文创好物订单 //创建文创好物订单
@ApiOperation(value = "文创好物-创建文创好物订单",notes = "文创好物-创建文创好物订单") @ApiOperation(value = "文创好物-创建文创好物订单",notes = "文创好物-创建文创好物订单")
@PostMapping("/addWaresOrder") @PostMapping("/addWaresOrder")


+ 21
- 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiBean/WaresApiBean.java View File

@ -0,0 +1,21 @@
package org.jeecg.modules.apiBean;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.jeecg.modules.travelWares.entity.TravelWares;
@Data
public class WaresApiBean {
@ApiModelProperty(value = "是否被收藏标识:true-是 false-否" )
private Boolean collectonFlag;
TravelWares travelWares;
public WaresApiBean(Boolean collectonFlag) {
this.collectonFlag = collectonFlag;
}
public WaresApiBean() {
this.collectonFlag = false;
}
}

+ 4
- 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/IndexApiService.java View File

@ -105,6 +105,9 @@ public interface IndexApiService {
//查询文创好物订单列表 //查询文创好物订单列表
public Result<?> queryWaresOrderList(String token, String status, PageBean pageBean); public Result<?> queryWaresOrderList(String token, String status, PageBean pageBean);
//查询文创好物订单详情
public Result<?> queryWaresOrderById(String token, String waresOrderId);
//创建创好物订单 //创建创好物订单
public Result<?> addWaresOrder(String token, TravelWaresOrder travelWaresOrder); public Result<?> addWaresOrder(String token, TravelWaresOrder travelWaresOrder);
@ -112,7 +115,7 @@ public interface IndexApiService {
public Result<?> queryWaresList(PageBean pageBean); public Result<?> queryWaresList(PageBean pageBean);
//根据Id获取文创好物详情 //根据Id获取文创好物详情
public Result<?> queryWaresById(String waresId);
public Result<?> queryWaresById(String token, String waresId);
//获取购物车列表 //获取购物车列表
public Result<?> queryShopcarList(String token, PageBean pageBean); public Result<?> queryShopcarList(String token, PageBean pageBean);


+ 53
- 10
jeecg-boot-module-system/src/main/java/org/jeecg/modules/apiService/impl/IndexApiServiceImpl.java View File

@ -390,7 +390,7 @@ public class IndexApiServiceImpl implements IndexApiService {
case "4": areaId = "1835296680814776322"; case "4": areaId = "1835296680814776322";
break; break;
default: default:
return Result.OK("所属区域参数输入错误,请重新输入:areaId:0-瓷都镇区 1-湖田片区 2-高岭片区 3-瑶里片区 4-蛟潭片区");
areaId = null;
} }
} }
@ -822,6 +822,7 @@ public class IndexApiServiceImpl implements IndexApiService {
} }
//分页显示 //分页显示
List<Object> pageList = new ArrayList<>();
//页码 //页码
int pageNo = pageBean.getPageNo(); int pageNo = pageBean.getPageNo();
//每一页展示数量 //每一页展示数量
@ -829,7 +830,7 @@ public class IndexApiServiceImpl implements IndexApiService {
//数据总量 //数据总量
int listCount = cellectionList.size(); int listCount = cellectionList.size();
if(listCount < 1){ if(listCount < 1){
return Result.OK("没有收藏");
return Result.OK("没有收藏项目,请先去收藏!", pageList);
} }
//总页数 //总页数
int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1; int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1;
@ -848,7 +849,7 @@ public class IndexApiServiceImpl implements IndexApiService {
endIndex = listCount; endIndex = listCount;
} }
List<Object> pageList = cellectionList.subList(startIndex,endIndex);
pageList = cellectionList.subList(startIndex,endIndex);
return Result.OK("我的收藏列表", pageList); return Result.OK("我的收藏列表", pageList);
} }
@ -1133,14 +1134,41 @@ public class IndexApiServiceImpl implements IndexApiService {
//根据Id获取文创好物详情 //根据Id获取文创好物详情
@Override @Override
public Result<?> queryWaresById(String waresId) {
public Result<?> queryWaresById(String token, String waresId) {
TravelWares one = travelWaresService
TravelWares wares = travelWaresService
.lambdaQuery() .lambdaQuery()
.eq(TravelWares::getId, waresId) .eq(TravelWares::getId, waresId)
.one(); .one();
return Result.OK("文创好物详情", one);
//如果用户是登录状态查询该用户的收藏列表
List<TravelCollection> collectionList = null;
if(null != token){
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);
collectionList = travelCollectionService
.lambdaQuery()
.eq(TravelCollection::getUserId, hanHaiMember.getId())
.list();
}
//判断该项目是否被用户收藏
boolean collectionFlag = false;
if(null != collectionList){
for (TravelCollection collection : collectionList) {
if(wares.getId() .equals(collection.getItemId())){
collectionFlag = true;
break;
}
}
}
WaresApiBean waresApiBean = new WaresApiBean();
waresApiBean.setCollectonFlag(collectionFlag);
waresApiBean.setTravelWares(wares);
return Result.OK("文创好物详情", waresApiBean);
} }
//获取文创好物订单列表 //获取文创好物订单列表
@ -1190,6 +1218,7 @@ public class IndexApiServiceImpl implements IndexApiService {
} }
//分页查询 //分页查询
List<WaresOrderApiBean> pageList = new ArrayList<>();
//页码 //页码
int pageNo = pageBean.getPageNo(); int pageNo = pageBean.getPageNo();
//每一页展示数量 //每一页展示数量
@ -1198,7 +1227,7 @@ public class IndexApiServiceImpl implements IndexApiService {
int listCount = waresOrderApiBeans.size(); int listCount = waresOrderApiBeans.size();
if(listCount < 1){ if(listCount < 1){
//没有数据 //没有数据
Result.OK("没有订单,请先去创建订单!");
Result.OK("没有订单,请先去创建订单!", pageList);
} }
//总页数 //总页数
int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1; int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1;
@ -1217,11 +1246,24 @@ public class IndexApiServiceImpl implements IndexApiService {
endIndex = listCount; endIndex = listCount;
} }
List<WaresOrderApiBean> pageList = waresOrderApiBeans.subList(startIndex,endIndex);
pageList = waresOrderApiBeans.subList(startIndex,endIndex);
return Result.OK("文创好物订单列表", pageList); return Result.OK("文创好物订单列表", pageList);
} }
//根据Id获取文创好物订单详情
@Override
public Result<?> queryWaresOrderById(String token, String waresOrderId) {
HanHaiMember hanHaiMember = shiroRealm.checkUserTokenIsEffectHanHaiOpenId(token);
TravelWares one = travelWaresService
.lambdaQuery()
.eq(TravelWares::getId, waresOrderId)
.one();
return Result.OK("文创好物详情", one);
}
//创建文创好物订单 //创建文创好物订单
@Override @Override
public Result<?> addWaresOrder(String token, TravelWaresOrder travelWaresOrder) { public Result<?> addWaresOrder(String token, TravelWaresOrder travelWaresOrder) {
@ -1328,6 +1370,7 @@ public class IndexApiServiceImpl implements IndexApiService {
} }
//分页查询 //分页查询
List<ShopcarApiBean> pageList = new ArrayList<>();
//页码 //页码
int pageNo = pageBean.getPageNo(); int pageNo = pageBean.getPageNo();
//每一页展示数量 //每一页展示数量
@ -1336,7 +1379,7 @@ public class IndexApiServiceImpl implements IndexApiService {
int listCount = shopcarApiBeanList.size(); int listCount = shopcarApiBeanList.size();
if(listCount < 1){ if(listCount < 1){
//没有数据 //没有数据
return null;
Result.OK("购物车列表没有数据,请先去添加购物车!", pageList);
} }
//总页数 //总页数
int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1; int pageCount = listCount%pageSize==0?listCount/pageSize:listCount/pageSize+1;
@ -1355,7 +1398,7 @@ public class IndexApiServiceImpl implements IndexApiService {
endIndex = listCount; endIndex = listCount;
} }
List<ShopcarApiBean> pageList = shopcarApiBeanList.subList(startIndex,endIndex);
pageList = shopcarApiBeanList.subList(startIndex,endIndex);
return Result.OK("购物车列表", pageList); return Result.OK("购物车列表", pageList);
} }


Loading…
Cancel
Save