|
|
@ -3,6 +3,7 @@ package org.jeecg.api.service.impl; |
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
|
|
|
import org.jeecg.api.service.ApiRiceService; |
|
|
|
import org.jeecg.bean.PageBean; |
|
|
|
import org.jeecg.common.api.vo.Result; |
|
|
|
import org.jeecg.modules.commonAddress.entity.CommonAddress; |
|
|
|
import org.jeecg.modules.commonAddress.service.ICommonAddressService; |
|
|
@ -10,6 +11,7 @@ import org.jeecg.modules.commonBanner.entity.CommonBanner; |
|
|
|
import org.jeecg.modules.commonBanner.service.ICommonBannerService; |
|
|
|
import org.jeecg.modules.commonCat.entity.CommonCat; |
|
|
|
import org.jeecg.modules.commonCat.service.ICommonCatService; |
|
|
|
import org.jeecg.modules.commonClass.entity.CommonClass; |
|
|
|
import org.jeecg.modules.commonClass.service.ICommonClassService; |
|
|
|
import org.jeecg.modules.commonConfig.service.ICommonConfigService; |
|
|
|
import org.jeecg.modules.commonIconImage.entity.CommonIconImage; |
|
|
@ -35,7 +37,10 @@ import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
|
|
|
|
import javax.annotation.Resource; |
|
|
|
import java.util.Date; |
|
|
|
import java.util.HashMap; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Service |
|
|
|
public class ApiRiceServiceImpl implements ApiRiceService { |
|
|
@ -76,6 +81,7 @@ public class ApiRiceServiceImpl implements ApiRiceService { |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取首页轮播图 |
|
|
|
@Override |
|
|
|
public Result<?> getRiceBanner() { |
|
|
@ -122,6 +128,27 @@ public class ApiRiceServiceImpl implements ApiRiceService { |
|
|
|
return Result.OK(list); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
public Result<?> getClassShopPageList(PageBean pageBean,String classId){ |
|
|
|
Page<CommonShop> page = new Page<CommonShop>(pageBean.getPageNo(), pageBean.getPageSize()); |
|
|
|
Page<CommonShop> page1 = commonShopService.page(page); |
|
|
|
//如果分类标识不为空 |
|
|
|
if(classId!=null){ |
|
|
|
IPage<CommonShop> pageList = |
|
|
|
commonShopService.lambdaQuery() |
|
|
|
.eq(CommonShop::getClassId,classId) |
|
|
|
.orderByDesc(CommonShop::getCreateTime) |
|
|
|
.page(page); |
|
|
|
return Result.OK(pageList); |
|
|
|
} |
|
|
|
return Result.OK(page1); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
//获取首页商品详情 |
|
|
|
@Override |
|
|
|
public Result<?> getRiceProductDetail(String id){ |
|
|
@ -144,6 +171,13 @@ public class ApiRiceServiceImpl implements ApiRiceService { |
|
|
|
//获取首页新闻详情 |
|
|
|
@Override |
|
|
|
public Result<?> getRiceNewsDetail(String id) { |
|
|
|
RiceNews byId = riceNewsService.getById(id); |
|
|
|
return Result.OK(byId); |
|
|
|
} |
|
|
|
|
|
|
|
//获取首页新闻详情 |
|
|
|
@Override |
|
|
|
public Result<?> getCommonNewsDetail(String id) { |
|
|
|
CommonNews byId = commonNewsService.getById(id); |
|
|
|
return Result.OK(byId); |
|
|
|
} |
|
|
@ -152,14 +186,59 @@ public class ApiRiceServiceImpl implements ApiRiceService { |
|
|
|
//创建订单 |
|
|
|
@Override |
|
|
|
public Result<?> createOrder(String token,String productId,Integer num) { |
|
|
|
CommonShop commonShop = commonShopService.getById(productId); |
|
|
|
if (commonShop==null){ |
|
|
|
return Result.error("商品不存在"); |
|
|
|
} |
|
|
|
CommonOrder commonOrder = new CommonOrder(); |
|
|
|
commonOrder.setTitle("测试生成"); |
|
|
|
commonOrder.setTitle(commonShop.getTitle()); |
|
|
|
commonOrder.setImage(commonShop.getImage()); |
|
|
|
commonOrder.setCreateTime(new Date()); |
|
|
|
commonOrder.setState("0"); |
|
|
|
|
|
|
|
commonOrderService.save(commonOrder); |
|
|
|
|
|
|
|
|
|
|
|
//生成流水数据 |
|
|
|
CommonMoneyLog commonMoneyLog = new CommonMoneyLog(); |
|
|
|
commonMoneyLog.setCreateTime(new Date()); |
|
|
|
commonMoneyLog.setTitle("测试收入"); |
|
|
|
commonMoneyLog.setMoney(commonShop.getPrice()); |
|
|
|
commonMoneyLog.setType(1); |
|
|
|
commonMoneyLogService.save(commonMoneyLog); |
|
|
|
|
|
|
|
|
|
|
|
CommonMoneyLog commonMoneyLog2 = new CommonMoneyLog(); |
|
|
|
commonMoneyLog2.setCreateTime(new Date()); |
|
|
|
commonMoneyLog2.setTitle("测试支出"); |
|
|
|
commonMoneyLog2.setMoney(commonShop.getPrice()); |
|
|
|
commonMoneyLog2.setType(0); |
|
|
|
commonMoneyLogService.save(commonMoneyLog); |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return Result.OK("创建成功"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//加入购物车 |
|
|
|
@Override |
|
|
|
public Result<?> addCart(String token,String productId,Integer num){ |
|
|
|
//根据商品标识查询商品信息 |
|
|
|
CommonShop commonShop = commonShopService.getById(productId); |
|
|
|
if (commonShop==null){ |
|
|
|
return Result.error("商品不存在"); |
|
|
|
} |
|
|
|
|
|
|
|
CommonCat commonCat = new CommonCat(); |
|
|
|
commonCat.setTitle(commonShop.getTitle()); |
|
|
|
commonCat.setImage(commonShop.getImage()); |
|
|
|
commonCat.setNum(num); |
|
|
|
commonCat.setCreateTime(new Date()); |
|
|
|
commonCatService.save(commonCat); |
|
|
|
return Result.OK("加入成功"); |
|
|
|
} |
|
|
|
|
|
|
|
//获取会员权益信息列表 |
|
|
|
@Override |
|
|
@ -198,9 +277,9 @@ public class ApiRiceServiceImpl implements ApiRiceService { |
|
|
|
|
|
|
|
//获取购物车信息列表带分页 |
|
|
|
@Override |
|
|
|
public Result<?> getCartPageList(){ |
|
|
|
List<CommonCat> list = commonCatService.list(); |
|
|
|
return Result.OK(list); |
|
|
|
public Result<?> getCartPageList(PageBean pageBean){ |
|
|
|
Page<CommonCat> page = commonCatService.page(new Page<>(1, 10)); |
|
|
|
return Result.OK(page); |
|
|
|
} |
|
|
|
|
|
|
|
//获取地址列表带分页 |
|
|
@ -218,8 +297,43 @@ public class ApiRiceServiceImpl implements ApiRiceService { |
|
|
|
|
|
|
|
//获取相关介绍 |
|
|
|
@Override |
|
|
|
public Result<?> getInfoIntroduce(){ |
|
|
|
List<RiceNews> list = riceNewsService.list(); |
|
|
|
public Result<?> getInfoIntroduce(String type){ |
|
|
|
Page<RiceNews> page = riceNewsService |
|
|
|
.lambdaQuery() |
|
|
|
.eq(RiceNews::getType,type) |
|
|
|
.page(new Page<>(1, 10)); |
|
|
|
return Result.OK(page); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查询分类接口 |
|
|
|
@Override |
|
|
|
public Result<?> getCategoryList(){ |
|
|
|
List<CommonClass> list = commonClassService.list(); |
|
|
|
return Result.OK(list); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//增加或者修改地址 |
|
|
|
@Override |
|
|
|
public Result<?> addOrUpdateAddress(CommonAddress commonAddress){ |
|
|
|
commonAddressService.saveOrUpdate(commonAddress); |
|
|
|
return Result.OK("增加成功"); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查询个人信息相关 |
|
|
|
@Override |
|
|
|
public Result<?> getRiceInfo(String token){ |
|
|
|
Map map = new HashMap(); |
|
|
|
//余额、可提现、收益明细 |
|
|
|
map.put("balance",10); |
|
|
|
map.put("canWithdraw",20); |
|
|
|
map.put("income",30); |
|
|
|
//黄金会员 |
|
|
|
map.put("goldenMember",0); |
|
|
|
//当前会员人数 |
|
|
|
map.put("memberNum",10); |
|
|
|
return Result.OK(map); |
|
|
|
} |
|
|
|
} |