diff --git a/ant-design-vue-jeecg/src/views/shopping/components/collection.vue b/ant-design-vue-jeecg/src/views/shopping/components/collection.vue index b8a9c455..eefc27d1 100644 --- a/ant-design-vue-jeecg/src/views/shopping/components/collection.vue +++ b/ant-design-vue-jeecg/src/views/shopping/components/collection.vue @@ -1,16 +1,16 @@ diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java index cce126b6..82f70adc 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java @@ -3,24 +3,34 @@ package org.jeecg.modules.system.controller; import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONObject; +import com.google.common.base.Joiner; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.lang3.StringUtils; import org.apache.shiro.SecurityUtils; import org.aspectj.apache.bcel.generic.RET; import org.jeecg.common.api.vo.Result; import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.system.vo.LoginUser; import org.jeecg.modules.base.service.BaseCommonService; +import org.jeecg.modules.demo.customercollectgoods.entity.Customercollectgoods; +import org.jeecg.modules.demo.customercollectgoods.service.ICustomercollectgoodsService; +import org.jeecg.modules.demo.customershoppingcart.entity.CustomerShoppingCart; +import org.jeecg.modules.demo.customershoppingcart.service.ICustomerShoppingCartService; +import org.jeecg.modules.demo.zygoods.entity.ZyGoods; +import org.jeecg.modules.demo.zygoods.service.IZyGoodsService; import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.service.ISysUserService; +import org.jeecg.modules.system.vo.Grzx1; +import org.jeecg.modules.system.vo.Grzx2; +import org.jeecg.modules.system.vo.Grzx3; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.HttpRequest; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.lang.reflect.Field; -import java.util.Date; -import java.util.HashMap; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /* 这个是个人中心专用控制器,之前全都写在SysUserController(用户控制器里面,感觉不妥)因此就专门拖出来一个 @@ -34,6 +44,15 @@ public class ApeopersionController { @Autowired private ISysUserService sysUserService; + @Autowired + private ICustomercollectgoodsService customercollectgoodsService; + + @Autowired + private IZyGoodsService zyGoodsService; + + @Autowired + private ICustomerShoppingCartService customerShoppingCartService; + /* 个人中心,我的账户的数据获取 @@ -44,15 +63,15 @@ public class ApeopersionController { String id = loginUser.getId(); SysUser syu = new SysUser(); syu = sysUserService.getneeduser(id); + findgoods(); return Result.ok(syu); } - +//个人中心的我的账户页面需要的数据 @RequestMapping(value = "/updateneeduser", method = RequestMethod.GET) public Result updateneeduser(@RequestParam(name = "form", required = true) String form) { Map map = JSON.parseObject(form,Map.class); - System.out.println(map); String id = (String) map.get("id"); String sex= map.get("sex").toString(); String birthday= (String) map.get("birthday"); @@ -60,6 +79,80 @@ public class ApeopersionController { String phone= (String) map.get("phone"); String email= (String) map.get("email"); sysUserService.updateneed(id,sex,birthday,realname,phone,email); + return Result.ok("success"); } + + //个人中心的我的收藏的首页需要的数据 + @RequestMapping(value = "/findallcg", method = RequestMethod.GET) + public Result findgoods() { + //获取当前登人的信息 + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + String userid = loginUser.getUsername(); + List g3 = new ArrayList<>(); + //根据当前登的人获取收藏夹里面的搜藏的商品的名称及其款式 + g3 = sysUserService.getscgoods(userid); + //获取的是辅料 + List s1 =new ArrayList<>(); + //获取的是面料 + List s2 =new ArrayList<>(); + //把获取的商品信息导入到新的list里面 + for (int i=0;i findgoods(@RequestParam(name = "id", required = true) String id) { + //这里方便获取当前登陆信息 + LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal(); + //这里获取当前登陆的id + String userid = loginUser.getId(); + //这里获取当前登陆的真实姓名 + String rlname = loginUser.getRealname(); + //这个是根据goodid查询收藏的场频的信息 + Customercollectgoods ccs = customercollectgoodsService.getById(id); + String goodid= ccs.getGoodsId(); + //根据goodid查询goods的对象 + ZyGoods zyd =zyGoodsService.getById(goodid); + //初始化购物车对象 + CustomerShoppingCart cst =new CustomerShoppingCart(); + //开始组装购物车对象 + cst.setUserId(userid); + cst.setUsername(rlname); + cst.setGoodsId(zyd.getId()); + cst.setGoodsname(zyd.getGoodsName()); + cst.setNumber(1); + cst.setPrice(zyd.getPromotionPrice()); + cst.setZj(zyd.getPromotionPrice() * 1); + cst.setPlaceorigin(zyd.getPlaceOrigin()); + cst.setGoodimg(zyd.getDefaultPicture()); + cst.setStyleId(zyd.getStyleId()); + /* customerShoppingCartService.save(cst);*/ + System.out.println(cst); + return Result.ok("添加完成"); + } + } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java index ea734259..0708aed7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java @@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper; import org.jeecg.modules.system.model.SysUserSysDepartModel; import org.jeecg.modules.system.vo.Grzx1; import org.jeecg.modules.system.vo.Grzx2; +import org.jeecg.modules.system.vo.Grzx3; import org.jeecg.modules.system.vo.SysUserDepVo; import java.util.List; @@ -178,4 +179,12 @@ public interface SysUserMapper extends BaseMapper { //个人中心我的账户修改个人信息 @Update("UPDATE sys_user SET realname = #{realname},sex=#{sex},birthday=#{birthday},phone=#{phone},email=#{email} WHERE id = #{id} ") void updateneed(String id, String sex, String birthday, String realname, String phone, String email); + + List getscgoods(String userid); + + @Select("SELECT zf.name FROM customercollectgoods AS crg LEFT JOIN goods_fabric AS gf ON crg.goods_id = gf.goods_id LEFT JOIN zy_fabric AS zf ON gf.fabric_id = zf.id WHERE crg.id=#{id}") + List getscgoodml(String id); + + @Select("SELECT za.contents FROM customercollectgoods AS crg LEFT JOIN goods_accessories AS ga ON crg.goods_id = ga.goods_id LEFT JOIN zy_accessories AS za ON ga.accessories_id = za.id where crg.id=#{id}") + List getscgoodfi(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml index fb4af157..933fa6d0 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml @@ -198,4 +198,14 @@ WHERE og.id=#{id} + + + + + diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java index ff1d60e5..3c7fb2d7 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java @@ -12,6 +12,7 @@ import org.jeecg.modules.system.entity.SysUser; import org.jeecg.modules.system.model.SysUserSysDepartModel; import org.jeecg.modules.system.vo.Grzx1; import org.jeecg.modules.system.vo.Grzx2; +import org.jeecg.modules.system.vo.Grzx3; import org.springframework.transaction.annotation.Transactional; import java.util.Collection; @@ -272,4 +273,11 @@ public interface ISysUserService extends IService { SysUser getneeduser(String id); void updateneed(String id, String sex, String birthday, String realname, String phone, String email); + + //此处用于个人中心获取收藏商品的信息 + List getscgoods(String userid); + //此处用于个人中心获取收藏商品的面料 + List getscgoodml(String id); + //此处用于个人中心获取收藏商品的辅料 + List getscgoodfi(String id); } diff --git a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java index 3d1f8dcd..a76e56a1 100644 --- a/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java +++ b/jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java @@ -23,6 +23,7 @@ import org.jeecg.modules.system.model.SysUserSysDepartModel; import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.vo.Grzx1; import org.jeecg.modules.system.vo.Grzx2; +import org.jeecg.modules.system.vo.Grzx3; import org.jeecg.modules.system.vo.SysUserDepVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.cache.annotation.CacheEvict; @@ -588,4 +589,19 @@ public class SysUserServiceImpl extends ServiceImpl impl userMapper.updateneed(id,sex,birthday,realname,phone,email); } + @Override + public List getscgoods(String userid) { + return userMapper.getscgoods(userid); + } + + @Override + public List getscgoodml(String id) { + return userMapper.getscgoodml(id); + } + + @Override + public List getscgoodfi(String id) { + return userMapper.getscgoodfi(id); + } + }