|
@@ -8,6 +8,8 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
import com.qs.mp.admin.domain.*;
|
|
|
import com.qs.mp.admin.domain.param.*;
|
|
|
import com.qs.mp.admin.domain.vo.GroupBuying;
|
|
|
+import com.qs.mp.admin.domain.vo.GroupBuyingGroup;
|
|
|
+import com.qs.mp.admin.domain.vo.GroupBuyingOrder;
|
|
|
import com.qs.mp.admin.mapper.GroupBuyingMapper;
|
|
|
import com.qs.mp.admin.service.*;
|
|
|
import com.qs.mp.common.constant.Constants;
|
|
@@ -19,16 +21,14 @@ import com.qs.mp.common.utils.DateUtils;
|
|
|
import com.qs.mp.common.utils.bean.BeanUtils;
|
|
|
import com.qs.mp.framework.redis.RedisKey;
|
|
|
import com.qs.mp.framework.service.IWxSubscribeMessage;
|
|
|
+import com.qs.mp.pay.service.IWalletService;
|
|
|
import com.qs.mp.system.domain.SysUser;
|
|
|
import com.qs.mp.system.service.ISysUserService;
|
|
|
import com.qs.mp.system.service.id.BizIdGenerator;
|
|
|
import com.qs.mp.user.domain.MarketingHitPrize;
|
|
|
import com.qs.mp.user.domain.MarketingUserCode;
|
|
|
import com.qs.mp.user.domain.param.MarketingHelpParam;
|
|
|
-import com.qs.mp.user.service.IMarketingHitPrizeService;
|
|
|
-import com.qs.mp.user.service.IMarketingUserCodeService;
|
|
|
-import com.qs.mp.user.service.IUserCoinService;
|
|
|
-import com.qs.mp.user.service.IUserPrizeStorageService;
|
|
|
+import com.qs.mp.user.service.*;
|
|
|
import com.qs.mp.utils.MarketingUtils;
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.slf4j.Logger;
|
|
@@ -116,7 +116,9 @@ public class GroupBuyingServiceImpl extends ServiceImpl<GroupBuyingMapper, Group
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
+ //拼团活动
|
|
|
+ @Autowired
|
|
|
+ private IGroupBuyingService groupBuyingService;
|
|
|
|
|
|
//拼团活动奖项
|
|
|
@Autowired
|
|
@@ -126,6 +128,16 @@ public class GroupBuyingServiceImpl extends ServiceImpl<GroupBuyingMapper, Group
|
|
|
@Autowired
|
|
|
private IGroupBuyingAwardsPrizeService groupBuyingAwardsPrizeService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private IGroupBuyingGroupService groupBuyingGroupService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGroupBuyingOrderService groupBuyingOrderService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IWalletService walletService;
|
|
|
+
|
|
|
+
|
|
|
/**
|
|
|
* 复制拼团活动
|
|
|
* @param groupBuyingId
|
|
@@ -336,6 +348,55 @@ public class GroupBuyingServiceImpl extends ServiceImpl<GroupBuyingMapper, Group
|
|
|
}
|
|
|
|
|
|
|
|
|
+ /**
|
|
|
+ * 修改拼团活动状态
|
|
|
+ * @param groupBuying
|
|
|
+ */
|
|
|
+ @Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
+ public void endGroupBuying(GroupBuying groupBuying) {
|
|
|
+ //更新活动状态
|
|
|
+ boolean rtn = groupBuyingService.update(new LambdaUpdateWrapper<GroupBuying>()
|
|
|
+ .set(GroupBuying::getIsPutaway, 2)
|
|
|
+ .eq(GroupBuying::getId, groupBuying.getId())
|
|
|
+ .eq(GroupBuying::getIsPutaway, 0));
|
|
|
+
|
|
|
+ if (rtn){
|
|
|
+ //查询尚未成团的团
|
|
|
+ List<GroupBuyingGroup> list = groupBuyingGroupService.list(new LambdaQueryWrapper<GroupBuyingGroup>()
|
|
|
+ .eq(GroupBuyingGroup::getGroupbuyingId, groupBuying.getId())
|
|
|
+ .eq(GroupBuyingGroup::getGroupStatus, 3));
|
|
|
+
|
|
|
+ if (Objects.isNull(list) || list.size() == 0){
|
|
|
+ return;
|
|
|
+ }
|
|
|
+
|
|
|
+ //获取团成团ID
|
|
|
+ for (GroupBuyingGroup groupBuyingGroup : list){
|
|
|
+ String partinIds = groupBuyingGroup.getPartinIds();
|
|
|
+ String[] split = partinIds.split(",");
|
|
|
+
|
|
|
+ for (int i = 0; i < split.length; i++){
|
|
|
+ GroupBuyingOrder groupBuyingOrder = groupBuyingOrderService.getOne(new LambdaQueryWrapper<GroupBuyingOrder>()
|
|
|
+ .eq(GroupBuyingOrder::getGroupbuyingId, groupBuyingGroup.getGroupbuyingId())
|
|
|
+ .eq(GroupBuyingOrder::getGroupId, groupBuyingGroup.getId())
|
|
|
+ .eq(GroupBuyingOrder::getUserId, split[i]));
|
|
|
+
|
|
|
+ boolean refund = walletService.refund(groupBuyingOrder.getOrderId(), groupBuyingOrder.getPayAmt(), "拼团退款");
|
|
|
+ if (refund){
|
|
|
+ //更新拼团订单状态
|
|
|
+ groupBuyingOrderService.update(new LambdaUpdateWrapper<GroupBuyingOrder>()
|
|
|
+ .set(GroupBuyingOrder::getStatus, -1)
|
|
|
+ .eq(GroupBuyingOrder::getOrderId, groupBuyingOrder.getOrderId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
|
|
|
|