|
|
|
@ -18,6 +18,9 @@ import co.yixiang.constant.ShopConstants;
|
|
|
|
|
import co.yixiang.dozer.service.IGenerator; |
|
|
|
|
import co.yixiang.enums.OrderInfoEnum; |
|
|
|
|
import co.yixiang.enums.PinkEnum; |
|
|
|
|
import co.yixiang.event.TemplateBean; |
|
|
|
|
import co.yixiang.event.TemplateEvent; |
|
|
|
|
import co.yixiang.event.TemplateListenEnum; |
|
|
|
|
import co.yixiang.modules.activity.domain.YxStoreCombination; |
|
|
|
|
import co.yixiang.modules.activity.domain.YxStorePink; |
|
|
|
|
import co.yixiang.modules.activity.service.YxStoreCombinationService; |
|
|
|
@ -47,6 +50,7 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
|
import com.github.pagehelper.PageInfo; |
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
|
import org.springframework.context.ApplicationEventPublisher; |
|
|
|
|
import org.springframework.data.domain.Pageable; |
|
|
|
|
import org.springframework.data.redis.core.RedisTemplate; |
|
|
|
|
import org.springframework.stereotype.Service; |
|
|
|
@ -55,6 +59,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse; |
|
|
|
|
import java.io.IOException; |
|
|
|
|
import java.math.BigDecimal; |
|
|
|
|
import java.util.ArrayList; |
|
|
|
|
import java.util.Date; |
|
|
|
|
import java.util.LinkedHashMap; |
|
|
|
@ -72,6 +77,8 @@ import java.util.stream.Collectors;
|
|
|
|
|
@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) |
|
|
|
|
public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, YxStorePink> implements YxStorePinkService { |
|
|
|
|
|
|
|
|
|
@Autowired |
|
|
|
|
private ApplicationEventPublisher publisher; |
|
|
|
|
@Autowired |
|
|
|
|
private IGenerator generator; |
|
|
|
|
@Autowired |
|
|
|
@ -95,7 +102,6 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|
|
|
|
@Autowired |
|
|
|
|
private YxStoreVisitService yxStoreVisitService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
|
* 取消拼团 |
|
|
|
|
* @param uid 用户id |
|
|
|
@ -316,6 +322,7 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|
|
|
|
storePink.setStopTime(stopTime); |
|
|
|
|
storePink.setUniqueId(storeCart.getProductAttrUnique()); |
|
|
|
|
if(order.getPinkId() > 0){ //其他成员入团
|
|
|
|
|
//如果该用户已经在团内
|
|
|
|
|
if(this.getIsPinkUid(order.getPinkId(),order.getUid())) { |
|
|
|
|
return; |
|
|
|
|
} |
|
|
|
@ -330,6 +337,19 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|
|
|
|
//int count = (int)map.get("count");
|
|
|
|
|
if(pinkUserDto.getCount() == 0){//处理成功
|
|
|
|
|
this.pinkComplete(pinkUserDto.getUidAll(),pinkUserDto.getIdAll(),order.getUid(), pinkT); |
|
|
|
|
//给团内每个人发送订阅消息
|
|
|
|
|
for(Long uid:pinkUserDto.getUidAll()){ |
|
|
|
|
TemplateBean templateBean = TemplateBean.builder() |
|
|
|
|
.productId(pinkT.getPid())//拼团商品名
|
|
|
|
|
.uid(uid) //给团内每个人发消息
|
|
|
|
|
.result(true) |
|
|
|
|
.payPrice(pinkT.getPrice()) |
|
|
|
|
.refundPrice(BigDecimal.valueOf(0)) |
|
|
|
|
.templateType(TemplateListenEnum.TYPE_13.getValue()) |
|
|
|
|
.time(DateUtil.formatTime(pinkT.getCreateTime())) |
|
|
|
|
.build(); |
|
|
|
|
publisher.publishEvent(new TemplateEvent(this, templateBean)); |
|
|
|
|
} |
|
|
|
|
}else{ |
|
|
|
|
this.pinkFail(pinkUserDto.getPinkAll(),pinkT,PinkEnum.PINK_BOOL_0.getValue()); |
|
|
|
|
} |
|
|
|
@ -579,6 +599,16 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
|
|
|
|
for (YxStorePink storePink : pinkAll) { |
|
|
|
|
storeOrderService.orderApplyRefund("","","拼团时间超时",storePink.getOrderId(),storePink.getUid()); |
|
|
|
|
this.orderPinkFailAfter(pinkT.getUid(),storePink.getId()); |
|
|
|
|
TemplateBean templateBean = TemplateBean.builder() |
|
|
|
|
.productId(pinkT.getPid())//拼团商品名
|
|
|
|
|
.uid(pinkT.getUid()) //给团内每个人发消息
|
|
|
|
|
.result(false) |
|
|
|
|
.payPrice(pinkT.getPrice()) |
|
|
|
|
.refundPrice(pinkT.getPrice()) |
|
|
|
|
.templateType(TemplateListenEnum.TYPE_13.getValue()) |
|
|
|
|
.time(DateUtil.formatTime(pinkT.getCreateTime())) |
|
|
|
|
.build(); |
|
|
|
|
publisher.publishEvent(new TemplateEvent(this, templateBean)); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|