Compare commits

..

2 Commits

  1. 207
      ant-design-vue-jeecg/src/views/shopping/components/collection.vue
  2. 103
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/controller/ApeopersionController.java
  3. 9
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/SysUserMapper.java
  4. 10
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/mapper/xml/SysUserMapper.xml
  5. 8
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/ISysUserService.java
  6. 16
      jeecg-boot/jeecg-boot-module-system/src/main/java/org/jeecg/modules/system/service/impl/SysUserServiceImpl.java

@ -1,16 +1,16 @@
<template> <template>
<div class="collection"> <div class="collection">
<!-- 收藏列表--> <!-- 收藏列表-->
<div class="d-flex collectList" v-if="collectList.length != 0"> <div class="d-flex collectList" v-if="collectList1.length != 0">
<div class="item d-flex" v-for="(item,index) in collectList" :key="index" v-if="index<7"> <div class="item d-flex" v-for="(item,index) in collectList1" :key="index" v-if="index<7">
<img :src="item.imgUrl"> <img :src="item.defaultPicture">
<div class="title f_14">{{item.title}}</div> <div class="title f_14">{{item.goodsName}}</div>
<div class="price f_14">{{item.price}}</div> <div class="price f_14">{{item.unitPrice}}</div>
<div class="c_75 f_12">{{item.size}}</div> <div class="c_75 f_12">{{item.styleNames}}</div>
<div class="c_75 f_12">{{item.zhuliao}}</div> <div class="c_75 f_12">{{item.address}}</div>
<div class="c_75 f_12">{{item.fuliao}}</div> <div class="c_75 f_12">{{item.ordersNum}}</div>
<a class="button1 f_12">删除</a> <a class="button1 f_12">删除</a>
<div class="button2 f_12 c_fff">加入购物袋</div> <div class="button2 f_12 c_fff" @click="ingwc(item.id)">加入购物袋</div>
</div> </div>
<div class="more d-flex"> <div class="more d-flex">
<a class="c_1B f_20">点击进入衣橱<a-icon type="right" /></a> <a class="c_1B f_20">点击进入衣橱<a-icon type="right" /></a>
@ -18,7 +18,7 @@
</div> </div>
</div> </div>
<!-- 收藏列表没有数据--> <!-- 收藏列表没有数据-->
<div class="else" v-if="collectList.length == 0"> <div class="else" v-if="collectList1.length == 0">
<p class="c_1B f_30">您的衣橱中没有收藏任何商品</p> <p class="c_1B f_30">您的衣橱中没有收藏任何商品</p>
<div class="c_fff f_12">前往探索</div> <div class="c_fff f_12">前往探索</div>
</div> </div>
@ -36,86 +36,89 @@
</div> </div>
</template> </template>
<script> <script>
import { httpAction, getAction } from '@/api/manage'
export default { export default {
name: "collection", name: "collection",
components: { }, components: { },
data() { data() {
return { return {
// collectList:[ collectList:[
// { {
// id:1, id:1,
// imgUrl:require("../assets/cloth001.png"), imgUrl:require("../assets/cloth001.png"),
// title:"", title:"商品名商品名商品名商品名商品名",
// price:'23500', price:'23500',
// size:"", size:"款式名",
// zhuliao:"", zhuliao:"主料名",
// fuliao:"", fuliao:"辅料名",
// }, },
// { {
// id:2, id:2,
// imgUrl:require("../assets/cloth002.png"), imgUrl:require("../assets/cloth002.png"),
// title:"", title:"商品名商品名商品名商品名商品名",
// price:'23500', price:'23500',
// size:"", size:"款式名",
// zhuliao:"", zhuliao:"主料名",
// fuliao:"", fuliao:"辅料名",
// }, },
// { {
// id:3, id:3,
// imgUrl:require("../assets/cloth004.png"), imgUrl:require("../assets/cloth004.png"),
// title:"", title:"商品名商品名商品名商品名商品名",
// price:'23500', price:'23500',
// size:"", size:"款式名",
// zhuliao:"", zhuliao:"主料名",
// fuliao:"", fuliao:"辅料名",
// }, },
// { {
// id:4, id:4,
// imgUrl:require("../assets/cloth003.png"), imgUrl:require("../assets/cloth003.png"),
// title:"", title:"商品名商品名商品名商品名商品名",
// price:'23500', price:'23500',
// size:"", size:"款式名",
// zhuliao:"", zhuliao:"主料名",
// fuliao:"", fuliao:"辅料名",
// }, },
// { {
// id:5, id:5,
// imgUrl:require("../assets/cloth001.png"), imgUrl:require("../assets/cloth001.png"),
// title:"", title:"商品名商品名商品名商品名商品名",
// price:'23500', price:'23500',
// size:"", size:"款式名",
// zhuliao:"", zhuliao:"主料名",
// fuliao:"", fuliao:"辅料名",
// }, },
// { {
// id:6, id:6,
// imgUrl:require("../assets/cloth002.png"), imgUrl:require("../assets/cloth002.png"),
// title:"", title:"商品名商品名商品名商品名商品名",
// price:'23500', price:'23500',
// size:"", size:"款式名",
// zhuliao:"", zhuliao:"主料名",
// fuliao:"", fuliao:"辅料名",
// }, },
// { {
// id:7, id:7,
// imgUrl:require("../assets/cloth004.png"), imgUrl:require("../assets/cloth004.png"),
// title:"", title:"商品名商品名商品名商品名商品名",
// price:'23500', price:'23500',
// size:"", size:"款式名",
// zhuliao:"", zhuliao:"主料名",
// fuliao:"", fuliao:"辅料名",
// }, },
// { {
// id:8, id:8,
// imgUrl:require("../assets/cloth003.png"), imgUrl:require("../assets/cloth003.png"),
// title:"", title:"商品名商品名商品名商品名商品名",
// price:'23500', price:'23500',
// size:"", size:"款式名",
// zhuliao:"", zhuliao:"主料名",
// fuliao:"", fuliao:"辅料名",
// } }
// ], ],
collectList:[], collectList1:[],
recommendList:[ recommendList:[
{ {
id:1, id:1,
@ -138,14 +141,48 @@
flag:false flag:false
}, },
], ],
url: {
findallcg: "/getuserpersion/findallcg",
ingwc: "/getuserpersion/ingwc"
},
}; };
}, },
created() {
this.findallcg();
},
methods: { methods: {
shouCang(item){ shouCang(item){
console.log(item) console.log(item)
item.flag = !item.flag item.flag = !item.flag
},
findallcg(){
getAction(this.url.findallcg).then((res) => {
if(res.success) {
this.collectList1 = res.result;
console.log(res.result)
this.visible = true;
} else {
}
});
},
ingwc(id){
getAction(this.url.ingwc,{id,id}).then((res) => {
if(res.success) {
alert('宝贝已经添加到购物了,请查收');
} else {
} }
});
},
}, },
}; };
</script> </script>

@ -3,24 +3,34 @@ package org.jeecg.modules.system.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.google.common.base.Joiner;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.apache.shiro.SecurityUtils; import org.apache.shiro.SecurityUtils;
import org.aspectj.apache.bcel.generic.RET; import org.aspectj.apache.bcel.generic.RET;
import org.jeecg.common.api.vo.Result; import org.jeecg.common.api.vo.Result;
import org.jeecg.common.constant.CommonConstant; import org.jeecg.common.constant.CommonConstant;
import org.jeecg.common.system.vo.LoginUser; import org.jeecg.common.system.vo.LoginUser;
import org.jeecg.modules.base.service.BaseCommonService; 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.entity.SysUser;
import org.jeecg.modules.system.service.ISysUserService; 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.beans.factory.annotation.Autowired;
import org.springframework.http.HttpRequest; import org.springframework.http.HttpRequest;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.lang.reflect.Field; import java.lang.reflect.Field;
import java.util.Date; import java.util.*;
import java.util.HashMap; import java.util.stream.Collectors;
import java.util.Map;
/* /*
这个是个人中心专用控制器之前全都写在SysUserController用户控制器里面感觉不妥因此就专门拖出来一个 这个是个人中心专用控制器之前全都写在SysUserController用户控制器里面感觉不妥因此就专门拖出来一个
@ -34,6 +44,15 @@ public class ApeopersionController {
@Autowired @Autowired
private ISysUserService sysUserService; 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(); String id = loginUser.getId();
SysUser syu = new SysUser(); SysUser syu = new SysUser();
syu = sysUserService.getneeduser(id); syu = sysUserService.getneeduser(id);
findgoods();
return Result.ok(syu); return Result.ok(syu);
} }
//个人中心的我的账户页面需要的数据
@RequestMapping(value = "/updateneeduser", method = RequestMethod.GET) @RequestMapping(value = "/updateneeduser", method = RequestMethod.GET)
public Result<?> updateneeduser(@RequestParam(name = "form", required = true) String form) { public Result<?> updateneeduser(@RequestParam(name = "form", required = true) String form) {
Map map = JSON.parseObject(form,Map.class); Map map = JSON.parseObject(form,Map.class);
System.out.println(map);
String id = (String) map.get("id"); String id = (String) map.get("id");
String sex= map.get("sex").toString(); String sex= map.get("sex").toString();
String birthday= (String) map.get("birthday"); String birthday= (String) map.get("birthday");
@ -60,6 +79,80 @@ public class ApeopersionController {
String phone= (String) map.get("phone"); String phone= (String) map.get("phone");
String email= (String) map.get("email"); String email= (String) map.get("email");
sysUserService.updateneed(id,sex,birthday,realname,phone,email); sysUserService.updateneed(id,sex,birthday,realname,phone,email);
return Result.ok("success"); return Result.ok("success");
} }
//个人中心的我的收藏的首页需要的数据
@RequestMapping(value = "/findallcg", method = RequestMethod.GET)
public Result<?> findgoods() {
//获取当前登人的信息
LoginUser loginUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userid = loginUser.getUsername();
List<Grzx1> g3 = new ArrayList<>();
//根据当前登的人获取收藏夹里面的搜藏的商品的名称及其款式
g3 = sysUserService.getscgoods(userid);
//获取的是辅料
List<String> s1 =new ArrayList<>();
//获取的是面料
List<String> s2 =new ArrayList<>();
//把获取的商品信息导入到新的list里面
for (int i=0;i<g3.size();i++){
if (g3.get(i)!=null) {
s1=sysUserService.getscgoodfi(g3.get(i).getId());
s2=sysUserService.getscgoodml(g3.get(i).getId());
g3.get(i).setOrdersNum(s2.toString());
if(s2.get(0)==null){
}else {
if (s2.size()==1){
g3.get(i).setAddress(s2.get(0).toString().replace("[","").replace("]",""));
} else{
g3.get(i).setAddress(StringUtils.join(s2, ","));
}
}
if(s1.get(0)==null){
}else {
if (s1.size()==1){
g3.get(i).setOrdersNum(s1.get(0).toString().replace("[","").replace("]",""));
} else{
g3.get(i).setOrdersNum(StringUtils.join(s1, ","));
}
}
}
}
return Result.ok(g3);
}
//个人中心的我的收藏的首页需要的数据
@RequestMapping(value = "/ingwc", method = RequestMethod.GET)
public Result<?> 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("添加完成");
}
} }

@ -13,6 +13,7 @@ import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.jeecg.modules.system.model.SysUserSysDepartModel; import org.jeecg.modules.system.model.SysUserSysDepartModel;
import org.jeecg.modules.system.vo.Grzx1; import org.jeecg.modules.system.vo.Grzx1;
import org.jeecg.modules.system.vo.Grzx2; import org.jeecg.modules.system.vo.Grzx2;
import org.jeecg.modules.system.vo.Grzx3;
import org.jeecg.modules.system.vo.SysUserDepVo; import org.jeecg.modules.system.vo.SysUserDepVo;
import java.util.List; import java.util.List;
@ -178,4 +179,12 @@ public interface SysUserMapper extends BaseMapper<SysUser> {
//个人中心我的账户修改个人信息 //个人中心我的账户修改个人信息
@Update("UPDATE sys_user SET realname = #{realname},sex=#{sex},birthday=#{birthday},phone=#{phone},email=#{email} WHERE id = #{id} ") @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); void updateneed(String id, String sex, String birthday, String realname, String phone, String email);
List<Grzx1> 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<String> 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<String> getscgoodfi(String id);
} }

@ -198,4 +198,14 @@ WHERE og.id=#{id}
</select> </select>
<!-- 这个是获取订单的数据中的商品数据 -->
<select id="getscgoods" resultType="org.jeecg.modules.system.vo.Grzx1">
SELECT crg.id,zgs.goods_name,zcs.style_names,zgs.default_picture,zgs.unit_price FROM customercollectgoods AS crg
LEFT JOIN zy_goods AS zgs ON crg.goods_id = zgs.id
LEFT JOIN zy_cloths_style AS zcs ON zgs.style_id = zcs.id
WHERE crg.create_by=#{userid}
</select>
</mapper> </mapper>

@ -12,6 +12,7 @@ import org.jeecg.modules.system.entity.SysUser;
import org.jeecg.modules.system.model.SysUserSysDepartModel; import org.jeecg.modules.system.model.SysUserSysDepartModel;
import org.jeecg.modules.system.vo.Grzx1; import org.jeecg.modules.system.vo.Grzx1;
import org.jeecg.modules.system.vo.Grzx2; import org.jeecg.modules.system.vo.Grzx2;
import org.jeecg.modules.system.vo.Grzx3;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import java.util.Collection; import java.util.Collection;
@ -272,4 +273,11 @@ public interface ISysUserService extends IService<SysUser> {
SysUser getneeduser(String id); SysUser getneeduser(String id);
void updateneed(String id, String sex, String birthday, String realname, String phone, String email); void updateneed(String id, String sex, String birthday, String realname, String phone, String email);
//此处用于个人中心获取收藏商品的信息
List<Grzx1> getscgoods(String userid);
//此处用于个人中心获取收藏商品的面料
List<String> getscgoodml(String id);
//此处用于个人中心获取收藏商品的辅料
List<String> getscgoodfi(String id);
} }

@ -23,6 +23,7 @@ import org.jeecg.modules.system.model.SysUserSysDepartModel;
import org.jeecg.modules.system.service.ISysUserService; import org.jeecg.modules.system.service.ISysUserService;
import org.jeecg.modules.system.vo.Grzx1; import org.jeecg.modules.system.vo.Grzx1;
import org.jeecg.modules.system.vo.Grzx2; import org.jeecg.modules.system.vo.Grzx2;
import org.jeecg.modules.system.vo.Grzx3;
import org.jeecg.modules.system.vo.SysUserDepVo; import org.jeecg.modules.system.vo.SysUserDepVo;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict; import org.springframework.cache.annotation.CacheEvict;
@ -588,4 +589,19 @@ public class SysUserServiceImpl extends ServiceImpl<SysUserMapper, SysUser> impl
userMapper.updateneed(id,sex,birthday,realname,phone,email); userMapper.updateneed(id,sex,birthday,realname,phone,email);
} }
@Override
public List<Grzx1> getscgoods(String userid) {
return userMapper.getscgoods(userid);
}
@Override
public List<String> getscgoodml(String id) {
return userMapper.getscgoodml(id);
}
@Override
public List<String> getscgoodfi(String id) {
return userMapper.getscgoodfi(id);
}
} }

Loading…
Cancel
Save