增加拼团访问数、商品详情接口放开以及其它bug修复
This commit is contained in:
@ -7,9 +7,16 @@ package co.yixiang.modules.activity.domain;
|
||||
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.bean.copier.CopyOptions;
|
||||
import com.baomidou.mybatisplus.annotation.FieldFill;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@ -18,15 +25,19 @@ import java.io.Serializable;
|
||||
* @date 2020-05-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Builder
|
||||
@AllArgsConstructor
|
||||
@NoArgsConstructor
|
||||
@TableName("yx_store_visit")
|
||||
public class YxStoreVisit implements Serializable {
|
||||
|
||||
@TableId
|
||||
private Integer id;
|
||||
private Long id;
|
||||
|
||||
|
||||
/** 产品ID */
|
||||
private Integer productId;
|
||||
private Long productId;
|
||||
|
||||
|
||||
/** 产品类型 */
|
||||
@ -42,7 +53,7 @@ public class YxStoreVisit implements Serializable {
|
||||
|
||||
|
||||
/** 用户ID */
|
||||
private Integer uid;
|
||||
private Long uid;
|
||||
|
||||
|
||||
/** 访问次数 */
|
||||
@ -54,6 +65,8 @@ public class YxStoreVisit implements Serializable {
|
||||
|
||||
|
||||
/** 添加时间 */
|
||||
@TableField(fill= FieldFill.INSERT)
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone="GMT+8")
|
||||
private Integer addTime;
|
||||
|
||||
|
||||
|
@ -40,6 +40,13 @@ public interface YxStoreVisitService extends BaseService<YxStoreVisit>{
|
||||
*/
|
||||
List<YxStoreVisit> queryAll(YxStoreVisitQueryCriteria criteria);
|
||||
|
||||
/**
|
||||
* 添加用户访问拼团记录
|
||||
* @param uid 用户id
|
||||
* @param productId 产品id
|
||||
*/
|
||||
void addStoreVisit(Long uid,Long productId);
|
||||
|
||||
/**
|
||||
* 导出数据
|
||||
* @param all 待导出的数据
|
||||
|
@ -22,6 +22,7 @@ import co.yixiang.modules.activity.domain.YxStoreCombination;
|
||||
import co.yixiang.modules.activity.domain.YxStorePink;
|
||||
import co.yixiang.modules.activity.service.YxStoreCombinationService;
|
||||
import co.yixiang.modules.activity.service.YxStorePinkService;
|
||||
import co.yixiang.modules.activity.service.YxStoreVisitService;
|
||||
import co.yixiang.modules.activity.service.dto.PinkAllDto;
|
||||
import co.yixiang.modules.activity.service.dto.PinkDto;
|
||||
import co.yixiang.modules.activity.service.dto.PinkUserDto;
|
||||
@ -91,6 +92,9 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
@Autowired
|
||||
private YxStoreCartService yxStoreCartService;
|
||||
|
||||
@Autowired
|
||||
private YxStoreVisitService yxStoreVisitService;
|
||||
|
||||
|
||||
/**
|
||||
* 取消拼团
|
||||
@ -243,6 +247,10 @@ public class YxStorePinkServiceImpl extends BaseServiceImpl<YxStorePinkMapper, Y
|
||||
YxUserQueryVo userInfo = userService.getYxUserById(uid);
|
||||
YxStoreOrder yxStoreOrder = storeOrderService.getById(pink.getOrderIdKey());
|
||||
YxStoreCart yxStoreCart = yxStoreCartService.getById(yxStoreOrder.getCartId());
|
||||
//拼团访问量
|
||||
yxStoreCombinationMapper.incBrowseNum(pink.getPid());
|
||||
//拼团访客人数
|
||||
yxStoreVisitService.addStoreVisit(uid, pink.getPid());
|
||||
return PinkInfoVo.builder()
|
||||
.count(count)
|
||||
.currentPinkOrder(this.getCurrentPinkOrderId(id,uid))
|
||||
|
@ -5,15 +5,20 @@
|
||||
*/
|
||||
package co.yixiang.modules.activity.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import co.yixiang.common.service.impl.BaseServiceImpl;
|
||||
import co.yixiang.common.utils.QueryHelpPlus;
|
||||
import co.yixiang.dozer.service.IGenerator;
|
||||
import co.yixiang.enums.ProductTypeEnum;
|
||||
import co.yixiang.modules.activity.domain.YxStoreVisit;
|
||||
import co.yixiang.modules.activity.service.YxStoreVisitService;
|
||||
import co.yixiang.modules.activity.service.dto.YxStoreVisitDto;
|
||||
import co.yixiang.modules.activity.service.dto.YxStoreVisitQueryCriteria;
|
||||
import co.yixiang.modules.activity.service.mapper.YxStoreVisitMapper;
|
||||
import co.yixiang.modules.product.domain.YxStoreProduct;
|
||||
import co.yixiang.modules.product.service.YxStoreProductService;
|
||||
import co.yixiang.utils.FileUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
@ -40,6 +45,8 @@ import java.util.Map;
|
||||
public class YxStoreVisitServiceImpl extends BaseServiceImpl<YxStoreVisitMapper, YxStoreVisit> implements YxStoreVisitService {
|
||||
|
||||
private final IGenerator generator;
|
||||
private final YxStoreProductService yxStoreProductService;
|
||||
private final YxStoreVisitMapper yxStoreVisitMapper;
|
||||
|
||||
@Override
|
||||
//@Cacheable
|
||||
@ -59,7 +66,6 @@ public class YxStoreVisitServiceImpl extends BaseServiceImpl<YxStoreVisitMapper,
|
||||
return baseMapper.selectList(QueryHelpPlus.getPredicate(YxStoreVisit.class, criteria));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void download(List<YxStoreVisitDto> all, HttpServletResponse response) throws IOException {
|
||||
List<Map<String, Object>> list = new ArrayList<>();
|
||||
@ -77,4 +83,33 @@ public class YxStoreVisitServiceImpl extends BaseServiceImpl<YxStoreVisitMapper,
|
||||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加用户访问拼团记录
|
||||
* @param uid 用户id
|
||||
* @param productId 产品id
|
||||
*/
|
||||
@Override
|
||||
public void addStoreVisit(Long uid, Long productId) {
|
||||
|
||||
LambdaQueryWrapper<YxStoreVisit> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(YxStoreVisit::getUid, uid).eq(YxStoreVisit::getProductId, productId);
|
||||
YxStoreVisit storeVisit = this.baseMapper.selectOne(wrapper);
|
||||
|
||||
if (ObjectUtil.isNull(storeVisit)) {
|
||||
//查询产品分类
|
||||
YxStoreProduct yxStoreProduct = yxStoreProductService.getProductInfo(productId);
|
||||
|
||||
YxStoreVisit yxStoreVisit = YxStoreVisit.builder()
|
||||
.productId(productId)
|
||||
.productType(ProductTypeEnum.COMBINATION.getValue())
|
||||
.cateId(Integer.valueOf(yxStoreProduct.getCateId()))
|
||||
.type(ProductTypeEnum.COMBINATION.getValue())
|
||||
.uid(uid)
|
||||
.count(1)
|
||||
.build();
|
||||
this.saveOrUpdate(yxStoreVisit);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -75,6 +75,7 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
|
||||
* @param param UserExtParam
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void userExtract(YxUser userInfo, UserExtParam param) {
|
||||
BigDecimal extractPrice = userInfo.getBrokeragePrice();
|
||||
if(extractPrice.compareTo(BigDecimal.ZERO) <= 0) {
|
||||
@ -202,6 +203,7 @@ public class YxUserExtractServiceImpl extends BaseServiceImpl<YxUserExtractMappe
|
||||
* @param resources YxUserExtract
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void doExtract(YxUserExtract resources){
|
||||
if(resources.getStatus() == null){
|
||||
throw new BadRequestException("请选择审核状态");
|
||||
|
@ -18,6 +18,7 @@ import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Select;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@ -53,4 +54,13 @@ public interface YxStoreCombinationMapper extends CoreMapper<YxStoreCombination>
|
||||
" FROM yx_store_combination c " +
|
||||
" WHERE c.id = #{id} and c.is_del = 0 ")
|
||||
YxStoreProductQueryVo combinatiionInfo(Long id);
|
||||
|
||||
/**
|
||||
* 商品浏览量
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
@Update("update yx_store_combination set browse=browse+1 " +
|
||||
"where id=#{productId}")
|
||||
int incBrowseNum(@Param("productId") Long productId);
|
||||
}
|
||||
|
@ -10,6 +10,8 @@ package co.yixiang.modules.activity.service.mapper;
|
||||
|
||||
import co.yixiang.common.mapper.CoreMapper;
|
||||
import co.yixiang.modules.activity.domain.YxStoreVisit;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
import org.apache.ibatis.annotations.Update;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
@ -19,4 +21,12 @@ import org.springframework.stereotype.Repository;
|
||||
@Repository
|
||||
public interface YxStoreVisitMapper extends CoreMapper<YxStoreVisit> {
|
||||
|
||||
/**
|
||||
* 拼团浏览量
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
@Update("update yx_store_visit set count=count+1 " +
|
||||
"where uid=#{uid} AND id=#{productId}")
|
||||
int incBrowseNum(@Param("uid") Long uid,@Param("productId") Long productId);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ public interface YxStoreProductService extends BaseService<YxStoreProduct>{
|
||||
*/
|
||||
void decProductStock(int num, Long productId, String unique,Long activityId,String type);
|
||||
|
||||
YxStoreProduct getProductInfo(int id);
|
||||
YxStoreProduct getProductInfo(Long id);
|
||||
|
||||
/**
|
||||
* 获取单个商品
|
||||
|
@ -168,7 +168,7 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
|
||||
|
||||
@Override
|
||||
public YxStoreProduct getProductInfo(int id) {
|
||||
public YxStoreProduct getProductInfo(Long id) {
|
||||
LambdaQueryWrapper<YxStoreProduct> wrapper = new LambdaQueryWrapper<>();
|
||||
wrapper.eq(YxStoreProduct::getIsShow, 1).eq(YxStoreProduct::getId, id);
|
||||
YxStoreProduct storeProduct = this.baseMapper.selectOne(wrapper);
|
||||
@ -314,15 +314,16 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
//设置销量
|
||||
storeProductQueryVo.setSales(storeProductQueryVo.getSales() + storeProductQueryVo.getFicti());
|
||||
|
||||
//设置VIP价格
|
||||
double vipPrice = userService.setLevelPrice(
|
||||
storeProductQueryVo.getPrice().doubleValue(), uid);
|
||||
storeProductQueryVo.setVipPrice(BigDecimal.valueOf(vipPrice));
|
||||
|
||||
//收藏
|
||||
boolean isCollect = relationService.isProductRelation(id, uid);
|
||||
storeProductQueryVo.setUserCollect(isCollect);
|
||||
if (uid.longValue() > 0) {
|
||||
//设置VIP价格
|
||||
double vipPrice = userService.setLevelPrice(
|
||||
storeProductQueryVo.getPrice().doubleValue(), uid);
|
||||
storeProductQueryVo.setVipPrice(BigDecimal.valueOf(vipPrice));
|
||||
|
||||
//收藏
|
||||
boolean isCollect = relationService.isProductRelation(id, uid);
|
||||
storeProductQueryVo.setUserCollect(isCollect);
|
||||
}
|
||||
//总条数
|
||||
int totalCount = replyService.productReplyCount(id);
|
||||
productVo.setReplyCount(totalCount);
|
||||
@ -362,21 +363,24 @@ public class YxStoreProductServiceImpl extends BaseServiceImpl<StoreProductMappe
|
||||
//门店
|
||||
productVo.setSystemStore(systemStoreService.getStoreInfo(latitude, longitude));
|
||||
productVo.setMapKey(RedisUtil.get(ShopKeyUtils.getTengXunMapKey()));
|
||||
//添加足迹
|
||||
YxStoreProductRelation foot = relationService.getOne(new LambdaQueryWrapper<YxStoreProductRelation>()
|
||||
.eq(YxStoreProductRelation::getUid, uid)
|
||||
.eq(YxStoreProductRelation::getProductId, storeProductQueryVo.getId())
|
||||
.eq(YxStoreProductRelation::getType, "foot"));
|
||||
if (ObjectUtil.isNotNull(foot)) {
|
||||
foot.setCreateTime(new Date());
|
||||
relationService.saveOrUpdate(foot);
|
||||
} else {
|
||||
YxStoreProductRelation storeProductRelation = new YxStoreProductRelation();
|
||||
storeProductRelation.setProductId(storeProductQueryVo.getId());
|
||||
storeProductRelation.setUid(uid);
|
||||
storeProductRelation.setCreateTime(new Date());
|
||||
storeProductRelation.setType("foot");
|
||||
relationService.save(storeProductRelation);
|
||||
if (uid.longValue() > 0) {
|
||||
//添加足迹
|
||||
YxStoreProductRelation foot = relationService.getOne(new LambdaQueryWrapper<YxStoreProductRelation>()
|
||||
.eq(YxStoreProductRelation::getUid, uid)
|
||||
.eq(YxStoreProductRelation::getProductId, storeProductQueryVo.getId())
|
||||
.eq(YxStoreProductRelation::getType, "foot"));
|
||||
|
||||
if (ObjectUtil.isNotNull(foot)) {
|
||||
foot.setCreateTime(new Date());
|
||||
relationService.saveOrUpdate(foot);
|
||||
} else {
|
||||
YxStoreProductRelation storeProductRelation = new YxStoreProductRelation();
|
||||
storeProductRelation.setProductId(storeProductQueryVo.getId());
|
||||
storeProductRelation.setUid(uid);
|
||||
storeProductRelation.setCreateTime(new Date());
|
||||
storeProductRelation.setType("foot");
|
||||
relationService.save(storeProductRelation);
|
||||
}
|
||||
}
|
||||
|
||||
return productVo;
|
||||
|
@ -30,7 +30,7 @@ import java.util.List;
|
||||
@Repository
|
||||
public interface YxStoreProductRelationMapper extends CoreMapper<YxStoreProductRelation> {
|
||||
|
||||
@Select("select B.id pid,A.type as category,B.store_name as storeName,B.price," +
|
||||
@Select("select B.id pid,A.type as category,B.store_name as storeName,B.price,B.is_integral as isIntegral," +
|
||||
"B.ot_price as otPrice,B.sales,B.image,B.is_show as isShow" +
|
||||
" from yx_store_product_relation A left join yx_store_product B " +
|
||||
"on A.product_id = B.id where A.type=#{type} and A.uid=#{uid} and A.is_del = 0 and B.is_del = 0 order by A.create_time desc")
|
||||
|
@ -62,4 +62,7 @@ public class YxStoreProductRelationQueryVo implements Serializable {
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty(value = "是否开启积分兑换")
|
||||
private Integer isIntegral;
|
||||
|
||||
}
|
||||
|
Reference in New Issue
Block a user