|  |  |  | 
|---|
|  |  |  | package com.matrix.system.shopXcx.api.action; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import com.matrix.biz.bean.BizUser; | 
|---|
|  |  |  | import com.matrix.system.hive.bean.SysVipInfo; | 
|---|
|  |  |  | import com.matrix.component.redis.RedisUserLoginUtils; | 
|---|
|  |  |  | import com.matrix.core.pojo.AjaxResult; | 
|---|
|  |  |  | import com.matrix.system.common.interceptor.HostInterceptor; | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(value = "/findOwnerGroupBuyInfo/{actId}") | 
|---|
|  |  |  | public AjaxResult findOwnerGroupBuyInfo(@PathVariable("actId") Long actId) { | 
|---|
|  |  |  | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
|---|
|  |  |  | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  |  | 
|---|
|  |  |  | // 1、判断该用户在该活动中有没有正在拼团 若有,则返回正在拼团的用户列表,若没有则返回gruoping=1且返回正在拼团的拼团列表, 若加入了团未完成付款,则需要再做设置 | 
|---|
|  |  |  | ShopActivitiesGroupJoin isExsit = shopActivitiesGroupJoinDao.selectIsExistGroupInfoByUserId(actId, bizUser.getOpenId()); | 
|---|
|  |  |  | ShopActivitiesGroupJoin isExsit = shopActivitiesGroupJoinDao.selectIsExistGroupInfoByUserId(actId, sysVipInfo.getOpenId()); | 
|---|
|  |  |  | AjaxResult ajaxResult = new AjaxResult(AjaxResult.STATUS_SUCCESS, null); | 
|---|
|  |  |  | if (isExsit == null) { | 
|---|
|  |  |  | ajaxResult.putInMap("grouping", 2); | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | ajaxResult.putInMap("grouping", 1); | 
|---|
|  |  |  | ShopActivitiesGroupJoin groupJoin = shopActivitiesGroupJoinDao.selectOwnerGroupJoinInfoWithNoPay(isExsit.getId()); | 
|---|
|  |  |  | ShopActivitiesGroupJoinUser groupJoinUser = shopActivitiesGroupJoinUserDao.selectGroupJoinUserByUserIdAndGjId(bizUser.getOpenId(), groupJoin.getId()); | 
|---|
|  |  |  | ShopActivitiesGroupJoinUser groupJoinUser = shopActivitiesGroupJoinUserDao.selectGroupJoinUserByUserIdAndGjId(sysVipInfo.getOpenId(), groupJoin.getId()); | 
|---|
|  |  |  | ShopActivitiesGroupPrice price = shopActivitiesGroupPriceDao.selectById(groupJoin.getGpId()); | 
|---|
|  |  |  | int theLast = price.getGpCount() - groupJoin.getJoinUserList().size(); | 
|---|
|  |  |  | groupJoin.setTheLast(theLast); | 
|---|
|  |  |  | 
|---|
|  |  |  | */ | 
|---|
|  |  |  | @GetMapping(value = "/findGroupJoinInfo/{gjId}") | 
|---|
|  |  |  | public AjaxResult findGroupJoinInfo(@PathVariable Long gjId) { | 
|---|
|  |  |  | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
|---|
|  |  |  | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  | ShopActivitiesGroupJoin groupJoin = shopActivitiesGroupJoinDao.selectOwnerGroupJoinInfo(gjId); | 
|---|
|  |  |  | int isExist = 2; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | for (ShopActivitiesGroupJoinUser joinUser : groupJoin.getJoinUserList()) { | 
|---|
|  |  |  | if (bizUser.getOpenId().equals(joinUser.getUserId())) { | 
|---|
|  |  |  | if (sysVipInfo.getOpenId().equals(joinUser.getUserId())) { | 
|---|
|  |  |  | isExist = 1; | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | @PostMapping(value = "/calPrice") | 
|---|
|  |  |  | public AjaxResult calPrice(@RequestBody CreateGroupBuyDTO createGroupBuyDTO) { | 
|---|
|  |  |  | BizUser bizUser = redisUserLoginUtils.getLoginUser(BizUser.class); | 
|---|
|  |  |  | SysVipInfo sysVipInfo = redisUserLoginUtils.getLoginUser(SysVipInfo.class); | 
|---|
|  |  |  | ShopActivitiesGroupPrice groupPrice = shopActivitiesGroupPriceDao.selectById(createGroupBuyDTO.getGpId()); | 
|---|
|  |  |  | // 判断参数中gjId是否为空,若为空则为团长开团。再判断团长价是否为空,如果不为空则拥有团长价 | 
|---|
|  |  |  | if (createGroupBuyDTO.getGjId() == null) { | 
|---|
|  |  |  | 
|---|
|  |  |  | } else { | 
|---|
|  |  |  | createGroupBuyDTO.setPrice(groupPrice.getGpPrice()); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | BigDecimal postage = wxShopOrderService.calculationPostage(createGroupBuyDTO.getPrice(),bizUser.getCompanyId()); | 
|---|
|  |  |  | BigDecimal postage = wxShopOrderService.calculationPostage(createGroupBuyDTO.getPrice(),sysVipInfo.getCompanyId()); | 
|---|
|  |  |  | BigDecimal payPrice = createGroupBuyDTO.getPrice().multiply(BigDecimal.valueOf(createGroupBuyDTO.getCount())).add(postage); | 
|---|
|  |  |  | AjaxResult ajaxResult = new AjaxResult(AjaxResult.STATUS_SUCCESS, null); | 
|---|
|  |  |  | ajaxResult.putInMap("billPrice", createGroupBuyDTO.getPrice().multiply(BigDecimal.valueOf(createGroupBuyDTO.getCount()))); | 
|---|