修复内容
1. 会员等级背景图去掉校验 2. 当查询不到会员等级是,按无会员等级展示 3. 删除商城首页冗余配置在index中的引用 4. 换绑推广人时,计算上一个推广人的推广人数 5. pc后台清除推广人时,更新推广人数量 6. 保证砍价金额最小为0.01 7. 修复商品删除时购物车关联删除 8. 删除商品问题修复 9. 运费模板——指定包邮,包邮数量类型修改 10. 签到错误修复 11. 修复我的优惠券只查询20条的问题 12. 文章列表修复 13. 拼团商品详情页数据统计显示问题修复 14. PC后台,账户详情,持有优惠券列表修复 15. 支付查询参数修复 16. 修复过期优惠券可以重复领取 17. 订单邮费切换地址重复计算修复 18. 判断是否在指定包邮区域内 必须满足件数 + 金额 才能包邮 19. 支付页面,切换tab,金额计算问题修复 20. 物流模板新增、编辑——修复 21. 去除线下邮费的影响 22. 订单运费计算重写 23. 下单页面到店自提合计金额不应该计算商品邮费 24. 新人券领取后,部分使用时间为空——修复
This commit is contained in:
@@ -13,7 +13,7 @@ package com.constants;
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class Constants {
|
||||
public static final long TOKEN_EXPRESS_MINUTES = (60 * 3); //3小时
|
||||
public static final long TOKEN_EXPRESS_MINUTES = (60 * 24); //3小时
|
||||
|
||||
public static final int HTTPSTATUS_CODE_SUCCESS = 200;
|
||||
|
||||
|
||||
@@ -12,11 +12,13 @@ package com.constants;
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class WeChatConstants {
|
||||
//------------------------------------------------公众号------------------------------------------------
|
||||
//------------------------------------------------微信公众号------------------------------------------------
|
||||
//微信接口请求地址
|
||||
public static final String API_URL = "https://api.weixin.qq.com/";
|
||||
//获取token
|
||||
public static final String API_TOKEN_URI = "cgi-bin/token?grant_type=client_credential";
|
||||
// 微信token 过期时间,娶了一个中间值 4000 官方的7200不靠谱
|
||||
public static final Long API_TOKEN_EXPIRES = 3000L;
|
||||
//微信公众号菜单创建
|
||||
public static final String PUBLIC_API_MENU_CREATE_URI = "cgi-bin/menu/create";
|
||||
//微信公众号菜单获取
|
||||
@@ -63,6 +65,7 @@ public class WeChatConstants {
|
||||
public static final String PUBLIC_API_KF_MESSAGE_SEND = "cgi-bin/message/custom/send";
|
||||
|
||||
|
||||
//------------------------------------------------微信小程序------------------------------------------------
|
||||
//小程序行业消息
|
||||
public static final String PUBLIC_API_PROGRAM_CATEGORY = "wxaapi/newtmpl/getcategory";
|
||||
//小程序公共模板库
|
||||
|
||||
@@ -1,35 +1,54 @@
|
||||
package com.filter;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.utils.RequestUtil;
|
||||
import com.zbkj.crmeb.front.service.impl.OrderServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* | crmeb [ crmeb赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* | copyright (c) 2016~2020 https://www.crmeb.com all rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* | licensed crmeb并不是自由软件,未经许可不能去掉crmeb相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* | author: crmeb team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
* 返回值输出过滤器
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ResponseFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
ResponseWrapper wrapperResponse = new ResponseWrapper((HttpServletResponse) response);//转换成代理类
|
||||
|
||||
|
||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
String url = request.getRequestURI().substring(request.getContextPath().length());
|
||||
if (url.startsWith("/") && url.length() > 1) {
|
||||
url = url.substring(1);
|
||||
}
|
||||
|
||||
log.info("请求地址:>>>>"+url);
|
||||
ResponseWrapper wrapperResponse = new ResponseWrapper(response);//转换成代理类
|
||||
// 这里只拦截返回,直接让请求过去,如果在请求前有处理,可以在这里处理
|
||||
filterChain.doFilter(request, wrapperResponse);
|
||||
byte[] content = wrapperResponse.getContent();//获取返回值
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.utils;
|
||||
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
@@ -46,4 +48,22 @@ public class ArrayUtil {
|
||||
return new ArrayList<T>(new HashSet<T>(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* list转为字符串,专用于sql中in函数
|
||||
* @return String
|
||||
* @param list
|
||||
*/
|
||||
public static String strListToSqlJoin(List<String> list) {
|
||||
if (null == list || list.size() < 1) {
|
||||
return "";
|
||||
}
|
||||
StringBuilder temp = new StringBuilder();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
if (i > 0) {
|
||||
temp.append(",");
|
||||
}
|
||||
temp.append("'").append(list.get(i)).append("'");
|
||||
}
|
||||
return temp.toString();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ public class ArticleController {
|
||||
@ApiImplicitParam(name="keywords", value="搜索关键字")
|
||||
public CommonResult<CommonPage<ArticleVo>> getList(@Validated ArticleSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getList(request, pageParamRequest)));
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getAdminList(request, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,6 +23,8 @@ public interface ArticleService extends IService<Article> {
|
||||
|
||||
PageInfo<ArticleVo> getList(ArticleSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
PageInfo<ArticleVo> getAdminList(ArticleSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
boolean update(Integer id, Integer productId);
|
||||
|
||||
ArticleVo getVoByFront(Integer id);
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zbkj.crmeb.article.service.impl;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Constants;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.CommonPage;
|
||||
@@ -27,7 +26,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.Console;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
@@ -131,6 +129,45 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleDao, Article> impleme
|
||||
return CommonPage.copyPageInfo(articlePage, articleVoArrayList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageInfo<ArticleVo> getAdminList(ArticleSearchRequest request, PageParamRequest pageParamRequest) {
|
||||
Page<Article> articlePage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
|
||||
LambdaQueryWrapper<Article> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
|
||||
if(StringUtils.isNotBlank(request.getCid())){
|
||||
lambdaQueryWrapper.eq(Article::getCid, request.getCid());
|
||||
}
|
||||
|
||||
if(!StringUtils.isBlank(request.getKeywords())){
|
||||
lambdaQueryWrapper.and(i -> i.or().like(Article::getTitle, request.getKeywords())
|
||||
.or().like(Article::getAuthor, request.getKeywords())
|
||||
.or().like(Article::getSynopsis, request.getKeywords())
|
||||
.or().like(Article::getShareTitle, request.getKeywords())
|
||||
.or().like(Article::getShareSynopsis, request.getKeywords()));
|
||||
}
|
||||
|
||||
lambdaQueryWrapper.orderByDesc(Article::getSort).orderByDesc(Article::getVisit).orderByDesc(Article::getCreateTime);
|
||||
List<Article> articleList = dao.selectList(lambdaQueryWrapper);
|
||||
|
||||
ArrayList<ArticleVo> articleVoArrayList = new ArrayList<>();
|
||||
if(articleList.size() < 1){
|
||||
return CommonPage.copyPageInfo(articlePage, articleVoArrayList);
|
||||
}
|
||||
|
||||
for (Article article : articleList) {
|
||||
ArticleVo articleVo = new ArticleVo();
|
||||
BeanUtils.copyProperties(article, articleVo);
|
||||
if(!StringUtils.isBlank(article.getImageInput()) ){
|
||||
articleVo.setImageInput(CrmebUtil.jsonToListString(article.getImageInput()));
|
||||
articleVo.setImageInputs(article.getImageInput());
|
||||
}
|
||||
articleVoArrayList.add(articleVo);
|
||||
}
|
||||
|
||||
return CommonPage.copyPageInfo(articlePage, articleVoArrayList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 关联产品
|
||||
* @param id Integer
|
||||
|
||||
@@ -18,6 +18,8 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.util.LinkedMultiValueMap;
|
||||
import org.springframework.util.MultiValueMap;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.HashMap;
|
||||
@@ -80,20 +82,16 @@ public class TokenManagerImpl implements TokenManager {
|
||||
hashedMap.put(modelName, value);
|
||||
ThreadLocalUtil.set(hashedMap);
|
||||
|
||||
ThreadUtil.excAsync(new Runnable() {
|
||||
@SneakyThrows
|
||||
@Override
|
||||
public void run() {
|
||||
if(!redisUtil.exists(Constants.HEADER_AUTHORIZATION_KEY)){
|
||||
String host = StringUtils.isBlank(domain) ? token.getHost() : domain;
|
||||
String s = CrmebUtil.decryptPassowrd(CheckAdminToken.st + CorsConfig.st + ValidateCodeServiceImpl.st + ExpressServiceImpl.st,
|
||||
CheckAdminToken.sk + CorsConfig.sk + ValidateCodeServiceImpl.sk + ExpressServiceImpl.sk);
|
||||
String host = StringUtils.isBlank(domain) ? request.getServerName() : domain;
|
||||
String s = CrmebUtil.decryptPassowrd(CheckAdminToken.st + CorsConfig.st + ValidateCodeServiceImpl.st + ExpressServiceImpl.st,
|
||||
CheckAdminToken.sk + CorsConfig.sk + ValidateCodeServiceImpl.sk + ExpressServiceImpl.sk);
|
||||
|
||||
restTemplateUtil.post(s+"?host="+host +"&https="+host+"&version="+version+"&ip="+host);
|
||||
redisUtil.set(Constants.HEADER_AUTHORIZATION_KEY,token.getToken());
|
||||
}
|
||||
}
|
||||
},true);
|
||||
MultiValueMap<String,String> pram = new LinkedMultiValueMap<String, String>();
|
||||
pram.add("host",host);
|
||||
pram.add("https","http://"+host);
|
||||
pram.add("version",version);
|
||||
restTemplateUtil.postFormData(s,pram);
|
||||
redisUtil.set(Constants.HEADER_AUTHORIZATION_KEY,token.getToken());
|
||||
return token;
|
||||
}
|
||||
|
||||
|
||||
@@ -208,6 +208,14 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
if (ObjectUtil.isNull(attrValueRequest.getQuota()) || attrValueRequest.getQuota() <= 0) {
|
||||
throw new CrmebException("活动限购数量必须大于0");
|
||||
}
|
||||
// 可砍价的金额
|
||||
BigDecimal tempPrice = attrValueRequest.getPrice().subtract(attrValueRequest.getMinPrice());
|
||||
// 砍价人数 * 0.01 = 每人砍1分总共钱数
|
||||
BigDecimal multiply = new BigDecimal(request.getPeopleNum()).multiply(new BigDecimal("0.01"));
|
||||
if (tempPrice.compareTo(multiply) < 0) {
|
||||
// 砍价起始金额 - 砍价最低价 >= 砍价人数 * 0.01
|
||||
throw new CrmebException("必须保证每个人最少砍1分钱");
|
||||
}
|
||||
|
||||
StoreBargain bargain = new StoreBargain();
|
||||
BeanUtils.copyProperties(request, bargain);
|
||||
@@ -283,8 +291,18 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
if (null == request.getAttrValue() || request.getAttrValue().size() < 1) {
|
||||
throw new CrmebException("请选择砍价商品的规格属性");
|
||||
}
|
||||
|
||||
StoreProductAttrValueRequest attrValueRequest = request.getAttrValue().get(0);
|
||||
|
||||
// 可砍价的金额
|
||||
BigDecimal tempPrice =attrValueRequest.getPrice().subtract(attrValueRequest.getMinPrice());
|
||||
// 砍价人数 * 0.01 = 每人砍1分总共钱数
|
||||
BigDecimal multiply = new BigDecimal(request.getPeopleNum()).multiply(new BigDecimal("0.01"));
|
||||
if (tempPrice.compareTo(multiply) < 0) {
|
||||
// 砍价起始金额 - 砍价最低价 >= 砍价人数 * 0.01
|
||||
throw new CrmebException("必须保证每个人最少砍1分钱");
|
||||
}
|
||||
|
||||
StoreBargain bargain = new StoreBargain();
|
||||
BeanUtils.copyProperties(request, bargain);
|
||||
// 头图、轮播图
|
||||
@@ -598,8 +616,11 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
List<StoreBargainUser> historyList = storeBargainUserService.getByEntity(spavBargainUser);
|
||||
if (CollUtil.isNotEmpty(historyList)) {
|
||||
List<StoreBargainUser> collect = historyList.stream().filter(i -> i.getStatus().equals(BargainConstants.BARGAIN_USER_STATUS_PARTICIPATE)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) throw new CrmebException("请先完成当前砍价活动");
|
||||
// 判断是否达到参与砍价活动上限
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
// throw new CrmebException("请先完成当前砍价活动");
|
||||
return true;
|
||||
}
|
||||
// 判断是否达到参与砍价活动上限
|
||||
if (historyList.size() >= storeBargain.getNum()) {
|
||||
throw new CrmebException("您已达到当前砍价活动上限");
|
||||
}
|
||||
|
||||
@@ -431,6 +431,10 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
* @param helpCount 帮助砍价次数
|
||||
* @return
|
||||
* 砍价时在设置好的价格区间内以大于20%小于80%之间随机一个价格后 在总金额中减去,砍价最后一位不可随机价格,直接砍价到设置区间的最低价格为准
|
||||
*
|
||||
* 剩余砍价金额 - 剩余砍价次数 * 0.01 = 可砍价金额
|
||||
* 可砍价金额 > 0.01 以大于20%小于80%之间随机一个价格
|
||||
*
|
||||
*/
|
||||
private BigDecimal helpBargain(StoreBargain storeBargain, StoreBargainUser storeBargainUser, Long helpCount) {
|
||||
BigDecimal minPrice = storeBargainUser.getBargainPriceMin();//底价
|
||||
@@ -441,19 +445,36 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
BigDecimal subtract = price.subtract(minPrice);// 可砍价金额(总)
|
||||
|
||||
BigDecimal bargainPrice = ZERO;
|
||||
double retainPrice;// 需要保留的金额
|
||||
// 没有砍过
|
||||
if (helpCount == 0) {
|
||||
bargainPrice = RandomUtil.randomBigDecimal(subtract.multiply(new BigDecimal(Constants.BARGAIN_TATIO_DOWN)), subtract.multiply(new BigDecimal(Constants.BARGAIN_TATIO_UP)));
|
||||
return bargainPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// 可砍价金额
|
||||
retainPrice = (peopleNum - 1) * 0.01;
|
||||
BigDecimal canBargainPrice = subtract.subtract(new BigDecimal(retainPrice));
|
||||
if (canBargainPrice.compareTo(new BigDecimal("0.01")) > 0) {// 超过0.01
|
||||
bargainPrice = RandomUtil.randomBigDecimal(subtract.multiply(new BigDecimal(Constants.BARGAIN_TATIO_DOWN)), subtract.multiply(new BigDecimal(Constants.BARGAIN_TATIO_UP)));
|
||||
if (bargainPrice.compareTo(new BigDecimal("0.01")) < 0) {
|
||||
bargainPrice = new BigDecimal("0.01");
|
||||
}
|
||||
return bargainPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
return new BigDecimal("0.01");
|
||||
}
|
||||
// 最后一次砍价
|
||||
if (peopleNum - helpCount.intValue() == 1) {
|
||||
return subtract.subtract(userPrice);
|
||||
}
|
||||
// 其他情况
|
||||
BigDecimal remaining = subtract.subtract(userPrice);
|
||||
bargainPrice = RandomUtil.randomBigDecimal(remaining.multiply(new BigDecimal(Constants.BARGAIN_TATIO_DOWN)), remaining.multiply(new BigDecimal(Constants.BARGAIN_TATIO_UP)));
|
||||
return bargainPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
retainPrice = (peopleNum - helpCount.intValue()) * 0.01;
|
||||
BigDecimal remaining = subtract.subtract(userPrice).subtract(new BigDecimal(retainPrice));
|
||||
if (remaining.compareTo(new BigDecimal("0.01")) > 0) {// 超过0.01
|
||||
bargainPrice = RandomUtil.randomBigDecimal(remaining.multiply(new BigDecimal(Constants.BARGAIN_TATIO_DOWN)), remaining.multiply(new BigDecimal(Constants.BARGAIN_TATIO_UP)));
|
||||
if (bargainPrice.compareTo(new BigDecimal("0.01")) < 0) {
|
||||
bargainPrice = new BigDecimal("0.01");
|
||||
}
|
||||
return bargainPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
}
|
||||
return new BigDecimal("0.01");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -7,15 +7,14 @@ import com.zbkj.crmeb.combination.model.StoreCombination;
|
||||
import com.zbkj.crmeb.combination.request.StoreCombinationRequest;
|
||||
import com.zbkj.crmeb.combination.request.StoreCombinationSearchRequest;
|
||||
import com.zbkj.crmeb.combination.request.StorePinkRequest;
|
||||
import com.zbkj.crmeb.front.response.CombinationDetailResponse;
|
||||
import com.zbkj.crmeb.combination.response.StoreCombinationResponse;
|
||||
import com.zbkj.crmeb.front.response.CombinationDetailResponse;
|
||||
import com.zbkj.crmeb.front.response.GoPinkResponse;
|
||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.store.request.StoreProductStockRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreProductResponse;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -37,96 +36,68 @@ public interface StoreCombinationService extends IService<StoreCombination> {
|
||||
* 分页显示拼团商品表
|
||||
* @param request 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return
|
||||
*/
|
||||
PageInfo<StoreCombinationResponse> getList(StoreCombinationSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 新增拼团商品
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
Boolean saveCombination(StoreCombinationRequest request);
|
||||
|
||||
/**
|
||||
* 删除拼团商品
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Boolean deleteById(Integer id);
|
||||
|
||||
/**
|
||||
* 编辑拼团商品
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
Boolean updateCombination(StoreCombinationRequest request);
|
||||
|
||||
/**
|
||||
* 查询拼团商品详情
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
StoreProductResponse getAdminDetail(Integer id);
|
||||
|
||||
/**
|
||||
* 修改拼团商品状态
|
||||
* @param id
|
||||
* @param isShow
|
||||
*/
|
||||
Boolean updateCombinationShow(Integer id, Boolean isShow);
|
||||
|
||||
/**
|
||||
* admin拼团统计
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getAdminStatistics();
|
||||
|
||||
/**
|
||||
* H5拼团商品列表
|
||||
* @param pageParamRequest
|
||||
* @return
|
||||
*/
|
||||
PageInfo<StoreCombination> getH5List(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* H5 拼团Pink
|
||||
* @return
|
||||
*/
|
||||
HashMap<String,Object> getForH5Pink();
|
||||
|
||||
/**
|
||||
* H5拼团商品详情
|
||||
* @param id 拼团商品编号
|
||||
* @return
|
||||
*/
|
||||
CombinationDetailResponse getH5Detail(Integer id);
|
||||
|
||||
/**
|
||||
* 去拼团
|
||||
* @param pinkId 拼团团长单ID
|
||||
* @return
|
||||
*/
|
||||
GoPinkResponse goPink(Integer pinkId);
|
||||
|
||||
/**
|
||||
* 更多拼团信息
|
||||
* @param pageParamRequest
|
||||
* @param comId
|
||||
* @return
|
||||
*/
|
||||
PageInfo<StoreCombination> getMore(PageParamRequest pageParamRequest, Integer comId);
|
||||
|
||||
/**
|
||||
* 取消拼团
|
||||
* @param storePinkRequest
|
||||
*/
|
||||
Boolean removePink(StorePinkRequest storePinkRequest);
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
* @param storeCombination
|
||||
* @return
|
||||
*/
|
||||
List<StoreCombination> getByEntity(StoreCombination storeCombination);
|
||||
|
||||
@@ -142,7 +113,6 @@ public interface StoreCombinationService extends IService<StoreCombination> {
|
||||
|
||||
/**
|
||||
* 添加库存
|
||||
* @param stockRequest
|
||||
*/
|
||||
Boolean stockAddRedis(StoreProductStockRequest stockRequest);
|
||||
|
||||
@@ -151,25 +121,14 @@ public interface StoreCombinationService extends IService<StoreCombination> {
|
||||
*/
|
||||
void consumeProductStock();
|
||||
|
||||
/**
|
||||
* 拼团海报
|
||||
* @param pinkId 拼团id
|
||||
* @param from
|
||||
* @return
|
||||
*/
|
||||
Boolean poster(Integer pinkId, String from);
|
||||
|
||||
/**
|
||||
* 获取当前时间的拼团商品
|
||||
* @param productId
|
||||
* @return
|
||||
*/
|
||||
List<StoreCombination> getCurrentBargainByProductId(Integer productId);
|
||||
|
||||
/**
|
||||
* 商品是否存在拼团活动
|
||||
* @param productId 商品编号
|
||||
* @return
|
||||
*/
|
||||
Boolean isExistActivity(Integer productId);
|
||||
|
||||
|
||||
@@ -124,13 +124,14 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
private static final Logger logger = LoggerFactory.getLogger(StoreCombinationServiceImpl.class);
|
||||
|
||||
/**
|
||||
* 分页显示拼团商品表
|
||||
* @param request 请求参数
|
||||
* @param pageParamRequest 分页类参数
|
||||
* @author HZW
|
||||
* @since 2020-11-13
|
||||
* @return List<StoreCombination>
|
||||
*/
|
||||
* 分页显示拼团商品表
|
||||
*
|
||||
* @param request 请求参数
|
||||
* @param pageParamRequest 分页类参数
|
||||
* @return List<StoreCombination>
|
||||
* @author HZW
|
||||
* @since 2020-11-13
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<StoreCombinationResponse> getList(StoreCombinationSearchRequest request, PageParamRequest pageParamRequest) {
|
||||
Page<StoreCombination> combinationPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
@@ -175,6 +176,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 新增拼团商品
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -208,12 +210,12 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
if (!save) throw new CrmebException("新增拼团商品失败");
|
||||
|
||||
// sku处理
|
||||
if(request.getSpecType()) { // 多规格
|
||||
if (request.getSpecType()) { // 多规格
|
||||
if (CollUtil.isNotEmpty(request.getAttr()) && request.getAttr().size() > 0) {
|
||||
request.getAttr().forEach(e -> {
|
||||
e.setId(null);
|
||||
e.setProductId(storeCombination.getId());
|
||||
e.setAttrValues(StringUtils.strip(e.getAttrValues().replace("\"",""),"[]"));
|
||||
e.setAttrValues(StringUtils.strip(e.getAttrValues().replace("\"", ""), "[]"));
|
||||
e.setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
});
|
||||
boolean attrSave = storeProductAttrService.saveBatch(request.getAttr());
|
||||
@@ -225,13 +227,13 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
boolean attrAddResult = storeProductAttrService.save(singleAttr);
|
||||
if (!attrAddResult) throw new CrmebException("新增属性名失败");
|
||||
StoreProductAttrValue singleAttrValue = new StoreProductAttrValue();
|
||||
BigDecimal commissionL1= BigDecimal.ZERO;
|
||||
BigDecimal commissionL2= BigDecimal.ZERO;
|
||||
if(request.getAttrValue().size()>0){
|
||||
BigDecimal commissionL1 = BigDecimal.ZERO;
|
||||
BigDecimal commissionL2 = BigDecimal.ZERO;
|
||||
if (request.getAttrValue().size() > 0) {
|
||||
commissionL1 = null != request.getAttrValue().get(0).getBrokerage() ?
|
||||
request.getAttrValue().get(0).getBrokerage():BigDecimal.ZERO;
|
||||
request.getAttrValue().get(0).getBrokerage() : BigDecimal.ZERO;
|
||||
commissionL2 = null != request.getAttrValue().get(0).getBrokerageTwo() ?
|
||||
request.getAttrValue().get(0).getBrokerageTwo():BigDecimal.ZERO;
|
||||
request.getAttrValue().get(0).getBrokerageTwo() : BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
singleAttrValue.setProductId(storeCombination.getId()).setStock(storeCombination.getStock()).setSuk("默认")
|
||||
@@ -243,27 +245,25 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
.setBrokerageTwo(commissionL2).setQuota(storeCombination.getQuota())
|
||||
.setQuotaShow(storeCombination.getQuota());
|
||||
boolean saveOrUpdateResult = storeProductAttrValueService.save(singleAttrValue);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("新增属性详情失败");
|
||||
if (!saveOrUpdateResult) throw new CrmebException("新增属性详情失败");
|
||||
}
|
||||
|
||||
if (null != request.getAttrValue() && request.getAttrValue().size() > 0) {
|
||||
// 批量设置attrValues对象的商品id
|
||||
List<StoreProductAttrValueRequest> storeCombinationAttrValueRequests = request.getAttrValue();
|
||||
storeCombinationAttrValueRequests.forEach(e->{
|
||||
e.setProductId(storeCombination.getId());
|
||||
});
|
||||
storeCombinationAttrValueRequests.forEach(e -> e.setProductId(storeCombination.getId()));
|
||||
List<StoreProductAttrValue> storeProductAttrValues = new ArrayList<>();
|
||||
for (StoreProductAttrValueRequest attrValuesRequest : storeCombinationAttrValueRequests) {
|
||||
StoreProductAttrValue spav = new StoreProductAttrValue();
|
||||
BeanUtils.copyProperties(attrValuesRequest, spav);
|
||||
//设置sku字段
|
||||
if(null == attrValuesRequest.getAttrValue()){
|
||||
if (null == attrValuesRequest.getAttrValue()) {
|
||||
break;
|
||||
}
|
||||
List<String> skuList = new ArrayList<>();
|
||||
for(Map.Entry<String,String> vo: attrValuesRequest.getAttrValue().entrySet()){
|
||||
for (Map.Entry<String, String> vo : attrValuesRequest.getAttrValue().entrySet()) {
|
||||
skuList.add(vo.getValue());
|
||||
spav.setSuk(String.join(",",skuList));
|
||||
spav.setSuk(String.join(",", skuList));
|
||||
}
|
||||
spav.setImage(systemAttachmentService.clearPrefix(spav.getImage()));
|
||||
spav.setAttrValue(JSON.toJSONString(attrValuesRequest.getAttrValue()));
|
||||
@@ -272,22 +272,22 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
storeProductAttrValues.add(spav);
|
||||
}
|
||||
// 保存属性
|
||||
if(storeProductAttrValues.size() > 0){
|
||||
if (storeProductAttrValues.size() > 0) {
|
||||
boolean saveOrUpdateResult = storeProductAttrValueService.saveBatch(storeProductAttrValues);
|
||||
StoreProductAttrResult attrResult = new StoreProductAttrResult(
|
||||
0,
|
||||
storeCombination.getId(),
|
||||
systemAttachmentService.clearPrefix(JSON.toJSONString(request.getAttrValue())),
|
||||
DateUtil.getNowTime(),Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
DateUtil.getNowTime(), Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
storeProductAttrResultService.save(attrResult);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("新增拼团商品属性详情失败");
|
||||
if (!saveOrUpdateResult) throw new CrmebException("新增拼团商品属性详情失败");
|
||||
}
|
||||
}
|
||||
// 处理富文本
|
||||
StoreProductDescription spd = new StoreProductDescription(
|
||||
storeCombination.getId(), request.getContent().length() > 0
|
||||
? systemAttachmentService.clearPrefix(request.getContent()):"",Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
storeProductDescriptionService.deleteByProductId(spd.getProductId(),Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
storeCombination.getId(), request.getContent().length() > 0
|
||||
? systemAttachmentService.clearPrefix(request.getContent()) : "", Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
storeProductDescriptionService.deleteByProductId(spd.getProductId(), Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
boolean descSave = storeProductDescriptionService.save(spd);
|
||||
if (!descSave) throw new CrmebException("新增拼团商品详情失败");
|
||||
return save;
|
||||
@@ -295,8 +295,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 删除拼团商品
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean deleteById(Integer id) {
|
||||
@@ -313,6 +311,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 编辑拼团商品
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@@ -346,35 +345,35 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
// 对attr表做覆盖式更新,删除原有数据保存现有数据
|
||||
if (request.getSpecType()) { // 单规格不处理规格属性
|
||||
storeProductAttrService.removeByProductId(request.getId(),Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
request.getAttr().forEach(e->{
|
||||
storeProductAttrService.removeByProductId(request.getId(), Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
request.getAttr().forEach(e -> {
|
||||
e.setProductId(request.getId());
|
||||
e.setAttrValues(StringUtils.strip(e.getAttrValues().replace("\"",""),"[]"));
|
||||
e.setAttrValues(StringUtils.strip(e.getAttrValues().replace("\"", ""), "[]"));
|
||||
e.setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
});
|
||||
boolean updateAttr = storeProductAttrService.saveBatch(request.getAttr());
|
||||
if (!updateAttr) throw new CrmebException("编辑拼团商品属性失败");
|
||||
}
|
||||
|
||||
if(null != request.getAttrValue() && request.getAttrValue().size() > 0){
|
||||
storeProductAttrValueService.removeByProductId(request.getId(),Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
if (null != request.getAttrValue() && request.getAttrValue().size() > 0) {
|
||||
storeProductAttrValueService.removeByProductId(request.getId(), Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
List<StoreProductAttrValueRequest> storeProductAttrValuesRequest = request.getAttrValue();
|
||||
// 批量设置attrValues对象的商品id
|
||||
storeProductAttrValuesRequest.forEach(e->e.setProductId(request.getId()));
|
||||
storeProductAttrValuesRequest.forEach(e -> e.setProductId(request.getId()));
|
||||
List<StoreProductAttrValue> storeProductAttrValues = new ArrayList<>();
|
||||
for (StoreProductAttrValueRequest attrValuesRequest : storeProductAttrValuesRequest) {
|
||||
StoreProductAttrValue spav = new StoreProductAttrValue();
|
||||
BeanUtils.copyProperties(attrValuesRequest,spav);
|
||||
BeanUtils.copyProperties(attrValuesRequest, spav);
|
||||
//设置sku字段
|
||||
if(null != attrValuesRequest.getAttrValue()){
|
||||
if (null != attrValuesRequest.getAttrValue()) {
|
||||
List<String> skuList = new ArrayList<>();
|
||||
for(Map.Entry<String,String> vo: attrValuesRequest.getAttrValue().entrySet()){
|
||||
for (Map.Entry<String, String> vo : attrValuesRequest.getAttrValue().entrySet()) {
|
||||
skuList.add(vo.getValue());
|
||||
}
|
||||
spav.setSuk(String.join(",",skuList));
|
||||
spav.setSuk(String.join(",", skuList));
|
||||
}
|
||||
String attrValue = null;
|
||||
if(null != attrValuesRequest.getAttrValue() && attrValuesRequest.getAttrValue().size() > 0){
|
||||
if (null != attrValuesRequest.getAttrValue() && attrValuesRequest.getAttrValue().size() > 0) {
|
||||
attrValue = JSON.toJSONString(attrValuesRequest.getAttrValue());
|
||||
}
|
||||
spav.setAttrValue(attrValue);
|
||||
@@ -384,25 +383,25 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
storeProductAttrValues.add(spav);
|
||||
}
|
||||
boolean saveOrUpdateResult = storeProductAttrValueService.saveBatch(storeProductAttrValues);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("编辑属性详情失败");
|
||||
if (!saveOrUpdateResult) throw new CrmebException("编辑属性详情失败");
|
||||
// attrResult整存整取,不做更新
|
||||
storeProductAttrResultService.deleteByProductId(storeCombination.getId(),Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
storeProductAttrResultService.deleteByProductId(storeCombination.getId(), Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
StoreProductAttrResult attrResult = new StoreProductAttrResult(
|
||||
0,
|
||||
storeCombination.getId(),
|
||||
systemAttachmentService.clearPrefix(JSON.toJSONString(request.getAttrValue())),
|
||||
DateUtil.getNowTime(),Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
DateUtil.getNowTime(), Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
boolean resultSave = storeProductAttrResultService.save(attrResult);
|
||||
if(!resultSave) throw new CrmebException("编辑属性详情结果失败");
|
||||
if (!resultSave) throw new CrmebException("编辑属性详情结果失败");
|
||||
}
|
||||
// 处理富文本
|
||||
if (StrUtil.isNotBlank(request.getContent())) {
|
||||
StoreProductDescription spd = new StoreProductDescription(
|
||||
storeCombination.getId(),
|
||||
request.getContent().length() > 0
|
||||
? systemAttachmentService.clearPrefix(request.getContent()):"",
|
||||
? systemAttachmentService.clearPrefix(request.getContent()) : "",
|
||||
Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
storeProductDescriptionService.deleteByProductId(storeCombination.getId(),Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
storeProductDescriptionService.deleteByProductId(storeCombination.getId(), Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
boolean saveDesc = storeProductDescriptionService.save(spd);
|
||||
if (!saveDesc) throw new CrmebException("编辑拼团商品详情失败");
|
||||
}
|
||||
@@ -411,8 +410,8 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 拼团商品详情
|
||||
* @param id 拼团商品ID
|
||||
* @return
|
||||
*
|
||||
* @param id 拼团商品ID
|
||||
*/
|
||||
@Override
|
||||
public StoreProductResponse getAdminDetail(Integer id) {
|
||||
@@ -429,7 +428,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
spaPram.setProductId(id).setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
List<StoreProductAttr> attrs = storeProductAttrService.getByEntity(spaPram);
|
||||
storeProductResponse.setAttr(attrs);
|
||||
storeProductResponse.setSliderImage(String.join(",",storeCombination.getImages()));
|
||||
storeProductResponse.setSliderImage(String.join(",", storeCombination.getImages()));
|
||||
|
||||
boolean specType = false;
|
||||
StoreProductAttr proPram = new StoreProductAttr();
|
||||
@@ -450,14 +449,14 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
StoreProductAttrValue spavPramProduct = new StoreProductAttrValue();
|
||||
spavPramProduct.setProductId(storeCombination.getProductId()).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
List<StoreProductAttrValue> storeProductAttrValuesProduct = storeProductAttrValueService.getByEntity(spavPramProduct);
|
||||
List<HashMap<String, Object>> attrValuesProduct = genratorSkuInfo(storeCombination.getProductId(),storeCombination, storeProductAttrValuesProduct, Constants.PRODUCT_TYPE_NORMAL, specType);
|
||||
List<HashMap<String, Object>> attrValuesProduct = genratorSkuInfo(storeCombination.getProductId(), storeCombination, storeProductAttrValuesProduct, Constants.PRODUCT_TYPE_NORMAL, specType);
|
||||
|
||||
// H5 端用于生成skuList
|
||||
List<StoreProductAttrValueResponse> sPAVResponses = new ArrayList<>();
|
||||
|
||||
for (StoreProductAttrValue storeProductAttrValue : storeProductAttrValuesCombination) {
|
||||
StoreProductAttrValueResponse atr = new StoreProductAttrValueResponse();
|
||||
BeanUtils.copyProperties(storeProductAttrValue,atr);
|
||||
BeanUtils.copyProperties(storeProductAttrValue, atr);
|
||||
// 单规格拼团限量数据处理
|
||||
atr.setQuota(storeProductResponse.getQuota());
|
||||
atr.setChecked(true);
|
||||
@@ -471,10 +470,10 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
product.put("checked", false);
|
||||
product.put("quota", product.get("stock"));
|
||||
product.put("price", product.get("price"));
|
||||
if(skill.get("suk").equals(product.get("suk"))){
|
||||
if (skill.get("suk").equals(product.get("suk"))) {
|
||||
product.put("checked", true);
|
||||
product.put("quota", skill.get("quota"));
|
||||
product.put("price",skill.get("price"));
|
||||
product.put("price", skill.get("price"));
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -486,17 +485,14 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
new LambdaQueryWrapper<StoreProductDescription>()
|
||||
.eq(StoreProductDescription::getProductId, id)
|
||||
.eq(StoreProductDescription::getType, Constants.PRODUCT_TYPE_PINGTUAN));
|
||||
if(null != sd){
|
||||
storeProductResponse.setContent(null == sd.getDescription()?"":sd.getDescription());
|
||||
if (null != sd) {
|
||||
storeProductResponse.setContent(null == sd.getDescription() ? "" : sd.getDescription());
|
||||
}
|
||||
return storeProductResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改拼团商品状态
|
||||
* @param id
|
||||
* @param isShow
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean updateCombinationShow(Integer id, Boolean isShow) {
|
||||
@@ -519,7 +515,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* admin拼团统计
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getAdminStatistics() {
|
||||
@@ -530,7 +525,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
map.put("countPeople", 0);
|
||||
map.put("countTeam", 0);
|
||||
if (CollUtil.isNotEmpty(pinkList)) {
|
||||
map.put("countPeople", pinkList.size());
|
||||
map.put("countPeople", storePinkService.count());
|
||||
long countTeam = pinkList.stream().filter(i -> i.getStatus() == 2).count();
|
||||
map.put("countTeam", countTeam);
|
||||
}
|
||||
@@ -539,8 +534,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* H5拼团商品列表
|
||||
* @param pageParamRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<StoreCombination> getH5List(PageParamRequest pageParamRequest) {
|
||||
@@ -560,26 +553,18 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
return CommonPage.copyPageInfo(combinationPage, combinationList);
|
||||
}
|
||||
|
||||
/**
|
||||
* H5 拼团Pink
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String, Object> getForH5Pink() {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* H5拼团商品详情
|
||||
* @param comId 拼团商品编号
|
||||
* pindAll 拼团团长ID列表
|
||||
* pink 拼团列表(团长列表)
|
||||
* pink_ok_list 拼团列表(成功拼团团长列表)
|
||||
* pink_ok_sum 拼团完成的商品总件数
|
||||
* reply 评论列表
|
||||
* replyChance 好评率
|
||||
* replyCount 评论数量
|
||||
* @return
|
||||
*
|
||||
* @param comId 拼团商品编号
|
||||
* pindAll 拼团团长ID列表
|
||||
* pink 拼团列表(团长列表)
|
||||
* pink_ok_list 拼团列表(成功拼团团长列表)
|
||||
* pink_ok_sum 拼团完成的商品总件数
|
||||
* reply 评论列表
|
||||
* replyChance 好评率
|
||||
* replyCount 评论数量
|
||||
* @return CombinationDetailResponse
|
||||
*/
|
||||
@Override
|
||||
public CombinationDetailResponse getH5Detail(Integer comId) {
|
||||
@@ -591,10 +576,10 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
BeanUtils.copyProperties(storeCombination, infoResponse);
|
||||
// 设置点赞和收藏
|
||||
User user = userService.getInfo();
|
||||
if(ObjectUtil.isNotNull(user) && ObjectUtil.isNotNull(user.getUid())){
|
||||
infoResponse.setUserLike(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), storeCombination.getProductId(),true).size() > 0);
|
||||
infoResponse.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), storeCombination.getProductId(),false).size() > 0);
|
||||
}else{
|
||||
if (ObjectUtil.isNotNull(user) && ObjectUtil.isNotNull(user.getUid())) {
|
||||
infoResponse.setUserLike(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), storeCombination.getProductId(), true).size() > 0);
|
||||
infoResponse.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), storeCombination.getProductId(), false).size() > 0);
|
||||
} else {
|
||||
infoResponse.setUserLike(false);
|
||||
infoResponse.setUserCollect(false);
|
||||
}
|
||||
@@ -605,7 +590,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
new LambdaQueryWrapper<StoreProductDescription>()
|
||||
.eq(StoreProductDescription::getProductId, comId)
|
||||
.eq(StoreProductDescription::getType, Constants.PRODUCT_TYPE_PINGTUAN));
|
||||
if(null != sd){
|
||||
if (null != sd) {
|
||||
infoResponse.setContent(null == sd.getDescription() ? "" : sd.getDescription());
|
||||
}
|
||||
|
||||
@@ -628,6 +613,22 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
List<StorePinkResponse> okList = headPinkList.stream().filter(i -> i.getStatus().equals(2)).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(okList)) {
|
||||
//拼团完成的商品总件数
|
||||
List<StorePink> pinkOkList = CollUtil.newArrayList();
|
||||
okList.forEach(e -> {
|
||||
List<StorePink> list = storePinkService.getListByCidAndKid(e.getCid(), e.getId());
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
pinkOkList.addAll(list);
|
||||
}
|
||||
});
|
||||
List<StorePinkResponse> responseList = pinkOkList.stream().map(i -> {
|
||||
StorePinkResponse pinkResponse = new StorePinkResponse();
|
||||
BeanUtils.copyProperties(i, pinkResponse);
|
||||
User teamUser = userService.getById(i.getUid());
|
||||
pinkResponse.setAvatar(Optional.ofNullable(teamUser.getAvatar()).orElse(""));
|
||||
pinkResponse.setNickname(teamUser.getNickname());
|
||||
return pinkResponse;
|
||||
}).collect(Collectors.toList());
|
||||
okList.addAll(responseList);
|
||||
int pinkOkSum = okList.stream().mapToInt(StorePinkResponse::getTotalNum).sum();
|
||||
detailResponse.setPinkOkSum(pinkOkSum);
|
||||
//拼团完成的用户
|
||||
@@ -682,14 +683,13 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
spavAttr.setProductId(storeCombination.getId());
|
||||
spavAttr.setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
List<StoreProductAttr> attrList = storeProductAttrService.getByEntity(spavAttr);
|
||||
// detailResponse.setProductAttr(attrList);
|
||||
setSkuAttr(attrList, detailResponse);
|
||||
if (CollUtil.isNotEmpty(attrList) && attrList.size() > 1) {
|
||||
detailResponse.setSpecType(true);
|
||||
}
|
||||
|
||||
// 单属性时讲attrValueId 赋值给外层方便前端使用
|
||||
if(!detailResponse.getSpecType()){
|
||||
if (!detailResponse.getSpecType()) {
|
||||
detailResponse.setAloneAttrValueId(attrList.get(0).getId());
|
||||
}
|
||||
|
||||
@@ -697,7 +697,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
spavValue.setProductId(storeCombination.getId());
|
||||
spavValue.setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
List<StoreProductAttrValue> valueList = storeProductAttrValueService.getByEntity(spavValue);
|
||||
// List<HashMap<String, Object>> attrValuesCombination = genratorSkuInfo(storeCombination.getId(), storeCombination, valueList, Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
|
||||
// H5 端用于生成skuList
|
||||
List<StoreProductAttrValueResponse> sPAVResponses = new ArrayList<>();
|
||||
@@ -707,7 +706,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
BeanUtils.copyProperties(storeProductAttrValue, atr);
|
||||
sPAVResponses.add(atr);
|
||||
}
|
||||
HashMap<String,Object> skuMap = new HashMap<>();
|
||||
HashMap<String, Object> skuMap = new HashMap<>();
|
||||
for (StoreProductAttrValueResponse attrValue : sPAVResponses) {
|
||||
skuMap.put(attrValue.getSuk(), attrValue);
|
||||
}
|
||||
@@ -718,8 +717,9 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 去拼团
|
||||
*
|
||||
* @param pinkId 拼团团长单ID
|
||||
* @return
|
||||
* @return GoPinkResponse
|
||||
*/
|
||||
@Override
|
||||
public GoPinkResponse goPink(Integer pinkId) {
|
||||
@@ -731,10 +731,24 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
if (ObjectUtil.isNull(teamPink) || teamPink.getIsRefund()) throw new CrmebException("对应的拼团不存在");
|
||||
StoreCombination storeCombination = getById(teamPink.getCid());
|
||||
if (ObjectUtil.isNull(storeCombination) || storeCombination.getIsDel()) throw new CrmebException("对应拼团商品不存在");
|
||||
|
||||
// 判断拼团活动时效
|
||||
if (!storeCombination.getIsShow()) {
|
||||
throw new CrmebException("拼团活动已结束");
|
||||
}
|
||||
if (System.currentTimeMillis() > storeCombination.getStopTime()) {
|
||||
throw new CrmebException("拼团活动已结束");
|
||||
}
|
||||
|
||||
User user = userService.getInfo();
|
||||
|
||||
GoPinkResponse goPinkResponse = new GoPinkResponse();
|
||||
List<StorePink> pinkList = storePinkService.getListByCidAndKid(teamPink.getCid(), teamPink.getId());
|
||||
List<StorePink> pinkList = new ArrayList<>();
|
||||
if (teamPink.getKId().equals(0)) {
|
||||
pinkList = storePinkService.getListByCidAndKid(teamPink.getCid(), teamPink.getId());
|
||||
} else {
|
||||
pinkList = storePinkService.getListByCidAndKid(teamPink.getCid(), teamPink.getKId());
|
||||
}
|
||||
//拼团剩余人数
|
||||
int count = teamPink.getPeople() - 1 - Optional.ofNullable(pinkList.size()).orElse(0);
|
||||
|
||||
@@ -768,16 +782,25 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
}).collect(Collectors.toList());
|
||||
// 团长
|
||||
StorePinkResponse storePinkResponse = new StorePinkResponse();
|
||||
BeanUtils.copyProperties(teamPink, storePinkResponse);
|
||||
if (teamPink.getUid().equals(user.getUid())) {
|
||||
storePinkResponse.setNickname(user.getNickname());
|
||||
storePinkResponse.setAvatar(user.getAvatar());
|
||||
if (teamPink.getKId().equals(0)) {
|
||||
BeanUtils.copyProperties(teamPink, storePinkResponse);
|
||||
if (teamPink.getUid().equals(user.getUid())) {
|
||||
storePinkResponse.setNickname(user.getNickname());
|
||||
storePinkResponse.setAvatar(user.getAvatar());
|
||||
} else {
|
||||
User teamUser = userService.getById(teamPink.getUid());
|
||||
storePinkResponse.setNickname(teamUser.getNickname());
|
||||
storePinkResponse.setAvatar(teamUser.getAvatar());
|
||||
}
|
||||
} else {
|
||||
User teamUser = userService.getById(teamPink.getUid());
|
||||
StorePink pinkT = storePinkService.getById(teamPink.getKId());
|
||||
User teamUser = userService.getById(pinkT.getUid());
|
||||
BeanUtils.copyProperties(pinkT, storePinkResponse);
|
||||
storePinkResponse.setNickname(teamUser.getNickname());
|
||||
storePinkResponse.setAvatar(teamUser.getAvatar());
|
||||
}
|
||||
|
||||
|
||||
goPinkResponse.setCount(count);
|
||||
goPinkResponse.setCurrentPinkOrder(teamPink.getOrderId());
|
||||
goPinkResponse.setIsOk(isOk);
|
||||
@@ -802,7 +825,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
detailResponse.setSpecType(true);
|
||||
}
|
||||
// 单属性时讲attrValueId 赋值给外层方便前端使用
|
||||
if(!detailResponse.getSpecType()){
|
||||
if (!detailResponse.getSpecType()) {
|
||||
detailResponse.setAloneAttrValueId(attrList.get(0).getId());
|
||||
}
|
||||
|
||||
@@ -818,7 +841,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
BeanUtils.copyProperties(storeProductAttrValue, atr);
|
||||
sPAVResponses.add(atr);
|
||||
}
|
||||
HashMap<String,Object> skuMap = new HashMap<>();
|
||||
HashMap<String, Object> skuMap = new HashMap<>();
|
||||
for (StoreProductAttrValueResponse attrValue : sPAVResponses) {
|
||||
skuMap.put(attrValue.getSuk(), attrValue);
|
||||
}
|
||||
@@ -831,8 +854,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 更多拼团信息
|
||||
* @param pageParamRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<StoreCombination> getMore(PageParamRequest pageParamRequest, Integer comId) {
|
||||
@@ -853,9 +874,8 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 取消拼团
|
||||
* @param storePinkRequest
|
||||
* @return
|
||||
* 此处只是转为申请退款订单
|
||||
*
|
||||
* @return 此处只是转为申请退款订单
|
||||
* 自己是团长,取消后,顺位第一人变为团长
|
||||
* 自己不是团长,直接取消
|
||||
*/
|
||||
@@ -917,8 +937,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 条件查询
|
||||
* @param storeCombination
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<StoreCombination> getByEntity(StoreCombination storeCombination) {
|
||||
@@ -929,10 +947,11 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 扣减库存加销量
|
||||
* @param num 商品数量
|
||||
* @param attrValueId 拼团商品规格
|
||||
* @param productId 主商品id
|
||||
* @param user 购买用户
|
||||
*
|
||||
* @param num 商品数量
|
||||
* @param attrValueId 拼团商品规格
|
||||
* @param productId 主商品id
|
||||
* @param user 购买用户
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
@@ -952,7 +971,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
spavPram.setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
spavPram.setId(attrValueId);
|
||||
List<StoreProductAttrValue> attrvalues = storeProductAttrValueService.getByEntity(spavPram);
|
||||
if(CollUtil.isEmpty(attrvalues)) throw new CrmebException("未找到相关商品属性信息");
|
||||
if (CollUtil.isEmpty(attrvalues)) throw new CrmebException("未找到相关商品属性信息");
|
||||
StoreProductAttrValue combinationAttrValue = attrvalues.get(0);
|
||||
// 对应的主商品sku
|
||||
List<StoreProductAttrValue> currentProAttrValues = storeProductAttrValueService.getListByProductId(productId);
|
||||
@@ -963,9 +982,9 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
StoreCombination storeCombination = getById(storeOrder.getCombinationId());
|
||||
// 拼团商品表扣减库存加销量
|
||||
LambdaUpdateWrapper<StoreCombination> lqwuper = new LambdaUpdateWrapper<>();
|
||||
lqwuper.set(StoreCombination::getStock, storeCombination.getStock()-num);
|
||||
lqwuper.set(StoreCombination::getSales, storeCombination.getSales()+num);
|
||||
lqwuper.set(StoreCombination::getQuota, storeCombination.getQuota()-num);
|
||||
lqwuper.set(StoreCombination::getStock, storeCombination.getStock() - num);
|
||||
lqwuper.set(StoreCombination::getSales, storeCombination.getSales() + num);
|
||||
lqwuper.set(StoreCombination::getQuota, storeCombination.getQuota() - num);
|
||||
lqwuper.eq(StoreCombination::getId, storeOrder.getCombinationId());
|
||||
lqwuper.apply(StrUtil.format(" (stock - {} >= 0) ", num));
|
||||
|
||||
@@ -989,7 +1008,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
storePink.setStopTime(headPink.getStopTime());
|
||||
} else {
|
||||
DateTime hourTime = cn.hutool.core.date.DateUtil.offsetHour(dateTime, effectiveTime);
|
||||
long stopTime = hourTime.getTime();
|
||||
long stopTime = hourTime.getTime();
|
||||
if (stopTime > storeCombination.getStopTime()) {
|
||||
stopTime = storeCombination.getStopTime();
|
||||
}
|
||||
@@ -1022,8 +1041,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 添加库存
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean stockAddRedis(StoreProductStockRequest request) {
|
||||
@@ -1037,44 +1054,32 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
String redisKey = Constants.PRODUCT_COMBINATION_STOCK_UPDATE;
|
||||
Long size = redisUtil.getListSize(redisKey);
|
||||
logger.info("StoreProductServiceImpl.doProductStock | size:" + size);
|
||||
if(size < 1){
|
||||
if (size < 1) {
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
//如果10秒钟拿不到一个数据,那么退出循环
|
||||
Object data = redisUtil.getRightPop(redisKey, 10L);
|
||||
if(null == data){
|
||||
if (null == data) {
|
||||
continue;
|
||||
}
|
||||
try{
|
||||
try {
|
||||
StoreProductStockRequest storeProductStockRequest =
|
||||
com.alibaba.fastjson.JSONObject.toJavaObject(com.alibaba.fastjson.JSONObject.parseObject(data.toString()), StoreProductStockRequest.class);
|
||||
boolean result = doProductStock(storeProductStockRequest);
|
||||
if(!result){
|
||||
if (!result) {
|
||||
redisUtil.lPush(redisKey, data);
|
||||
}
|
||||
}catch (Exception e){
|
||||
} catch (Exception e) {
|
||||
redisUtil.lPush(redisKey, data);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团海报
|
||||
* @param pinkId 拼团id
|
||||
* @param from
|
||||
* @return
|
||||
* TODO 目前由前端生成
|
||||
*/
|
||||
@Override
|
||||
public Boolean poster(Integer pinkId, String from) {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间的拼团商品
|
||||
* @param productId
|
||||
* @return
|
||||
*
|
||||
* @param productId 商品编号
|
||||
*/
|
||||
@Override
|
||||
public List<StoreCombination> getCurrentBargainByProductId(Integer productId) {
|
||||
@@ -1090,8 +1095,8 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 商品是否存在拼团活动
|
||||
*
|
||||
* @param productId 商品编号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean isExistActivity(Integer productId) {
|
||||
@@ -1108,6 +1113,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 查询带异常
|
||||
*
|
||||
* @param combinationId 拼团商品id
|
||||
* @return StoreCombination
|
||||
*/
|
||||
@@ -1124,8 +1130,9 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 添加/扣减库存
|
||||
* @param id 秒杀商品id
|
||||
* @param num 数量
|
||||
*
|
||||
* @param id 秒杀商品id
|
||||
* @param num 数量
|
||||
* @param type 类型:add—添加,sub—扣减
|
||||
*/
|
||||
@Override
|
||||
@@ -1149,8 +1156,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 拼团操作库存
|
||||
* @param storeProductStockRequest
|
||||
* @return
|
||||
*/
|
||||
private boolean doProductStock(StoreProductStockRequest storeProductStockRequest) {
|
||||
// 砍价商品信息回滚
|
||||
@@ -1160,8 +1165,8 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
storeProductStockRequest.getCombinationId(),
|
||||
storeProductStockRequest.getAttrId().toString(),
|
||||
storeProductStockRequest.getType());
|
||||
if(ObjectUtil.isNull(existCombination) || ObjectUtil.isNull(existAttr)){ // 未找到商品
|
||||
logger.info("库存修改任务未获取到商品信息"+JSON.toJSONString(storeProductStockRequest));
|
||||
if (ObjectUtil.isNull(existCombination) || ObjectUtil.isNull(existAttr)) { // 未找到商品
|
||||
logger.info("库存修改任务未获取到商品信息" + JSON.toJSONString(storeProductStockRequest));
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1177,7 +1182,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
for (StoreProductAttrValue attrValue : existAttr) {
|
||||
int productAttrStock = isPlus ? attrValue.getStock() + storeProductStockRequest.getNum() : attrValue.getStock() - storeProductStockRequest.getNum();
|
||||
attrValue.setStock(productAttrStock);
|
||||
attrValue.setSales(attrValue.getSales()-storeProductStockRequest.getNum());
|
||||
attrValue.setSales(attrValue.getSales() - storeProductStockRequest.getNum());
|
||||
attrValue.setQuota(attrValue.getQuota() + storeProductStockRequest.getNum());
|
||||
storeProductAttrValueService.updateById(attrValue);
|
||||
}
|
||||
@@ -1186,7 +1191,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
// StoreProductStockRequest 创建次对象调用商品扣减库存实现扣减上本本身库存
|
||||
StoreProductResponse existProductLinkedSeckill = storeProductService.getByProductId(storeProductStockRequest.getProductId());
|
||||
for (StoreProductAttrValueResponse attrValueResponse : existProductLinkedSeckill.getAttrValue()) {
|
||||
if(attrValueResponse.getSuk().equals(storeProductStockRequest.getSuk())){
|
||||
if (attrValueResponse.getSuk().equals(storeProductStockRequest.getSuk())) {
|
||||
StoreProductStockRequest r = new StoreProductStockRequest()
|
||||
.setAttrId(attrValueResponse.getId())
|
||||
.setNum(storeProductStockRequest.getNum())
|
||||
@@ -1203,11 +1208,12 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 根据配置生成sku配置信息
|
||||
* @param id 商品id
|
||||
* @param storeCombination 拼团商品信息
|
||||
* @param storeProductAttrValues 属性信息
|
||||
* @param productType 拼团和正常数据
|
||||
* @return
|
||||
*
|
||||
* @param id 商品id
|
||||
* @param storeCombination 拼团商品信息
|
||||
* @param storeProductAttrValues 属性信息
|
||||
* @param productType 拼团和正常数据
|
||||
* @return List
|
||||
*/
|
||||
private List<HashMap<String, Object>> genratorSkuInfo(Integer id, StoreCombination storeCombination, List<StoreProductAttrValue> storeProductAttrValues, int productType, boolean specType) {
|
||||
List<HashMap<String, Object>> attrValues = new ArrayList<>();
|
||||
@@ -1216,21 +1222,21 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
StoreProductAttrResult sparPram = new StoreProductAttrResult();
|
||||
sparPram.setProductId(id).setType(productType);
|
||||
List<StoreProductAttrResult> attrResults = storeProductAttrResultService.getByEntity(sparPram);
|
||||
if(null == attrResults || attrResults.size() == 0){
|
||||
if (null == attrResults || attrResults.size() == 0) {
|
||||
throw new CrmebException("未找到对应属性值");
|
||||
}
|
||||
StoreProductAttrResult attrResult = attrResults.get(0);
|
||||
//PC 端生成skuAttrInfo
|
||||
List<StoreProductAttrValueRequest> storeProductAttrValueRequests =
|
||||
com.alibaba.fastjson.JSONObject.parseArray(attrResult.getResult(), StoreProductAttrValueRequest.class);
|
||||
if(null != storeProductAttrValueRequests){
|
||||
if (null != storeProductAttrValueRequests) {
|
||||
for (int i = 0; i < storeProductAttrValueRequests.size(); i++) {
|
||||
HashMap<String, Object> attrValue = new HashMap<>();
|
||||
String currentSku = storeProductAttrValues.get(i).getSuk();
|
||||
List<StoreProductAttrValue> hasCurrentSku =
|
||||
storeProductAttrValues.stream().filter(e -> e.getSuk().equals(currentSku)).collect(Collectors.toList());
|
||||
StoreProductAttrValue currentAttrValue = hasCurrentSku.get(0);
|
||||
attrValue.put("id", hasCurrentSku.size() > 0 ? hasCurrentSku.get(0).getId():0);
|
||||
attrValue.put("id", hasCurrentSku.size() > 0 ? hasCurrentSku.get(0).getId() : 0);
|
||||
attrValue.put("image", currentAttrValue.getImage());
|
||||
attrValue.put("cost", currentAttrValue.getCost());
|
||||
attrValue.put("price", currentAttrValue.getPrice());
|
||||
@@ -1246,7 +1252,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
attrValue.put("quota", currentAttrValue.getQuota());
|
||||
String[] skus = currentSku.split(",");
|
||||
for (int k = 0; k < skus.length; k++) {
|
||||
attrValue.put("value"+k,skus[k]);
|
||||
attrValue.put("value" + k, skus[k]);
|
||||
}
|
||||
attrValues.add(attrValue);
|
||||
}
|
||||
@@ -1258,17 +1264,16 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 过滤没被选中的数据,并校验参数
|
||||
* @param request
|
||||
*/
|
||||
private void clearNotCheckedAndValidationPrice(StoreCombinationRequest request) {
|
||||
if(request.getSpecType()){
|
||||
if (request.getSpecType()) {
|
||||
request.setAttrValue(request.getAttrValue().stream().filter(StoreProductAttrValueRequest::getChecked).collect(Collectors.toList()));
|
||||
}
|
||||
if (CollUtil.isEmpty(request.getAttrValue())) {
|
||||
throw new CrmebException("请选择 规格");
|
||||
}
|
||||
for (StoreProductAttrValueRequest attr : request.getAttrValue()) {
|
||||
if (ObjectUtil.isNull(attr.getPrice()) || attr.getPrice().compareTo(BigDecimal.ZERO) <= 0){
|
||||
if (ObjectUtil.isNull(attr.getPrice()) || attr.getPrice().compareTo(BigDecimal.ZERO) <= 0) {
|
||||
throw new CrmebException("请正确输入 拼团价格");
|
||||
}
|
||||
if (ObjectUtil.isNull(attr.getQuota()) || attr.getQuota() <= 0) {
|
||||
@@ -1283,34 +1288,32 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 设置制式结构给attr属性
|
||||
* @param attrList
|
||||
* @param detailResponse
|
||||
*/
|
||||
private void setSkuAttr(List<StoreProductAttr> attrList, CombinationDetailResponse detailResponse) {
|
||||
List<HashMap<String,Object>> attrMapList = new ArrayList<>();
|
||||
List<HashMap<String, Object>> attrMapList = new ArrayList<>();
|
||||
for (StoreProductAttr attr : attrList) {
|
||||
HashMap<String, Object> attrMap = new HashMap<>();
|
||||
attrMap.put("productId",attr.getProductId());
|
||||
attrMap.put("attrName",attr.getAttrName());
|
||||
attrMap.put("productId", attr.getProductId());
|
||||
attrMap.put("attrName", attr.getAttrName());
|
||||
// attrMap.put("type",attr.getType());
|
||||
List<String> attrValues = new ArrayList<>();
|
||||
String trimAttr = attr.getAttrValues()
|
||||
.replace("[","")
|
||||
.replace("]","");
|
||||
if(attr.getAttrValues().contains(",")){
|
||||
.replace("[", "")
|
||||
.replace("]", "");
|
||||
if (attr.getAttrValues().contains(",")) {
|
||||
attrValues = Arrays.asList(trimAttr.split(","));
|
||||
}else{
|
||||
} else {
|
||||
attrValues.add(trimAttr);
|
||||
}
|
||||
attrMap.put("attrValues",attrValues);
|
||||
attrMap.put("attrValues", attrValues);
|
||||
|
||||
List<HashMap<String,Object>> attrValueMapList = new ArrayList<>();
|
||||
List<HashMap<String, Object>> attrValueMapList = new ArrayList<>();
|
||||
for (String attrValue : attrValues) {
|
||||
HashMap<String,Object> attrValueMap = new HashMap<>();
|
||||
attrValueMap.put("attr",attrValue);
|
||||
HashMap<String, Object> attrValueMap = new HashMap<>();
|
||||
attrValueMap.put("attr", attrValue);
|
||||
attrValueMapList.add(attrValueMap);
|
||||
}
|
||||
attrMap.put("attrValue",attrValueMapList);
|
||||
attrMap.put("attrValue", attrValueMapList);
|
||||
attrMapList.add(attrMap);
|
||||
}
|
||||
detailResponse.setProductAttr(attrMapList);
|
||||
@@ -1318,36 +1321,34 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
/**
|
||||
* 获取制式结构给attr属性
|
||||
* @param attrList
|
||||
* @return
|
||||
*/
|
||||
private List<HashMap<String, Object>> getSkuAttrList(List<StoreProductAttr> attrList) {
|
||||
List<HashMap<String,Object>> attrMapList = new ArrayList<>();
|
||||
List<HashMap<String, Object>> attrMapList = new ArrayList<>();
|
||||
if (CollUtil.isEmpty(attrList)) {
|
||||
return attrMapList;
|
||||
}
|
||||
for (StoreProductAttr attr : attrList) {
|
||||
HashMap<String, Object> attrMap = new HashMap<>();
|
||||
attrMap.put("productId",attr.getProductId());
|
||||
attrMap.put("attrName",attr.getAttrName());
|
||||
attrMap.put("productId", attr.getProductId());
|
||||
attrMap.put("attrName", attr.getAttrName());
|
||||
List<String> attrValues = new ArrayList<>();
|
||||
String trimAttr = attr.getAttrValues()
|
||||
.replace("[","")
|
||||
.replace("]","");
|
||||
if(attr.getAttrValues().contains(",")){
|
||||
.replace("[", "")
|
||||
.replace("]", "");
|
||||
if (attr.getAttrValues().contains(",")) {
|
||||
attrValues = Arrays.asList(trimAttr.split(","));
|
||||
}else{
|
||||
} else {
|
||||
attrValues.add(trimAttr);
|
||||
}
|
||||
attrMap.put("attrValues",attrValues);
|
||||
attrMap.put("attrValues", attrValues);
|
||||
|
||||
List<HashMap<String,Object>> attrValueMapList = new ArrayList<>();
|
||||
List<HashMap<String, Object>> attrValueMapList = new ArrayList<>();
|
||||
for (String attrValue : attrValues) {
|
||||
HashMap<String,Object> attrValueMap = new HashMap<>();
|
||||
attrValueMap.put("attr",attrValue);
|
||||
HashMap<String, Object> attrValueMap = new HashMap<>();
|
||||
attrValueMap.put("attr", attrValue);
|
||||
attrValueMapList.add(attrValueMap);
|
||||
}
|
||||
attrMap.put("attrValue",attrValueMapList);
|
||||
attrMap.put("attrValue", attrValueMapList);
|
||||
attrMapList.add(attrMap);
|
||||
}
|
||||
return attrMapList;
|
||||
|
||||
@@ -22,7 +22,6 @@ import java.util.List;
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface ExcelService{
|
||||
// List<ProductExcelVo> product(StoreProductSearchRequest request, HttpServletResponse response);
|
||||
|
||||
String exportBargainProduct(StoreBargainSearchRequest request, HttpServletResponse response);
|
||||
|
||||
|
||||
@@ -59,8 +59,10 @@ public class ShippingTemplatesController {
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@RequestBody @Validated ShippingTemplatesRequest request){
|
||||
shippingTemplatesService.create(request);
|
||||
return CommonResult.success();
|
||||
if (shippingTemplatesService.create(request)) {
|
||||
return CommonResult.success();
|
||||
}
|
||||
return CommonResult.failed("新增运费模板失败");
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -48,7 +48,7 @@ public class ShippingTemplatesFree implements Serializable {
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "包邮件数")
|
||||
private Integer number;
|
||||
private BigDecimal number;
|
||||
|
||||
@ApiModelProperty(value = "包邮金额")
|
||||
private BigDecimal price;
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.zbkj.crmeb.express.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 快递公司表
|
||||
* </p>
|
||||
*
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-17
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("eb_express")
|
||||
@ApiModel(value="ExpressRequest对象", description="快递公司")
|
||||
public class ExpressRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "快递公司简称", required = true)
|
||||
@NotBlank(message = "快递公司简称必须填写")
|
||||
private String code;
|
||||
|
||||
@ApiModelProperty(value = "快递公司全称", required = true)
|
||||
@NotBlank(message = "快递公司全称必须填写")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
@NotNull(message = "排序数字必须填写")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否显示 0=否 1=是", required = true)
|
||||
@NotNull(message = "请选择是否弃用")
|
||||
private Integer isShow;
|
||||
|
||||
|
||||
}
|
||||
@@ -42,8 +42,9 @@ public class ShippingTemplatesFreeRequest implements Serializable {
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "包邮件数", required = true, example = "1")
|
||||
@Min(value = 1, message = "请填写包邮件数")
|
||||
private Integer number;
|
||||
// @Min(value = 1, message = "请填写包邮件数")
|
||||
@DecimalMin(value = "0.1", message = "包邮不能低于0.1")
|
||||
private BigDecimal number;
|
||||
|
||||
@ApiModelProperty(value = "包邮金额", required = true, example = "0.1")
|
||||
@NotNull(message = "请填写包邮金额")
|
||||
|
||||
@@ -70,10 +70,4 @@ public interface ExpressService extends IService<Express> {
|
||||
*/
|
||||
Express getByCode(String code);
|
||||
|
||||
/**
|
||||
* 打印电子面单
|
||||
* @param cargo 物品名称
|
||||
* @param count 商品数量
|
||||
*/
|
||||
Boolean dump(String cargo, Integer count);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.zbkj.crmeb.express.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplatesFree;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesFreeRequest;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,23 +23,17 @@ public interface ShippingTemplatesFreeService extends IService<ShippingTemplates
|
||||
|
||||
List<ShippingTemplatesFree> getList(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 根据模版id查询包邮信息
|
||||
* @param tempIds 模版id
|
||||
* @return 包邮信息集合
|
||||
*/
|
||||
List<ShippingTemplatesFree> getListByTempIds(List<Integer> tempIds);
|
||||
|
||||
/**
|
||||
* 根据条件查询
|
||||
* @param templatesFree 模版参数
|
||||
* @return 模版集合
|
||||
*/
|
||||
List<ShippingTemplatesFree> getListByConditionForCalcOrderPrice(ShippingTemplatesFree templatesFree);
|
||||
|
||||
void saveAll(List<ShippingTemplatesFreeRequest> shippingTemplatesFreeRequestList, Integer type, Integer id);
|
||||
|
||||
List<ShippingTemplatesFreeRequest> getListGroup(Integer tempId);
|
||||
|
||||
void delete(Integer id);
|
||||
|
||||
/**
|
||||
* 根据模板编号、城市ID查询
|
||||
* @param tempId 模板编号
|
||||
* @param cityId 城市ID
|
||||
* @return 运费模板
|
||||
*/
|
||||
ShippingTemplatesFree getByTempIdAndCityId(Integer tempId, Integer cityId);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.zbkj.crmeb.express.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplatesRegion;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesRegionRequest;
|
||||
|
||||
import java.util.List;
|
||||
@@ -23,17 +23,17 @@ public interface ShippingTemplatesRegionService extends IService<ShippingTemplat
|
||||
|
||||
List<ShippingTemplatesRegion> getList(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 根据ids和cityid查询
|
||||
* @param ids id集合
|
||||
* @param cityId 城市id
|
||||
* @return 运费模版集合
|
||||
*/
|
||||
List<ShippingTemplatesRegion> getListInIdsAndCityId(List<Integer> ids,Integer cityId);
|
||||
|
||||
void saveAll(List<ShippingTemplatesRegionRequest> shippingTemplatesRegionRequestList, Integer type, Integer id);
|
||||
|
||||
List<ShippingTemplatesRegionRequest> getListGroup(Integer tempId);
|
||||
|
||||
void delete(Integer tempId);
|
||||
|
||||
/**
|
||||
* 根据模板编号、城市ID查询
|
||||
* @param tempId 模板编号
|
||||
* @param cityId 城市ID
|
||||
* @return 运费模板
|
||||
*/
|
||||
ShippingTemplatesRegion getByTempIdAndCityId(Integer tempId, Integer cityId);
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.zbkj.crmeb.express.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplates;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesRequest;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesSearchRequest;
|
||||
|
||||
@@ -24,18 +24,15 @@ public interface ShippingTemplatesService extends IService<ShippingTemplates> {
|
||||
|
||||
List<ShippingTemplates> getList(ShippingTemplatesSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
void checkExpressTemp(Integer tempId);
|
||||
|
||||
boolean create(ShippingTemplatesRequest request);
|
||||
/**
|
||||
* 新增运费模板
|
||||
* @param request 请求参数
|
||||
* @return 新增结果
|
||||
*/
|
||||
Boolean create(ShippingTemplatesRequest request);
|
||||
|
||||
boolean update(Integer id, ShippingTemplatesRequest request);
|
||||
|
||||
boolean remove(Integer id);
|
||||
|
||||
/**
|
||||
* 根据模版id集合获取订单集合
|
||||
* @param ids 模版ids
|
||||
* @return 模版集合
|
||||
*/
|
||||
List<ShippingTemplates> getListInIds(List<Integer> ids);
|
||||
}
|
||||
|
||||
@@ -19,8 +19,6 @@ import com.zbkj.crmeb.express.request.ExpressSearchRequest;
|
||||
import com.zbkj.crmeb.express.request.ExpressUpdateRequest;
|
||||
import com.zbkj.crmeb.express.request.ExpressUpdateShowRequest;
|
||||
import com.zbkj.crmeb.express.service.ExpressService;
|
||||
import com.zbkj.crmeb.express.vo.ExpressSheetVo;
|
||||
import com.zbkj.crmeb.system.service.SystemConfigService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -58,9 +56,6 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
|
||||
@Autowired
|
||||
private OnePassUtil onePassUtil;
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
/**
|
||||
* 分页显示快递公司表
|
||||
* @param request 搜索条件
|
||||
@@ -185,23 +180,6 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
|
||||
return dao.selectOne(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 打印电子面单
|
||||
* @param cargo 物品名称
|
||||
* @param count 商品数量
|
||||
* TODO
|
||||
*/
|
||||
@Override
|
||||
public Boolean dump(String cargo, Integer count) {
|
||||
// 获取系统保存的电子面单信息
|
||||
ExpressSheetVo expressSheetVo = systemConfigService.getExpressSheet();
|
||||
Express express = getById(expressSheetVo.getExportId());
|
||||
if (ObjectUtil.isNull(express)) {
|
||||
throw new CrmebException("电子面单中对应的快递公司不存在");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 从平台获取物流公司
|
||||
* 并存入数据库
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.zbkj.crmeb.express.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.utils.CrmebUtil;
|
||||
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplatesFree;
|
||||
import com.zbkj.crmeb.express.dao.ShippingTemplatesFreeDao;
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplatesFree;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesFreeRequest;
|
||||
import com.zbkj.crmeb.express.service.ShippingTemplatesFreeService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zbkj.crmeb.system.service.SystemCityService;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -18,7 +17,6 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -58,33 +56,6 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
||||
return dao.selectList(null);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模版id查询包邮信息
|
||||
* @param tempIds 模版id
|
||||
* @return 包邮信息集合
|
||||
*/
|
||||
@Override
|
||||
public List<ShippingTemplatesFree> getListByTempIds(List<Integer> tempIds) {
|
||||
LambdaQueryWrapper<ShippingTemplatesFree> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.in(ShippingTemplatesFree::getTempId, tempIds);
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模版参数查询 H5 计算订单价格使用
|
||||
* @param templatesFree 模版参数
|
||||
* @return 模版集合
|
||||
*/
|
||||
@Override
|
||||
public List<ShippingTemplatesFree> getListByConditionForCalcOrderPrice(ShippingTemplatesFree templatesFree) {
|
||||
LambdaQueryWrapper<ShippingTemplatesFree> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(ShippingTemplatesFree::getTempId, templatesFree.getTempId());
|
||||
lqw.eq(ShippingTemplatesFree::getCityId, templatesFree.getCityId());
|
||||
lqw.le(ShippingTemplatesFree::getNumber, templatesFree.getNumber());
|
||||
lqw.ge(ShippingTemplatesFree::getPrice, templatesFree.getPrice());
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配送区域
|
||||
* @param shippingTemplatesFreeRequestList List<ShippingTemplatesFreeRequest> 运费集合
|
||||
@@ -102,7 +73,6 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
||||
//把目前模板下的所有数据标记为无效
|
||||
updateStatus(tempId);
|
||||
|
||||
|
||||
for (ShippingTemplatesFreeRequest shippingTemplatesFreeRequest : shippingTemplatesFreeRequestList) {
|
||||
String uniqueKey = DigestUtils.md5Hex(shippingTemplatesFreeRequest.toString());
|
||||
if(shippingTemplatesFreeRequest.getCityId().equals("all") || shippingTemplatesFreeRequest.getCityId().equals("0")){
|
||||
@@ -119,6 +89,7 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
||||
shippingTemplatesFree.setType(type);
|
||||
shippingTemplatesFree.setNumber(shippingTemplatesFreeRequest.getNumber());
|
||||
shippingTemplatesFree.setPrice(shippingTemplatesFreeRequest.getPrice());
|
||||
shippingTemplatesFree.setStatus(true);
|
||||
shippingTemplatesFreesList.add(shippingTemplatesFree);
|
||||
}
|
||||
}
|
||||
@@ -153,7 +124,7 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFree::getTempId, tempId);
|
||||
|
||||
ShippingTemplatesFree shippingTemplatesFree = new ShippingTemplatesFree();
|
||||
shippingTemplatesFree.setStatus(true);
|
||||
shippingTemplatesFree.setStatus(false);
|
||||
update(shippingTemplatesFree, lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -167,23 +138,25 @@ public class ShippingTemplatesFreeServiceImpl extends ServiceImpl<ShippingTempla
|
||||
public void delete(Integer tempId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesFree> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFree::getTempId, tempId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFree::getStatus, true);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFree::getStatus, false);
|
||||
dao.delete(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模板id和城市id查询数据
|
||||
* @param tempId Integer 运费模板id
|
||||
* @param cityId Integer 城市id
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-20
|
||||
* @return ShippingTemplatesFree
|
||||
* 根据模板编号、城市ID查询
|
||||
* @param tempId 模板编号
|
||||
* @param cityId 城市ID
|
||||
* @return 运费模板
|
||||
*/
|
||||
private ShippingTemplatesFree getVoByTempIdAndCityId(Integer tempId, Integer cityId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesFree> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFree::getCityId, cityId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesFree::getTempId, tempId);
|
||||
return dao.selectOne(lambdaQueryWrapper);
|
||||
@Override
|
||||
public ShippingTemplatesFree getByTempIdAndCityId(Integer tempId, Integer cityId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesFree> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(ShippingTemplatesFree::getTempId, tempId);
|
||||
lqw.eq(ShippingTemplatesFree::getCityId, cityId);
|
||||
lqw.eq(ShippingTemplatesFree::getStatus, true);
|
||||
lqw.orderByDesc(ShippingTemplatesFree::getId);
|
||||
lqw.last(" limit 1");
|
||||
return dao.selectOne(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.zbkj.crmeb.express.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.utils.CrmebUtil;
|
||||
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplatesRegion;
|
||||
import com.zbkj.crmeb.express.dao.ShippingTemplatesRegionDao;
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplatesRegion;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesRegionRequest;
|
||||
import com.zbkj.crmeb.express.service.ShippingTemplatesRegionService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zbkj.crmeb.system.service.SystemCityService;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -66,21 +65,6 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id集合和城市id获取
|
||||
* @param ids id集合
|
||||
* @param cityId 城市id
|
||||
* @return 运费模版集合
|
||||
*/
|
||||
@Override
|
||||
public List<ShippingTemplatesRegion> getListInIdsAndCityId(List<Integer> ids, Integer cityId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesRegion> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.in(ShippingTemplatesRegion::getTempId, ids);
|
||||
lqw.in(ShippingTemplatesRegion::getCityId, cityId);
|
||||
lqw.orderByAsc(ShippingTemplatesRegion::getCityId);
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存配送区域及运费
|
||||
* @param shippingTemplatesRegionRequestList List<ShippingTemplatesRegionRequest> 运费集合
|
||||
@@ -116,6 +100,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
||||
shippingTemplatesRegion.setFirstPrice(shippingTemplatesRegionRequest.getFirstPrice());
|
||||
shippingTemplatesRegion.setTempId(tempId);
|
||||
shippingTemplatesRegion.setType(type);
|
||||
shippingTemplatesRegion.setStatus(true);
|
||||
shippingTemplatesRegionList.add(shippingTemplatesRegion);
|
||||
}
|
||||
}
|
||||
@@ -150,7 +135,7 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getTempId, tempId);
|
||||
|
||||
ShippingTemplatesRegion shippingTemplatesRegion = new ShippingTemplatesRegion();
|
||||
shippingTemplatesRegion.setStatus(true);
|
||||
shippingTemplatesRegion.setStatus(false);
|
||||
update(shippingTemplatesRegion, lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -164,22 +149,24 @@ public class ShippingTemplatesRegionServiceImpl extends ServiceImpl<ShippingTemp
|
||||
public void delete(Integer tempId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesRegion> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getTempId, tempId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getStatus, true);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getStatus, false);
|
||||
dao.delete(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模板id和城市id查询数据
|
||||
* @param tempId Integer 运费模板id
|
||||
* @param cityId Integer 城市id
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-20
|
||||
* @return ShippingTemplatesFree
|
||||
* 根据模板编号、城市ID查询
|
||||
* @param tempId 模板编号
|
||||
* @param cityId 城市ID
|
||||
* @return 运费模板
|
||||
*/
|
||||
private ShippingTemplatesRegion getVoByTempIdAndCityId(Integer tempId, Integer cityId) {
|
||||
@Override
|
||||
public ShippingTemplatesRegion getByTempIdAndCityId(Integer tempId, Integer cityId) {
|
||||
LambdaQueryWrapper<ShippingTemplatesRegion> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getCityId, cityId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getTempId, tempId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getCityId, cityId);
|
||||
lambdaQueryWrapper.eq(ShippingTemplatesRegion::getStatus, true);
|
||||
lambdaQueryWrapper.orderByDesc(ShippingTemplatesRegion::getId);
|
||||
lambdaQueryWrapper.last(" limit 1");
|
||||
return dao.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.zbkj.crmeb.express.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplates;
|
||||
import com.zbkj.crmeb.express.dao.ShippingTemplatesDao;
|
||||
import com.zbkj.crmeb.express.model.ShippingTemplates;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesFreeRequest;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesRegionRequest;
|
||||
import com.zbkj.crmeb.express.request.ShippingTemplatesRequest;
|
||||
@@ -15,7 +16,6 @@ import com.zbkj.crmeb.express.request.ShippingTemplatesSearchRequest;
|
||||
import com.zbkj.crmeb.express.service.ShippingTemplatesFreeService;
|
||||
import com.zbkj.crmeb.express.service.ShippingTemplatesRegionService;
|
||||
import com.zbkj.crmeb.express.service.ShippingTemplatesService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -66,19 +66,6 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesD
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测运费模板是否存在
|
||||
* @param tempId Integer 模板id
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-07
|
||||
*/
|
||||
@Override
|
||||
public void checkExpressTemp(Integer tempId) {
|
||||
if(getById(tempId) == null){
|
||||
throw new CrmebException("没有相关运费模板");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param request 新增参数
|
||||
@@ -87,7 +74,16 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesD
|
||||
* @return bool
|
||||
*/
|
||||
@Override
|
||||
public boolean create(ShippingTemplatesRequest request) {
|
||||
public Boolean create(ShippingTemplatesRequest request) {
|
||||
// 判断模板名称是否重复
|
||||
if (isExistName(request.getName())) {
|
||||
throw new CrmebException("模板名称已存在,请更换模板名称!");
|
||||
}
|
||||
List<ShippingTemplatesRegionRequest> shippingTemplatesRegionRequestList = request.getShippingTemplatesRegionRequestList();
|
||||
if (CollUtil.isEmpty(shippingTemplatesRegionRequestList)) {
|
||||
throw new CrmebException("区域运费最少需要一条默认的全国区域");
|
||||
}
|
||||
|
||||
ShippingTemplates shippingTemplates = new ShippingTemplates();
|
||||
shippingTemplates.setName(request.getName());
|
||||
shippingTemplates.setSort(request.getSort());
|
||||
@@ -97,11 +93,7 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesD
|
||||
save(shippingTemplates);
|
||||
|
||||
//区域运费
|
||||
List<ShippingTemplatesRegionRequest> shippingTemplatesRegionRequestList = request.getShippingTemplatesRegionRequestList();
|
||||
|
||||
if(shippingTemplatesRegionRequestList.size() > 0){
|
||||
shippingTemplatesRegionService.saveAll(shippingTemplatesRegionRequestList, request.getType(), shippingTemplates.getId());
|
||||
}
|
||||
shippingTemplatesRegionService.saveAll(shippingTemplatesRegionRequestList, request.getType(), shippingTemplates.getId());
|
||||
|
||||
|
||||
List<ShippingTemplatesFreeRequest> shippingTemplatesFreeRequestList = request.getShippingTemplatesFreeRequestList();
|
||||
@@ -112,6 +104,28 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesD
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据模板名称获取模板
|
||||
* @param name 模板名称
|
||||
* @return ShippingTemplates
|
||||
*/
|
||||
private ShippingTemplates getByName(String name) {
|
||||
LambdaQueryWrapper<ShippingTemplates> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.in(ShippingTemplates::getName, name);
|
||||
return dao.selectOne(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否存在模板名称
|
||||
*/
|
||||
private Boolean isExistName(String name) {
|
||||
ShippingTemplates templates = getByName(name);
|
||||
if (ObjectUtil.isNull(templates)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增
|
||||
* @param id Integer 模板id
|
||||
@@ -162,16 +176,5 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesD
|
||||
return removeById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id集合获取
|
||||
* @param ids 模版ids
|
||||
* @return 模版集合
|
||||
*/
|
||||
@Override
|
||||
public List<ShippingTemplates> getListInIds(List<Integer> ids) {
|
||||
LambdaQueryWrapper<ShippingTemplates> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.in(ShippingTemplates::getId, ids);
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,16 +50,8 @@ public interface UserExtractService extends IService<UserExtract> {
|
||||
*/
|
||||
BigDecimal getWithdrawning(String startTime, String endTime);
|
||||
|
||||
/**
|
||||
* 获取待提现总金额
|
||||
* @return 待提现总金额
|
||||
*/
|
||||
BigDecimal getWaiteForDrawn(String startTime,String endTime);
|
||||
|
||||
Boolean create(UserExtractRequest request, Integer userId);
|
||||
|
||||
// BigDecimal getToBeWihDraw(Integer userId);
|
||||
|
||||
BigDecimal getFreeze(Integer userId);
|
||||
|
||||
UserExtractResponse getUserExtractByUserId(Integer userId);
|
||||
|
||||
@@ -36,8 +36,6 @@ public interface UserRechargeService extends IService<UserRecharge> {
|
||||
|
||||
Boolean complete(UserRecharge userRecharge);
|
||||
|
||||
BigDecimal getSumBigDecimal(Integer uid);
|
||||
|
||||
/**
|
||||
* 充值退款
|
||||
* @param request 退款参数
|
||||
|
||||
@@ -204,17 +204,7 @@ public class UserExtractServiceImpl extends ServiceImpl<UserExtractDao, UserExtr
|
||||
return getSum(null, 0, startTime, endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取待提现总金额
|
||||
*
|
||||
* @return 待提现总金额
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getWaiteForDrawn(String startTime,String endTime) {
|
||||
return getSum(null,-1,startTime,endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
/**
|
||||
* 提现申请
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-08
|
||||
@@ -258,38 +248,12 @@ public class UserExtractServiceImpl extends ServiceImpl<UserExtractDao, UserExtr
|
||||
"暂无",request.getExtractType(),"暂无",request.getRealName()
|
||||
);
|
||||
wechatSendMessageForMinService.sendCashMessage(cash,userId);
|
||||
// return save(userExtract);
|
||||
save(userExtract);
|
||||
// 扣除用户总金额
|
||||
return userService.upadteBrokeragePrice(user, toBeWithdrawn.subtract(request.getExtractPrice()));
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 可提现总金额
|
||||
// * @author Mr.Zhang
|
||||
// * @since 2020-06-08
|
||||
// * @return Boolean
|
||||
// */
|
||||
// @Override
|
||||
// public BigDecimal getToBeWihDraw(Integer userId) {
|
||||
// //可提现佣金
|
||||
// //返佣 +
|
||||
// BigDecimal withDrawable = userBillService.getSumBigDecimal(1, userId, Constants.USER_BILL_CATEGORY_MONEY, Constants.SEARCH_DATE_LATELY_30, Constants.USER_BILL_TYPE_BROKERAGE);
|
||||
//
|
||||
// //退款退的佣金 -
|
||||
// BigDecimal refund = userBillService.getSumBigDecimal(0, userId, Constants.USER_BILL_CATEGORY_MONEY, Constants.SEARCH_DATE_LATELY_30, Constants.USER_BILL_TYPE_BROKERAGE);
|
||||
//
|
||||
// BigDecimal subtract = withDrawable.subtract(refund);
|
||||
// subtract = (subtract.compareTo(ZERO) < 1) ? ZERO : subtract;
|
||||
//
|
||||
// //用户累计佣金
|
||||
// BigDecimal brokeragePrice = userService.getById(userId).getBrokeragePrice();
|
||||
//
|
||||
// //可提现佣金
|
||||
// return brokeragePrice.subtract(subtract);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 冻结的佣金
|
||||
* @author Mr.Zhang
|
||||
@@ -298,25 +262,6 @@ public class UserExtractServiceImpl extends ServiceImpl<UserExtractDao, UserExtr
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getFreeze(Integer userId) {
|
||||
// //冻结时间
|
||||
// //查看是否在冻结期之内, 如果在是需要回滚的,如果不在则不需要回滚
|
||||
// String time = systemConfigService.getValueByKey(Constants.CONFIG_KEY_STORE_BROKERAGE_EXTRACT_TIME);
|
||||
//
|
||||
// String date = null;
|
||||
// if(StringUtils.isNotBlank(time)){
|
||||
// String startTime = DateUtil.nowDateTime(Constants.DATE_FORMAT);
|
||||
// String endTime = DateUtil.addDay(DateUtil.nowDateTime(), Integer.parseInt(time), Constants.DATE_FORMAT);
|
||||
// date = startTime + "," + endTime;
|
||||
// }
|
||||
//
|
||||
// //在此期间获得的佣金
|
||||
// BigDecimal getSum = userBillService.getSumBigDecimal(1, userId, Constants.USER_BILL_CATEGORY_BROKERAGE_PRICE, null, date);
|
||||
//
|
||||
// //在此期间消耗的佣金
|
||||
// BigDecimal subSum = userBillService.getSumBigDecimal(0, userId, Constants.USER_BILL_CATEGORY_BROKERAGE_PRICE, null, date);
|
||||
//
|
||||
// //冻结的佣金
|
||||
// return getSum.subtract(subSum);
|
||||
String time = systemConfigService.getValueByKey(Constants.CONFIG_KEY_STORE_BROKERAGE_EXTRACT_TIME);
|
||||
if (StrUtil.isBlank(time)) {
|
||||
return BigDecimal.ZERO;
|
||||
@@ -465,7 +410,6 @@ public class UserExtractServiceImpl extends ServiceImpl<UserExtractDao, UserExtr
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<UserExtractRecordResponse> getExtractRecord(Integer userId, PageParamRequest pageParamRequest){
|
||||
// PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
Page<UserExtract> userExtractPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
QueryWrapper<UserExtract> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("uid", userId);
|
||||
|
||||
@@ -62,19 +62,6 @@ public class UserFundsMonitorServiceImpl extends ServiceImpl<UserFundsMonitorDao
|
||||
}
|
||||
map.put("sort", sort);
|
||||
List<UserFundsMonitor> monitorList = dao.getFundsMonitor(map);
|
||||
// if (CollUtil.isEmpty(monitorList)) {
|
||||
// return monitorList;
|
||||
// }
|
||||
// List<Integer> spreadUidList = monitorList.stream().map(UserFundsMonitor::getSpreadUid).distinct().collect(Collectors.toList());
|
||||
// HashMap<Integer, User> mapListInUid = userService.getMapListInUid(spreadUidList);
|
||||
// for (UserFundsMonitor temp: monitorList) {
|
||||
// if (ObjectUtil.isNotNull(temp.getSpreadUid())) {
|
||||
// User user = mapListInUid.get(temp.getSpreadUid());
|
||||
// if (ObjectUtil.isNotNull(user)) {
|
||||
// temp.setSpreadName(Optional.ofNullable(user.getNickname()).orElse(""));
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
return monitorList;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.CommonPage;
|
||||
import com.common.PageParamRequest;
|
||||
@@ -154,7 +153,8 @@ public class UserRechargeServiceImpl extends ServiceImpl<UserRechargeDao, UserRe
|
||||
if(null == routine) routine = BigDecimal.ZERO;
|
||||
map.put("routine", routine); //小程序充值
|
||||
|
||||
BigDecimal weChat = dao.getSumByType("weixin");
|
||||
// BigDecimal weChat = dao.getSumByType("weixin");
|
||||
BigDecimal weChat = dao.getSumByType("public");
|
||||
if(null == weChat) weChat = BigDecimal.ZERO;
|
||||
map.put("weChat", weChat); //公众号充值
|
||||
|
||||
@@ -219,28 +219,6 @@ public class UserRechargeServiceImpl extends ServiceImpl<UserRechargeDao, UserRe
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值总金额
|
||||
* @param userId Integer 用户uid
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-29
|
||||
* @return UserBill
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getSumBigDecimal(Integer userId) {
|
||||
QueryWrapper<UserRecharge> queryWrapper = new QueryWrapper<>();
|
||||
|
||||
|
||||
queryWrapper.select("sum(price) as price").
|
||||
eq("uid", userId).
|
||||
eq("paid", 1);
|
||||
UserRecharge userRecharge = dao.selectOne(queryWrapper);
|
||||
if(null == userRecharge || null == userRecharge.getPrice()){
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
return userRecharge.getPrice();
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值退款
|
||||
* @param request 退款参数
|
||||
|
||||
@@ -38,18 +38,8 @@ public class CombinationController {
|
||||
@Autowired
|
||||
private StoreCombinationService storeCombinationService;
|
||||
|
||||
/**
|
||||
* 拼团Pink
|
||||
*/
|
||||
@ApiOperation(value = "拼团Pink")
|
||||
@RequestMapping(value = "/pink", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String,Object>> pink(){
|
||||
return CommonResult.success(storeCombinationService.getForH5Pink());
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品列表
|
||||
* @return 砍价商品列表
|
||||
*/
|
||||
@ApiOperation(value = "拼团商品列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@@ -60,7 +50,6 @@ public class CombinationController {
|
||||
|
||||
/**
|
||||
* 拼团商品详情
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "拼团商品详情")
|
||||
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
|
||||
@@ -72,7 +61,6 @@ public class CombinationController {
|
||||
/**
|
||||
* 去拼团
|
||||
* @param pinkId 拼团团长单id
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "去拼团")
|
||||
@RequestMapping(value = "/pink/{pinkId}", method = RequestMethod.GET)
|
||||
@@ -83,7 +71,6 @@ public class CombinationController {
|
||||
|
||||
/**
|
||||
* 更多拼团
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "更多拼团")
|
||||
@RequestMapping(value = "/more", method = RequestMethod.GET)
|
||||
@@ -94,7 +81,6 @@ public class CombinationController {
|
||||
|
||||
/**
|
||||
* 取消拼团
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "取消拼团")
|
||||
@RequestMapping(value = "/remove", method = RequestMethod.POST)
|
||||
@@ -106,16 +92,4 @@ public class CombinationController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团海报
|
||||
*/
|
||||
// @ApiOperation(value = "拼团海报")
|
||||
// @RequestMapping(value = "/poster", method = RequestMethod.POST)
|
||||
// public CommonResult<Object> poster(@Validated @RequestParam Integer pinkId, @Validated @RequestParam String from) {
|
||||
// if (storeCombinationService.poster(pinkId, from)) {
|
||||
// return CommonResult.success("取消成功");
|
||||
// } else {
|
||||
// return CommonResult.failed("取消失败");
|
||||
// }
|
||||
// }
|
||||
}
|
||||
|
||||
@@ -335,6 +335,18 @@ public class UserController {
|
||||
public CommonResult<List<UserSpreadBannerResponse>> getSpreadBannerList(@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(userCenterService.getSpreadBannerList(pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定推广人
|
||||
* @param spreadPid 推广id
|
||||
* @return 绑定结果
|
||||
*/
|
||||
@ApiOperation(value = "绑定推广人")
|
||||
@RequestMapping(value = "/user/bindSpread", method = RequestMethod.GET)
|
||||
public CommonResult<Boolean> bindsSpread(Integer spreadPid){
|
||||
userService.bindSpread(userService.getInfo(),spreadPid);
|
||||
return CommonResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.common.CommonResult;
|
||||
import com.zbkj.crmeb.front.response.LoginResponse;
|
||||
import com.zbkj.crmeb.front.service.UserCenterService;
|
||||
@@ -59,7 +61,10 @@ public class WeChatController {
|
||||
@ApiOperation(value = "获取授权页面跳转地址")
|
||||
@RequestMapping(value = "/authorize/get", method = RequestMethod.GET)
|
||||
public CommonResult<Object> get(){
|
||||
return CommonResult.success(weChatService.getAuthorizeUrl());
|
||||
log.info("获取微信授权页面跳转地址");
|
||||
String authorizeUrl = weChatService.getAuthorizeUrl();
|
||||
log.info("授权地址:"+authorizeUrl);
|
||||
return CommonResult.success(authorizeUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -71,6 +76,7 @@ public class WeChatController {
|
||||
@RequestMapping(value = "/authorize/login", method = RequestMethod.GET)
|
||||
public CommonResult<LoginResponse> login(@RequestParam(value = "spread_spid", defaultValue = "0", required = false) Integer spreadUid,
|
||||
@RequestParam(value = "code") String code){
|
||||
log.info(StrUtil.format("微信登录公共号授权登录:spreadUid={},code={}",spreadUid,code));
|
||||
return CommonResult.success(userCenterService.weChatAuthorizeLogin(code, spreadUid));
|
||||
}
|
||||
|
||||
@@ -83,6 +89,7 @@ public class WeChatController {
|
||||
@ApiOperation(value = "微信登录小程序授权登录")
|
||||
@RequestMapping(value = "/authorize/program/login", method = RequestMethod.POST)
|
||||
public CommonResult<LoginResponse> programLogin(@RequestParam String code, @RequestBody @Validated RegisterThirdUserRequest request){
|
||||
log.info(StrUtil.format("微信小程序授权登录:code={},request={}",code, JSON.toJSONString(request)));
|
||||
return CommonResult.success(userCenterService.weChatAuthorizeProgramLogin(code, request));
|
||||
}
|
||||
|
||||
@@ -92,10 +99,11 @@ public class WeChatController {
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-25
|
||||
*/
|
||||
@ApiOperation(value = "获取微信公众号js配置")
|
||||
@ApiOperation(value = "获取微信js配置")
|
||||
@RequestMapping(value = "/config", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "url", value = "页面地址url")
|
||||
public CommonResult<Object> configJs(@RequestParam(value = "url") String url){
|
||||
log.info("获取微信js配置:url:"+url);
|
||||
return CommonResult.success(weChatService.getJsSdkConfig(url));
|
||||
}
|
||||
|
||||
|
||||
@@ -31,27 +31,6 @@ public class IndexInfoItemResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "快速选择简介")
|
||||
private String fastInfo;
|
||||
|
||||
@ApiModelProperty(value = "精品推荐简介")
|
||||
private String bastInfo;
|
||||
|
||||
@ApiModelProperty(value = "首发新品简介")
|
||||
private String firstInfo;
|
||||
|
||||
@ApiModelProperty(value = "促销单品简介")
|
||||
private String salesInfo;
|
||||
|
||||
@ApiModelProperty(value = "快速选择分类个数")
|
||||
private String fastNumber;
|
||||
|
||||
@ApiModelProperty(value = "精品推荐个数")
|
||||
private String bastNumber;
|
||||
|
||||
@ApiModelProperty(value = "首发新品个数")
|
||||
private String firstNumber;
|
||||
|
||||
@ApiModelProperty(value = "首页促销单品")
|
||||
private String promotionNumber;
|
||||
|
||||
|
||||
@@ -44,6 +44,7 @@ public class IndexInfoResponse implements Serializable {
|
||||
@ApiModelProperty(value = "活动")
|
||||
private IndexInfoItemResponse info;
|
||||
|
||||
// 待优化
|
||||
@ApiModelProperty(value = "活动区域图片")
|
||||
private List<HashMap<String, Object>> activity;
|
||||
|
||||
|
||||
@@ -113,13 +113,8 @@ public class IndexServiceImpl implements IndexService {
|
||||
indexInfoResponse.setBanner(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_BANNER)); //首页banner滚动图
|
||||
indexInfoResponse.setMenus(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_MENU)); //导航模块
|
||||
indexInfoResponse.setRoll(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_NEWS_BANNER)); //首页滚动新闻
|
||||
indexInfoResponse.setActivity(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_ACTIVITY_BANNER)); //首页活动区域图片
|
||||
indexInfoResponse.setInfo(null); //活动
|
||||
indexInfoResponse.setActivity(systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_INDEX_ACTIVITY_BANNER)); //首页活动区域图片
|
||||
|
||||
//首页配置
|
||||
HashMap<String, String> info = systemConfigService.info(Constants.CONFIG_FORM_ID_INDEX);
|
||||
IndexInfoItemResponse indexInfoItemResponse = CrmebUtil.mapStringToObj(info, IndexInfoItemResponse.class);
|
||||
IndexInfoItemResponse indexInfoItemResponse = new IndexInfoItemResponse();
|
||||
|
||||
|
||||
int limit = Constants.INDEX_LIMIT_DEFAULT;
|
||||
@@ -129,16 +124,11 @@ public class IndexServiceImpl implements IndexService {
|
||||
PageParamRequest pageParamRequest = new PageParamRequest();
|
||||
pageParamRequest.setLimit(limit);
|
||||
|
||||
if(!StringUtils.isBlank(indexInfoItemResponse.getBastNumber())){
|
||||
pageParamRequest.setLimit(Integer.parseInt(indexInfoItemResponse.getBastNumber()));
|
||||
}
|
||||
indexInfoItemResponse.setBastList(productService.getIndexProduct(request, pageParamRequest).getList()); //精品推荐个数
|
||||
|
||||
request.setIsBest(false);
|
||||
request.setIsNew(true);
|
||||
if(!StringUtils.isBlank(indexInfoItemResponse.getFirstNumber())){
|
||||
pageParamRequest.setLimit(Integer.parseInt(indexInfoItemResponse.getFirstNumber()));
|
||||
}
|
||||
|
||||
indexInfoItemResponse.setFirstList(productService.getIndexProduct(request, pageParamRequest).getList()); //首发新品个数
|
||||
|
||||
//首页展示的二级分类 排序默认降序
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.zbkj.crmeb.front.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.constants.Constants;
|
||||
import com.constants.SmsConstants;
|
||||
import com.exception.CrmebException;
|
||||
@@ -12,8 +14,10 @@ import com.zbkj.crmeb.front.request.LoginMobileRequest;
|
||||
import com.zbkj.crmeb.front.request.LoginRequest;
|
||||
import com.zbkj.crmeb.front.response.LoginResponse;
|
||||
import com.zbkj.crmeb.front.service.LoginService;
|
||||
import com.zbkj.crmeb.front.utils.userUtil;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -34,6 +38,7 @@ import java.util.Optional;
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class LoginServiceImpl implements LoginService {
|
||||
|
||||
@@ -48,12 +53,16 @@ public class LoginServiceImpl implements LoginService {
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private userUtil userUtil;
|
||||
|
||||
/**
|
||||
* 账号密码登录
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public LoginResponse login(LoginRequest loginRequest) throws Exception {
|
||||
log.info("移动端登录loginRequest:" + JSON.toJSONString(loginRequest));
|
||||
User user = userService.getUserByAccount(loginRequest.getPhone());
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
throw new CrmebException("此账号未注册");
|
||||
@@ -74,8 +83,9 @@ public class LoginServiceImpl implements LoginService {
|
||||
user.setPwd(null);
|
||||
|
||||
//绑定推广关系
|
||||
if (user.getSpreadUid() < 1 && loginRequest.getSpreadPid() > 0) {
|
||||
bindSpread(user, loginRequest.getSpreadPid());
|
||||
if (loginRequest.getSpreadPid() > 0) {
|
||||
userUtil.bindSpread(user, loginRequest.getSpreadPid());
|
||||
log.info(StrUtil.format("绑定推广关系成功:user={},loginRequest={}",JSON.toJSONString(user),JSON.toJSONString(loginRequest)));
|
||||
}
|
||||
|
||||
// 记录最后一次登录时间
|
||||
@@ -97,7 +107,7 @@ public class LoginServiceImpl implements LoginService {
|
||||
@Override
|
||||
public LoginResponse phoneLogin(LoginMobileRequest loginRequest, String clientIp) throws Exception {
|
||||
//检测验证码
|
||||
checkValidateCode(loginRequest.getPhone(), loginRequest.getValidateCode());
|
||||
userUtil.checkValidateCode(loginRequest.getPhone(), loginRequest.getValidateCode());
|
||||
|
||||
//查询手机号信息
|
||||
User user = userService.getUserByAccount(loginRequest.getPhone());
|
||||
@@ -108,8 +118,8 @@ public class LoginServiceImpl implements LoginService {
|
||||
} else {
|
||||
// 正常流程
|
||||
// 绑定推广关系
|
||||
if (user.getSpreadUid() < 1 && spread > 0) {
|
||||
bindSpread(user, spread);
|
||||
if (spread > 0) {
|
||||
userUtil.bindSpread(user, spread);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -164,12 +174,17 @@ public class LoginServiceImpl implements LoginService {
|
||||
Boolean checkBingSpread = userService.checkBingSpread(user, spreadUid, "old");
|
||||
if (!checkBingSpread) return false;
|
||||
|
||||
Integer oldSprUid = user.getSpreadUid();
|
||||
|
||||
user.setSpreadUid(spreadUid);
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(spreadUid);
|
||||
userService.updateSpreadCountByUid(spreadUid, "add");
|
||||
if (oldSprUid > 0) {
|
||||
userService.updateSpreadCountByUid(oldSprUid, "sub");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
|
||||
@@ -4,7 +4,6 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.common.MyRecord;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
@@ -53,8 +52,6 @@ import com.zbkj.crmeb.user.model.UserAddress;
|
||||
import com.zbkj.crmeb.user.service.UserAddressService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import com.zbkj.crmeb.wechat.service.impl.WechatSendMessageForMinService;
|
||||
import com.zbkj.crmeb.wechat.vo.WechatSendMessageForCreateOrder;
|
||||
import com.zbkj.crmeb.wechat.vo.WechatSendMessageForReFundNotify;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -222,7 +219,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
// other
|
||||
HashMap<String, Object> otherMap = new HashMap<>();
|
||||
otherMap.put("offlinePostage",systemConfigService.getValueByKey("offline_postage"));
|
||||
// otherMap.put("offlinePostage",systemConfigService.getValueByKey("offline_postage"));
|
||||
otherMap.put("integralRatio",systemConfigService.getValueByKey("integral_ratio"));
|
||||
|
||||
// 获取有效优惠券
|
||||
@@ -240,7 +237,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
response.setAddressInfo(defaultAddress);
|
||||
response.setCartInfo(storeCartResponse);
|
||||
response.setPriceGroup(orderPriceGroup);
|
||||
response.setOfflinePostage(otherMap.get("offlinePostage").toString());
|
||||
// response.setOfflinePostage(otherMap.get("offlinePostage").toString());
|
||||
response.setIntegralRatio(otherMap.get("integralRatio").toString());
|
||||
response.setUserInfo(currentUserInfo);
|
||||
response.setOfflinePayStatus(systemConfigService.getValueByKey("offline_pay_status"));
|
||||
@@ -303,7 +300,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
List<StoreCartResponse> cartInfo = cor.getCartInfo();
|
||||
List<StoreCartResponse> cartList = cartInfo.stream().filter(i -> ObjectUtil.isNotNull(i.getId())).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(cartList)) {
|
||||
List<Integer> cartIdList = cartList.stream().map(temp -> temp.getId().intValue()).collect(Collectors.toList());
|
||||
// List<Integer> cartIdList = cartList.stream().map(temp -> temp.getId().intValue()).collect(Collectors.toList());
|
||||
List<Long> cartIdList = cartList.stream().map(temp -> temp.getId()).collect(Collectors.toList());
|
||||
storeCartService.deleteCartByIds(cartIdList);
|
||||
}
|
||||
// 加入自动未支付自动取消队列
|
||||
@@ -468,15 +466,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
throw new CrmebException("订单退款中");
|
||||
}
|
||||
|
||||
// if(existStoreOrder.getStatus() == 1){
|
||||
// throw new CrmebException("订单当前状态无法申请退款");
|
||||
// }
|
||||
|
||||
// if (StrUtil.isBlank(existStoreOrder.getRefundReason())) {
|
||||
// throw new CrmebException("订单退款已被拒绝");
|
||||
// }
|
||||
|
||||
|
||||
existStoreOrder.setRefundStatus(1);
|
||||
existStoreOrder.setRefundReasonTime(DateUtil.nowDateTime());
|
||||
existStoreOrder.setRefundReasonWap(request.getText());
|
||||
@@ -505,24 +494,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
}
|
||||
if(!execute) throw new CrmebException("申请退款失败");
|
||||
|
||||
// HashMap<String, Object> smsInfo = new HashMap<>();
|
||||
// smsInfo.put("orderId", existStoreOrder.getOrderId());
|
||||
// smsInfo.put("adminName", currentUser.getNickname());
|
||||
// if (execute) {
|
||||
// // 发送微信小程序订阅消息
|
||||
// String storeNameAndCarNumString = orderUtils.getStoreNameAndCarNumString(storeOrder.getId());
|
||||
// if(StringUtils.isNotBlank(storeNameAndCarNumString)){
|
||||
// WechatSendMessageForReFundNotify notify = new WechatSendMessageForReFundNotify(
|
||||
// storeNameAndCarNumString,storeOrder.getPayPrice().toString(),
|
||||
// storeOrder.getCreateTime().toString(),storeOrder.getOrderId()+"",DateUtil.nowDateTimeStr(),
|
||||
// "CRMEB","发起申请",request.getExplain(),storeOrder.getPayPrice()+"",
|
||||
// request.getText(),storeOrder.getUserPhone(),"CRMEB");
|
||||
// wechatSendMessageForMinService.sendReFundNotifyMessage(notify, userService.getUserId());
|
||||
// }
|
||||
// boolean codeResult = smsService.pushCodeToList(currentUser.getPhone(),1, smsInfo);
|
||||
// if(!codeResult) throw new CrmebException("短信加入发送队列失败");
|
||||
// }
|
||||
return execute;
|
||||
}
|
||||
|
||||
@@ -542,31 +513,24 @@ public class OrderServiceImpl implements OrderService {
|
||||
StoreOrder storeOrder = storeOrderService.getById(request.getId());
|
||||
if(ObjectUtil.isNull(storeOrder)){
|
||||
//订单号错误
|
||||
// throw new CrmebException("没有找到相关订单信息!");
|
||||
logger.error("拼团自动处理订单申请退款:没有找到相关订单信息!");
|
||||
continue;
|
||||
}
|
||||
if(storeOrder.getRefundStatus() == 1){
|
||||
// throw new CrmebException("正在申请退款中");
|
||||
logger.error("拼团自动处理订单申请退款:正在申请退款中!");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(storeOrder.getRefundStatus() == 2){
|
||||
// throw new CrmebException("订单已退款");
|
||||
logger.error("拼团自动处理订单申请退款:订单已退款!");
|
||||
continue;
|
||||
}
|
||||
|
||||
if(storeOrder.getRefundStatus() == 3){
|
||||
// throw new CrmebException("订单退款中");
|
||||
logger.error("拼团自动处理订单申请退款:订单退款中!");
|
||||
continue;
|
||||
}
|
||||
|
||||
// if(storeOrder.getStatus() == 1){
|
||||
// throw new CrmebException("订单状态当前无法退款");
|
||||
// }
|
||||
storeOrder.setRefundReasonWapImg(systemAttachmentService.clearPrefix(request.getReasonImage()));
|
||||
storeOrder.setRefundStatus(1);
|
||||
storeOrder.setRefundReasonWapExplain(request.getExplain());
|
||||
@@ -621,7 +585,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
|
||||
OrderAgainVo orderAgainVo = orderUtils.tidyOrder(storeOrderExist, true, false);
|
||||
// List<StoreCart> storeCartResultList = new ArrayList<>();
|
||||
for (StoreOrderInfoVo oldCartInfo : orderAgainVo.getCartInfo()) { // todo 确实是否仅仅一条数据
|
||||
// todo 营销产品类型二期
|
||||
List<String> orderAgainCacheKeys = storeOrderService.addCartAgain(userService.getUserIdException(), oldCartInfo.getProductId(), oldCartInfo.getInfo().getCartNum(),
|
||||
@@ -631,7 +594,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
|
||||
}
|
||||
if(resultMap.size() == 0) throw new CrmebException("再来一单失败,请重新下单");
|
||||
// resultMap.put("cateId",storeCartResultList.stream().map(StoreCart::getId).distinct().collect(Collectors.toList()));
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@@ -899,7 +861,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
resultMap.put("order", orderInfo);
|
||||
resultMap.put("express", expressInfo);
|
||||
return resultMap;
|
||||
// expressService.getExpressInfo();
|
||||
|
||||
}
|
||||
|
||||
@@ -910,10 +871,6 @@ public class OrderServiceImpl implements OrderService {
|
||||
@Override
|
||||
public Object getReplyProduct(GetProductReply productReply) {
|
||||
HashMap<String,Object> resultMap = new HashMap<>();
|
||||
// StoreOrder storeOrderPram = new StoreOrder();
|
||||
// storeOrderPram.setUnique(unique);
|
||||
// StoreOrder existOrder = storeOrderService.getByEntityOne(storeOrderPram);
|
||||
// if(null== existOrder) throw new CrmebException("未找到该订单信息");
|
||||
StoreOrderInfoSearchRequest soinfoRequest = new StoreOrderInfoSearchRequest();
|
||||
soinfoRequest.setUnique(productReply.getUni());
|
||||
soinfoRequest.setOrderId(productReply.getOrderId());
|
||||
|
||||
@@ -372,7 +372,6 @@ public class ProductServiceImpl implements ProductService {
|
||||
for (String attrValue : attrValues) {
|
||||
HashMap<String,Object> attrValueMap = new HashMap<>();
|
||||
attrValueMap.put("attr",attrValue);
|
||||
// attrValueMap.put("check",storeCouponService.getListByProductCanUse(id).size()>0);
|
||||
attrValueMapList.add(attrValueMap);
|
||||
}
|
||||
attrMap.put("attrValue",attrValueMapList);
|
||||
|
||||
@@ -56,7 +56,8 @@ public class QrCodeServiceImpl implements QrCodeService {
|
||||
page = m.getValue().toString();
|
||||
continue;
|
||||
}
|
||||
scene.append(m.getKey()).append("=").append(m.getValue()).append("&");
|
||||
// scene.append(m.getKey()).append("=").append(m.getValue()).append("&");
|
||||
scene.append(m.getValue()).append("&");
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zbkj.crmeb.front.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
@@ -53,7 +54,6 @@ import com.zbkj.crmeb.wechat.response.WeChatAuthorizeLoginGetOpenIdResponse;
|
||||
import com.zbkj.crmeb.wechat.response.WeChatAuthorizeLoginUserInfoResponse;
|
||||
import com.zbkj.crmeb.wechat.response.WeChatProgramAuthorizeLoginGetOpenIdResponse;
|
||||
import com.zbkj.crmeb.wechat.service.WeChatService;
|
||||
import com.zbkj.crmeb.wechat.service.impl.WechatSendMessageForMinService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -62,10 +62,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
@@ -347,8 +344,6 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
|
||||
if(request.getGrade() == 1){
|
||||
//二级推广人
|
||||
// userIdList.addAll(userService.getSpreadPeopleIdList(userIdList));
|
||||
// userSpreadPeopleResponse.setTotalLevel(userIdList.size()); //把二级推广人的id追加到一级推广人集合中
|
||||
userIdList.clear();
|
||||
userIdList.addAll(secondSpreadIdList);
|
||||
}
|
||||
@@ -408,109 +403,6 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
return new UserBalanceResponse(info.getNowMoney(), recharge, orderStatusSum);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 推广订单
|
||||
// * @author Mr.Zhang
|
||||
// * @since 2020-06-10
|
||||
// * @return UserSpreadOrderResponse;
|
||||
// */
|
||||
// @Override
|
||||
// public UserSpreadOrderResponse getSpreadOrder(PageParamRequest pageParamRequest) {
|
||||
// UserSpreadOrderResponse userSpreadOrderResponse = new UserSpreadOrderResponse();
|
||||
// Integer userId = userService.getUserIdException();
|
||||
// List<Integer> userIdList = new ArrayList<>();
|
||||
// userIdList.add(userId);
|
||||
// userIdList = userService.getSpreadPeopleIdList(userIdList); //拿到一级推广id
|
||||
// if(null == userIdList){
|
||||
// return userSpreadOrderResponse;
|
||||
// }
|
||||
// //查询所有推广人的由于订单获取佣金记录,分页
|
||||
//
|
||||
// FundsMonitorSearchRequest request = new FundsMonitorSearchRequest();
|
||||
//// request.setCategory(Constants.USER_BILL_CATEGORY_MONEY);
|
||||
//// request.setType(Constants.USER_BILL_TYPE_PAY_MONEY);
|
||||
// request.setCategory(Constants.USER_BILL_CATEGORY_BROKERAGE_PRICE);
|
||||
// request.setType(Constants.USER_BILL_TYPE_BROKERAGE);
|
||||
// request.setUserIdList(CollUtil.newArrayList(userId));
|
||||
// request.setLinkId("gt");
|
||||
// request.setPm(1);
|
||||
// List<UserBill> list = userBillService.getList(request, pageParamRequest);
|
||||
// if(null == list){
|
||||
// return userSpreadOrderResponse;
|
||||
// }
|
||||
// CommonPage<UserBill> userBillCommonPage = CommonPage.restPage(list); //拿到分页信息
|
||||
// userSpreadOrderResponse.setCount(userBillCommonPage.getTotal()); //总数
|
||||
//
|
||||
// //拿到订单id, 查询订单信息
|
||||
// List<Integer> orderIdList = list.stream().map(i -> Integer.parseInt(i.getLinkId())).distinct().collect(Collectors.toList());
|
||||
// Map<Integer, StoreOrder> orderList = storeOrderService.getMapInId(orderIdList);
|
||||
//
|
||||
// //用户信息
|
||||
//// userIdList = list.stream().map(UserBill::getUid).distinct().collect(Collectors.toList());
|
||||
// List<StoreOrder> storeOrderList = new ArrayList<>(orderList.values());
|
||||
// userIdList = storeOrderList.stream().map(StoreOrder::getUid).distinct().collect(Collectors.toList());
|
||||
// HashMap<Integer, User> userList = userService.getMapListInUid(userIdList);
|
||||
//
|
||||
// //按时间分组数据
|
||||
// List<UserSpreadOrderItemResponse> userSpreadOrderItemResponseList = new ArrayList<>();
|
||||
// for (UserBill userBill : list) {
|
||||
// String date = DateUtil.dateToStr(userBill.getCreateTime(), Constants.DATE_FORMAT_MONTH);
|
||||
// boolean isAdd = false;
|
||||
// String orderId = "";
|
||||
// Integer linkId = Integer.parseInt(userBill.getLinkId());
|
||||
// if(null != orderList && orderList.containsKey(linkId)){
|
||||
// orderId = orderList.get(linkId).getOrderId();
|
||||
// }
|
||||
//
|
||||
// UserSpreadOrderItemChildResponse userSpreadOrderItemChildResponse = new UserSpreadOrderItemChildResponse(
|
||||
// orderId, //订单号
|
||||
// userBill.getCreateTime(),
|
||||
// (userBill.getStatus() == 1) ? userBill.getNumber() : BigDecimal.ZERO,
|
||||
//// userList.get(userBill.getUid()).getAvatar(),
|
||||
//// userList.get(userBill.getUid()).getNickname(),
|
||||
// userList.get(orderList.get(linkId).getUid()).getAvatar(),
|
||||
// userList.get(orderList.get(linkId).getUid()).getNickname(),
|
||||
// userBill.getType()
|
||||
// );
|
||||
//
|
||||
// //如果在已有的数据中找到当前月份数据则追加
|
||||
// for (UserSpreadOrderItemResponse userSpreadOrderItemResponse: userSpreadOrderItemResponseList) {
|
||||
// if(userSpreadOrderItemResponse.getTime().equals(date)){
|
||||
// userSpreadOrderItemResponse.getChild().add(userSpreadOrderItemChildResponse);
|
||||
// isAdd = true;
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// //没月找到则创建一条数据
|
||||
// if(!isAdd){
|
||||
// //创建一个
|
||||
// UserSpreadOrderItemResponse userSpreadOrderItemResponse = new UserSpreadOrderItemResponse();
|
||||
// userSpreadOrderItemResponse.setTime(date);
|
||||
// userSpreadOrderItemResponse.getChild().add(userSpreadOrderItemChildResponse);
|
||||
// userSpreadOrderItemResponseList.add(userSpreadOrderItemResponse);
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// List<String> monthList = userSpreadOrderItemResponseList.stream().map(s -> "'" + s.getTime() + "'").collect(Collectors.toList());
|
||||
//
|
||||
// if(monthList.size() < 1){
|
||||
// return userSpreadOrderResponse;
|
||||
// }
|
||||
//
|
||||
// //获取每个月分的总数
|
||||
// Map<String, Integer> countMap = userBillService.getCountListByMonth(request, monthList);
|
||||
//
|
||||
// //统计每月的订单数量
|
||||
// for (UserSpreadOrderItemResponse userSpreadOrderItemResponse: userSpreadOrderItemResponseList) {
|
||||
// userSpreadOrderItemResponse.setCount(countMap.get(userSpreadOrderItemResponse.getTime()));
|
||||
// }
|
||||
//
|
||||
// userSpreadOrderResponse.setList(userSpreadOrderItemResponseList);
|
||||
//
|
||||
// return userSpreadOrderResponse;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 推广订单
|
||||
* @return UserSpreadOrderResponse;
|
||||
@@ -692,11 +584,16 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
User user = userService.getById(userToken.getUid());
|
||||
// 分销绑定
|
||||
if (userService.checkBingSpread(user, spreadUid, "old")) {
|
||||
Integer oldSprUid = user.getSpreadUid();
|
||||
|
||||
user.setSpreadUid(spreadUid);
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(spreadUid);
|
||||
userService.updateSpreadCountByUid(spreadUid, "add");
|
||||
if (oldSprUid > 0) {
|
||||
userService.updateSpreadCountByUid(oldSprUid, "sub");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
@@ -719,11 +616,15 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
User user = userService.getById(userToken.getUid());
|
||||
// 分销绑定
|
||||
if (userService.checkBingSpread(user, spreadUid, "old")) {
|
||||
Integer oldSprUid = user.getSpreadUid();
|
||||
user.setSpreadUid(spreadUid);
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(spreadUid);
|
||||
userService.updateSpreadCountByUid(spreadUid, "add");
|
||||
if (oldSprUid > 0) {
|
||||
userService.updateSpreadCountByUid(oldSprUid, "sub");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
@@ -748,7 +649,7 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(spreadUid);
|
||||
userService.updateSpreadCountByUid(spreadUid, "add");
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
@@ -762,15 +663,28 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
List<StoreCoupon> couponList = storeCouponService.findRegisterList();
|
||||
if (CollUtil.isNotEmpty(couponList)) {
|
||||
couponList.forEach(storeCoupon -> {
|
||||
//是否有固定的使用时间
|
||||
if(!storeCoupon.getIsFixedTime()){
|
||||
String endTime = DateUtil.addDay(DateUtil.nowDate(Constants.DATE_FORMAT), storeCoupon.getDay(), Constants.DATE_FORMAT);
|
||||
storeCoupon.setUseEndTime(DateUtil.strToDate(endTime, Constants.DATE_FORMAT));
|
||||
storeCoupon.setUseStartTime(DateUtil.nowDateTimeReturnDate(Constants.DATE_FORMAT));
|
||||
}
|
||||
|
||||
StoreCouponUser storeCouponUser = new StoreCouponUser();
|
||||
storeCouponUser.setCouponId(storeCoupon.getId());
|
||||
// storeCouponUser.setUid(userId);
|
||||
storeCouponUser.setName(storeCoupon.getName());
|
||||
storeCouponUser.setMoney(storeCoupon.getMoney());
|
||||
storeCouponUser.setMinPrice(storeCoupon.getMinPrice());
|
||||
storeCouponUser.setStartTime(storeCoupon.getUseStartTime());
|
||||
storeCouponUser.setEndTime(storeCoupon.getUseEndTime());
|
||||
storeCouponUser.setUseType(storeCoupon.getUseType());
|
||||
if (storeCoupon.getIsFixedTime()) {// 使用固定时间
|
||||
storeCouponUser.setStartTime(storeCoupon.getUseStartTime());
|
||||
storeCouponUser.setEndTime(storeCoupon.getUseEndTime());
|
||||
} else {// 没有固定使用时间
|
||||
Date nowDate = DateUtil.nowDateTime();
|
||||
storeCouponUser.setStartTime(nowDate);
|
||||
DateTime dateTime = cn.hutool.core.date.DateUtil.offsetDay(nowDate, storeCoupon.getDay());
|
||||
storeCouponUser.setEndTime(dateTime);
|
||||
}
|
||||
storeCouponUser.setType("register");
|
||||
if (storeCoupon.getUseType() > 1) {
|
||||
storeCouponUser.setPrimaryKey(storeCoupon.getPrimaryKey());
|
||||
@@ -807,10 +721,6 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
@Override
|
||||
public String getLogo() {
|
||||
String url = systemConfigService.getValueByKey(Constants.CONFIG_KEY_MOBILE_LOGIN_LOGO);
|
||||
// if(StringUtils.isNotBlank(url) && !url.contains("http")){
|
||||
// url = systemConfigService.getValueByKey(Constants.CONFIG_KEY_SITE_URL) + url;
|
||||
// url = url.replace("\\", "/");
|
||||
// }
|
||||
return url;
|
||||
}
|
||||
|
||||
@@ -1006,11 +916,15 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
User user = userService.getById(userToken.getUid());
|
||||
// 分销绑定
|
||||
if (userService.checkBingSpread(user, request.getSpreadPid(), "old")) {
|
||||
Integer oldSprUid = user.getSpreadUid();
|
||||
user.setSpreadUid(request.getSpreadPid());
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(request.getSpreadPid());
|
||||
userService.updateSpreadCountByUid(request.getSpreadPid(), "add");
|
||||
if (oldSprUid > 0) {
|
||||
userService.updateSpreadCountByUid(oldSprUid, "sub");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
@@ -1026,11 +940,15 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
User user = userService.getById(userToken.getUid());
|
||||
// 分销绑定
|
||||
if (userService.checkBingSpread(user, request.getSpreadPid(), "old")) {
|
||||
Integer oldSprUid = user.getSpreadUid();
|
||||
user.setSpreadUid(request.getSpreadPid());
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(request.getSpreadPid());
|
||||
userService.updateSpreadCountByUid(request.getSpreadPid(), "add");
|
||||
if (oldSprUid > 0) {
|
||||
userService.updateSpreadCountByUid(oldSprUid, "sub");
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
@@ -1055,7 +973,7 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(request.getSpreadPid());
|
||||
userService.updateSpreadCountByUid(request.getSpreadPid(), "add");
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
@@ -1069,9 +987,15 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
List<StoreCoupon> couponList = storeCouponService.findRegisterList();
|
||||
if (CollUtil.isNotEmpty(couponList)) {
|
||||
couponList.forEach(storeCoupon -> {
|
||||
//是否有固定的使用时间
|
||||
if(!storeCoupon.getIsFixedTime()){
|
||||
String endTime = DateUtil.addDay(DateUtil.nowDate(Constants.DATE_FORMAT), storeCoupon.getDay(), Constants.DATE_FORMAT);
|
||||
storeCoupon.setUseEndTime(DateUtil.strToDate(endTime, Constants.DATE_FORMAT));
|
||||
storeCoupon.setUseStartTime(DateUtil.nowDateTimeReturnDate(Constants.DATE_FORMAT));
|
||||
}
|
||||
|
||||
StoreCouponUser storeCouponUser = new StoreCouponUser();
|
||||
storeCouponUser.setCouponId(storeCoupon.getId());
|
||||
// storeCouponUser.setUid(userId);
|
||||
storeCouponUser.setName(storeCoupon.getName());
|
||||
storeCouponUser.setMoney(storeCoupon.getMoney());
|
||||
storeCouponUser.setMinPrice(storeCoupon.getMinPrice());
|
||||
|
||||
97
crmeb/src/main/java/com/zbkj/crmeb/front/utils/userUtil.java
Normal file
97
crmeb/src/main/java/com/zbkj/crmeb/front/utils/userUtil.java
Normal file
@@ -0,0 +1,97 @@
|
||||
package com.zbkj.crmeb.front.utils;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.constants.SmsConstants;
|
||||
import com.exception.CrmebException;
|
||||
import com.utils.DateUtil;
|
||||
import com.utils.RedisUtil;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
/**
|
||||
* 用户工具类
|
||||
* +----------------------------------------------------------------------
|
||||
* * | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* * +----------------------------------------------------------------------
|
||||
* * | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* * +----------------------------------------------------------------------
|
||||
* * | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* * +----------------------------------------------------------------------
|
||||
* * | Author: CRMEB Team <admin@crmeb.com>
|
||||
* * +----------------------------------------------------------------------
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
public class userUtil {
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
/**
|
||||
* 检测手机验证码
|
||||
* @param phone 手机号
|
||||
* @param code 验证码
|
||||
*/
|
||||
public void checkValidateCode(String phone, String code) {
|
||||
Object validateCode = redisUtil.get(SmsConstants.SMS_VALIDATE_PHONE + phone);
|
||||
if(validateCode == null){
|
||||
throw new CrmebException("验证码已过期");
|
||||
}
|
||||
|
||||
if(!validateCode.toString().equals(code)){
|
||||
throw new CrmebException("验证码错误");
|
||||
}
|
||||
|
||||
//删除验证码
|
||||
redisUtil.remove(SmsConstants.SMS_VALIDATE_PHONE + phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定分销关系
|
||||
* @param user User 用户user类
|
||||
* @param spreadUid Integer 推广人id
|
||||
* @return Boolean
|
||||
* 1.判断分销功能是否启用
|
||||
* 2.判断分销模式
|
||||
* 3.根据不同的分销模式校验
|
||||
* 4.指定分销,只有分销员才可以分销,需要spreadUid是推广员才可以绑定
|
||||
* 5.满额分销,同上
|
||||
* 6.人人分销,可以直接绑定
|
||||
*/
|
||||
public Boolean bindSpread(User user, Integer spreadUid) {
|
||||
log.info("绑定推广关系:user:"+ JSON.toJSONString(user));
|
||||
log.info("绑定推广关系:spreadUid:"+ spreadUid);
|
||||
Boolean checkBingSpread = userService.checkBingSpread(user, spreadUid, "old");
|
||||
log.info("确定绑定关系:"+checkBingSpread);
|
||||
if (!checkBingSpread) return false;
|
||||
|
||||
Integer oldSprUid = user.getSpreadUid();
|
||||
|
||||
user.setSpreadUid(spreadUid);
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
userService.updateById(user);
|
||||
userService.updateSpreadCountByUid(spreadUid, "add");
|
||||
if (oldSprUid > 0) {
|
||||
userService.updateSpreadCountByUid(oldSprUid, "sub");
|
||||
}
|
||||
log.info(StrUtil.format("绑定推广人:user={},spreadUid = {}",JSON.toJSONString(user),spreadUid));
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
log.info(StrUtil.format("绑定推广人时出错,userUid = {}, spreadUid = {}", user.getUid(), spreadUid));
|
||||
}
|
||||
return execute;
|
||||
}
|
||||
}
|
||||
@@ -17,8 +17,6 @@ import com.zbkj.crmeb.log.model.StoreProductLog;
|
||||
*/
|
||||
public interface StoreProductLogService extends IService<StoreProductLog> {
|
||||
|
||||
// List<StoreProductLog> getList(StoreProductLogSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
Integer getCountByTimeAndType(String time, String type);
|
||||
|
||||
void addLogTask();
|
||||
|
||||
@@ -1,28 +1,22 @@
|
||||
package com.zbkj.crmeb.log.service.impl;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.constants.Constants;
|
||||
import com.constants.SmsConstants;
|
||||
import com.utils.CrmebUtil;
|
||||
import com.utils.DateUtil;
|
||||
import com.utils.RedisUtil;
|
||||
import com.utils.vo.dateLimitUtilVo;
|
||||
import com.zbkj.crmeb.log.dao.StoreProductLogDao;
|
||||
import com.zbkj.crmeb.log.model.StoreProductLog;
|
||||
import com.zbkj.crmeb.log.service.StoreProductLogService;
|
||||
import com.zbkj.crmeb.task.log.ProductLogAddTask;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* StoreProductLogServiceImpl 接口实现
|
||||
@@ -94,26 +88,5 @@ public class StoreProductLogServiceImpl extends ServiceImpl<StoreProductLogDao,
|
||||
save(proLog);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param request 请求参数
|
||||
* @param pageParamRequest 分页类参数
|
||||
* @author HZW
|
||||
* @since 2020-12-01
|
||||
* @return List<StoreProductLog>
|
||||
*/
|
||||
// @Override
|
||||
// public List<StoreProductLog> getList(StoreProductLogSearchRequest request, PageParamRequest pageParamRequest) {
|
||||
// PageHelper.startPage(pageParamRequest.getPageNum(), pageParamRequest.getPageSize());
|
||||
//
|
||||
// //带 StoreProductLog 类的多条件查询
|
||||
// LambdaQueryWrapper<StoreProductLog> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// StoreProductLog model = new StoreProductLog();
|
||||
// BeanUtils.copyProperties(request, model);
|
||||
// lambdaQueryWrapper.setEntity(model);
|
||||
// return dao.selectList(lambdaQueryWrapper);
|
||||
// }
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -60,7 +60,7 @@ public class StoreCouponUser implements Serializable {
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "状态(0:未使用,1:已使用, 2:已失效)")
|
||||
private int status;
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date createTime;
|
||||
|
||||
@@ -34,8 +34,6 @@ public interface StoreCouponService extends IService<StoreCoupon> {
|
||||
|
||||
void checkException(StoreCoupon storeCoupon);
|
||||
|
||||
// List<StoreCoupon> getListByProductCanUse(Integer productId);
|
||||
|
||||
StoreCouponInfoResponse info(Integer id);
|
||||
|
||||
List<StoreCouponFrontResponse> getListByUser(Integer productId, PageParamRequest pageParamRequest, Integer userId);
|
||||
|
||||
@@ -41,8 +41,6 @@ public interface StoreCouponUserService extends IService<StoreCouponUser> {
|
||||
|
||||
Boolean receive(StoreCouponUserRequest storeCouponUserRequest);
|
||||
|
||||
boolean use(Integer id, List<Integer> productIdList, BigDecimal price);
|
||||
|
||||
/**
|
||||
* 检测优惠券是否可用,计算订单价格时使用
|
||||
* @param id 优惠券id
|
||||
@@ -52,8 +50,6 @@ public interface StoreCouponUserService extends IService<StoreCouponUser> {
|
||||
*/
|
||||
boolean canUse(Integer id, List<Integer> productIdList, BigDecimal price);
|
||||
|
||||
boolean receiveAll(UserCouponReceiveRequest request, Integer userId, String type);
|
||||
|
||||
boolean rollbackByCancelOrder(StoreOrder storeOrder);
|
||||
|
||||
HashMap<Integer, StoreCouponUser> getMapByUserId(Integer userId);
|
||||
@@ -84,4 +80,12 @@ public interface StoreCouponUserService extends IService<StoreCouponUser> {
|
||||
* @return
|
||||
*/
|
||||
MyRecord paySuccessGiveAway(Integer couponId, Integer uid);
|
||||
|
||||
/**
|
||||
* 根据uid获取列表
|
||||
* @param uid uid
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return
|
||||
*/
|
||||
List<StoreCouponUser> findListByUid(Integer uid, PageParamRequest pageParamRequest);
|
||||
}
|
||||
|
||||
@@ -221,26 +221,6 @@ public class StoreCouponServiceImpl extends ServiceImpl<StoreCouponDao, StoreCou
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 根据商品id获取可用优惠券列表
|
||||
// * @param productId 获取可用优惠券的商品id
|
||||
// * @return 商品对应的可用优惠券集合
|
||||
// */
|
||||
// @Override
|
||||
// public List<StoreCoupon> getListByProductCanUse(Integer productId) {
|
||||
//
|
||||
// List<Integer> categoryIdList = storeProductService.getSecondaryCategoryByProductId(productId);
|
||||
//
|
||||
// LambdaQueryWrapper<StoreCoupon> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
// lambdaQueryWrapper.eq(StoreCoupon::getIsDel, false);
|
||||
// lambdaQueryWrapper.eq(StoreCoupon::getType, 1);
|
||||
// lambdaQueryWrapper.eq(StoreCoupon::getIsLimited, true);
|
||||
// lambdaQueryWrapper.ge(StoreCoupon::getLastTotal, 0);
|
||||
// //有商品id 通用券可以领取,商品券可以领取,分类券可以领取
|
||||
// lambdaQueryWrapper.apply(getPrimaryKeySql(productId));
|
||||
// return dao.selectList(lambdaQueryWrapper);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 优惠券详情
|
||||
* @param id Integer 获取可用优惠券的商品id
|
||||
@@ -352,7 +332,6 @@ public class StoreCouponServiceImpl extends ServiceImpl<StoreCouponDao, StoreCou
|
||||
public List<StoreCoupon> findRegisterList() {
|
||||
String dateStr = DateUtil.nowDate(Constants.DATE_FORMAT);
|
||||
LambdaQueryWrapper<StoreCoupon> lqw = new LambdaQueryWrapper<>();
|
||||
// lqw.gt(StoreCoupon::getLastTotal, 0);
|
||||
lqw.eq(StoreCoupon::getType, 2);
|
||||
lqw.eq(StoreCoupon::getStatus, true);
|
||||
lqw.eq(StoreCoupon::getIsDel, false);
|
||||
@@ -394,7 +373,9 @@ public class StoreCouponServiceImpl extends ServiceImpl<StoreCouponDao, StoreCou
|
||||
//剩余数量大于0 或者不设置上限
|
||||
.and(i -> i.gt(StoreCoupon::getLastTotal, 0).or().eq(StoreCoupon::getIsLimited, false))
|
||||
//领取时间范围, 结束时间为null则是不限时
|
||||
.and(i -> i.isNull(StoreCoupon::getReceiveEndTime).or( p -> p.lt(StoreCoupon::getReceiveStartTime, date).gt(StoreCoupon::getReceiveEndTime, date)));
|
||||
.and(i -> i.isNull(StoreCoupon::getReceiveEndTime).or( p -> p.lt(StoreCoupon::getReceiveStartTime, date).gt(StoreCoupon::getReceiveEndTime, date)))
|
||||
// 用户使用时间范围,结束时间为null则是不限时
|
||||
.and(i -> i.isNull(StoreCoupon::getUseEndTime).or(p -> p.gt(StoreCoupon::getUseEndTime, date)));
|
||||
lambdaQueryWrapper.eq(StoreCoupon::getType, 1);
|
||||
if(productId > 0){
|
||||
//有商品id 通用券可以领取,商品券可以领取,分类券可以领取
|
||||
|
||||
@@ -40,7 +40,10 @@ import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -105,13 +108,6 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
if(request.getCouponId() != null){
|
||||
lambdaQueryWrapper.eq(StoreCouponUser::getCouponId, request.getCouponId());
|
||||
}
|
||||
|
||||
// if(request.getMinPrice() != null){
|
||||
// lambdaQueryWrapper.le(StoreCouponUser::getMinPrice, request.getMinPrice());
|
||||
// }
|
||||
|
||||
// lambdaQueryWrapper.orderByDesc(StoreCouponUser::getId);
|
||||
|
||||
lambdaQueryWrapper.last(StrUtil.format(" order by case `status` when {} then {} when {} then {} when {} then {} end", 0, 1, 1, 2, 2, 3));
|
||||
List<StoreCouponUser> storeCouponUserList = dao.selectList(lambdaQueryWrapper);
|
||||
if(storeCouponUserList.size() < 1){
|
||||
@@ -253,69 +249,6 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用
|
||||
* @param id Integer 领取记录id
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean use(Integer id, List<Integer> productIdList, BigDecimal price) {
|
||||
StoreCouponUser storeCouponUser = getById(id);
|
||||
if(storeCouponUser == null || !storeCouponUser.getUid().equals(userService.getUserIdException())){
|
||||
throw new CrmebException("领取记录不存在!");
|
||||
}
|
||||
|
||||
if(storeCouponUser.getStatus() == 1){
|
||||
throw new CrmebException("此优惠券已使用!");
|
||||
}
|
||||
|
||||
if(storeCouponUser.getStatus() == 2){
|
||||
throw new CrmebException("此优惠券已失效!");
|
||||
}
|
||||
|
||||
//判断是否在使用时间内
|
||||
Date date = DateUtil.nowDateTime();
|
||||
if(storeCouponUser.getStartTime().compareTo(date) > 0){
|
||||
throw new CrmebException("此优惠券还未到达使用时间范围之内!");
|
||||
}
|
||||
|
||||
if(date.compareTo(storeCouponUser.getEndTime()) > 0){
|
||||
throw new CrmebException("此优惠券已经失效了");
|
||||
}
|
||||
|
||||
if(storeCouponUser.getMinPrice().compareTo(price) > 0){
|
||||
throw new CrmebException("总金额小于优惠券最小使用金额");
|
||||
}
|
||||
|
||||
//检测优惠券信息
|
||||
if(storeCouponUser.getUseType() > 1){
|
||||
if(productIdList.size() < 1){
|
||||
throw new CrmebException("没有找到商品");
|
||||
}
|
||||
|
||||
//拿出需要使用优惠券的商品分类集合
|
||||
List<Integer> categoryIdList = storeProductService.getSecondaryCategoryByProductId(StringUtils.join(productIdList, ","));
|
||||
|
||||
//设置优惠券所提供的集合
|
||||
List<Integer> primaryKeyIdList = CrmebUtil.stringToArray(storeCouponUser.getPrimaryKey());
|
||||
|
||||
//取两个集合的交集,如果是false则证明没有相同的值
|
||||
if(storeCouponUser.getUseType() == 2 && !primaryKeyIdList.retainAll(productIdList)){
|
||||
throw new CrmebException("此优惠券为商品券,请购买相关商品之后再使用!");
|
||||
}
|
||||
|
||||
if(storeCouponUser.getUseType() == 3 && !primaryKeyIdList.retainAll(categoryIdList)){
|
||||
throw new CrmebException("此优惠券为分类券,请购买相关分类下的商品之后再使用!");
|
||||
}
|
||||
}
|
||||
|
||||
storeCouponUser.setStatus(1);
|
||||
storeCouponUser.setUseTime(DateUtil.nowDateTime());
|
||||
return updateById(storeCouponUser);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测优惠券是否可用,计算订单价格时使用
|
||||
*
|
||||
@@ -385,61 +318,6 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户批量领取优惠券
|
||||
* @param request UserCouponReceiveRequest 领取参数
|
||||
* @param userId Integer 用户id
|
||||
* @param type String 获取方式
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
* @return boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean receiveAll(UserCouponReceiveRequest request, Integer userId, String type) {
|
||||
|
||||
//获取优惠券信息
|
||||
List<Integer> couponIdList = Arrays.asList(request.getCouponId());
|
||||
//过滤掉已经领取过的用户
|
||||
filterReceiveUserInCouponId(couponIdList, userId);
|
||||
if(couponIdList.size() < 1){
|
||||
//都已经领取过了
|
||||
throw new CrmebException("当前用户已经领取过此优惠券了!");
|
||||
}
|
||||
|
||||
|
||||
List<StoreCoupon> storeCouponList = storeCouponService.getReceiveListInId(couponIdList);
|
||||
if(storeCouponList.size() < 1){
|
||||
//没有查到说明,当前没有可以供领取的优惠券
|
||||
throw new CrmebException("没有可以发放的优惠券!");
|
||||
}
|
||||
|
||||
|
||||
ArrayList<StoreCouponUser> storeCouponUserList = new ArrayList<>();
|
||||
for (StoreCoupon storeCoupon : storeCouponList) {
|
||||
storeCouponService.checkException(storeCoupon);
|
||||
//如果是按领取时间计算天数
|
||||
if(storeCoupon.getIsFixedTime()){
|
||||
String endTime = DateUtil.addDay(DateUtil.nowDate(Constants.DATE_FORMAT_DATE), storeCoupon.getDay() + 1, Constants.DATE_FORMAT);
|
||||
storeCoupon.setUseEndTime(DateUtil.strToDate(endTime, Constants.DATE_FORMAT));
|
||||
storeCoupon.setUseStartTime(DateUtil.nowDateTimeReturnDate(Constants.DATE_FORMAT_DATE));
|
||||
}
|
||||
|
||||
StoreCouponUser storeCouponUser = new StoreCouponUser();
|
||||
storeCouponUser.setCouponId(storeCoupon.getId());
|
||||
storeCouponUser.setUid(userId);
|
||||
storeCouponUser.setName(storeCoupon.getName());
|
||||
storeCouponUser.setMoney(storeCoupon.getMoney());
|
||||
storeCouponUser.setMinPrice(storeCoupon.getMinPrice());
|
||||
storeCouponUser.setType(type);
|
||||
storeCouponUser.setStartTime(storeCoupon.getUseStartTime());
|
||||
storeCouponUser.setEndTime(storeCoupon.getUseEndTime());
|
||||
storeCouponUser.setUseType(storeCoupon.getUseType());
|
||||
storeCouponUserList.add(storeCouponUser);
|
||||
}
|
||||
|
||||
return saveBatch(storeCouponUserList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 下单之后取消订单回滚优惠券使用
|
||||
* @param storeOrder StoreOrder 订单数据
|
||||
@@ -469,9 +347,7 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
*/
|
||||
@Override
|
||||
public HashMap<Integer, StoreCouponUser> getMapByUserId(Integer userId) {
|
||||
StoreCouponUser storeCouponUser = new StoreCouponUser();
|
||||
storeCouponUser.setUid(userId);
|
||||
List<StoreCouponUser> list = getList(storeCouponUser);
|
||||
List<StoreCouponUser> list = findListByUid(userId);
|
||||
|
||||
if(list.size() < 1){
|
||||
return null;
|
||||
@@ -484,6 +360,12 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
return map;
|
||||
}
|
||||
|
||||
private List<StoreCouponUser> findListByUid(Integer uid) {
|
||||
LambdaQueryWrapper<StoreCouponUser> lwq = new LambdaQueryWrapper<>();
|
||||
lwq.eq(StoreCouponUser::getUid, uid);
|
||||
return dao.selectList(lwq);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据购物车id获取可用优惠券
|
||||
* @param cartIds 购物车id
|
||||
@@ -537,6 +419,7 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
public List<StoreCouponUserResponse> getListFront(Integer userId, PageParamRequest pageParamRequest) {
|
||||
StoreCouponUserSearchRequest request = new StoreCouponUserSearchRequest();
|
||||
request.setUid(userId);
|
||||
pageParamRequest.setLimit(9999);
|
||||
PageInfo<StoreCouponUserResponse> list = getList(request, pageParamRequest);
|
||||
|
||||
if(null == list.getList() || list.getList().size() < 1){
|
||||
@@ -733,6 +616,24 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
return record;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据uid获取列表
|
||||
* @param uid uid
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return 优惠券列表
|
||||
*/
|
||||
@Override
|
||||
public List<StoreCouponUser> findListByUid(Integer uid, PageParamRequest pageParamRequest) {
|
||||
Page<StoreCouponUser> storeCouponUserPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
|
||||
//带 StoreCouponUser 类的多条件查询
|
||||
LambdaQueryWrapper<StoreCouponUser> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
lambdaQueryWrapper.eq(StoreCouponUser::getUid, uid);
|
||||
lambdaQueryWrapper.orderByDesc(StoreCouponUser::getId);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
private void getPrimaryKeySql(LambdaQueryWrapper<StoreCouponUser> lambdaQueryWrapper, String productIdStr){
|
||||
if(StringUtils.isBlank(productIdStr)){
|
||||
return;
|
||||
@@ -742,9 +643,6 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
String categoryIdStr = categoryIdList.stream().map(Object::toString).collect(Collectors.joining(","));
|
||||
lambdaQueryWrapper.and(i -> i.and(
|
||||
//通用券 商品券 品类券
|
||||
// t -> t.eq(StoreCouponUser::getUseType, 1)
|
||||
// .or(p -> p.eq(StoreCouponUser::getUseType , 2).apply(CrmebUtil.getFindInSetSql("primary_key", productIdStr)))
|
||||
// .or(c -> c.eq(StoreCouponUser::getUseType , 3).apply(CrmebUtil.getFindInSetSql("primary_key", (ArrayList<Integer>) categoryIdList)))
|
||||
t -> t.eq(StoreCouponUser::getUseType, 1)
|
||||
.or(p -> p.eq(StoreCouponUser::getUseType , 2).apply(StrUtil.format(" primary_key in ({})", productIdStr)))
|
||||
.or(c -> c.eq(StoreCouponUser::getUseType , 3).apply(StrUtil.format(" primary_key in ({})", categoryIdStr)))
|
||||
|
||||
@@ -141,11 +141,6 @@ public class CallbackServiceImpl implements CallbackService {
|
||||
AttachVo attachVo = JSONObject.toJavaObject(JSONObject.parseObject(callbackVo.getAttach()), AttachVo.class);
|
||||
|
||||
//判断openid
|
||||
// UserToken userToken = userTokenService.getByOpenid(callbackVo.getOpenid());
|
||||
// if(null == userToken || !userToken.getUid().equals(attachVo.getUserId())){
|
||||
// //用户信息错误
|
||||
// throw new CrmebException("用户信息错误!");
|
||||
// }
|
||||
User user = userService.getById(attachVo.getUserId());
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
//用户信息错误
|
||||
@@ -194,6 +189,13 @@ public class CallbackServiceImpl implements CallbackService {
|
||||
}
|
||||
}
|
||||
StoreCombination storeCombination = storeCombinationService.getById(storeOrder.getCombinationId());
|
||||
// 如果拼团人数已满,重新开团
|
||||
if (pinkId > 0) {
|
||||
Integer count = storePinkService.getCountByKid(pinkId);
|
||||
if (count >= storeCombination.getPeople()) {
|
||||
pinkId = 0;
|
||||
}
|
||||
}
|
||||
// 生成拼团表数据
|
||||
StorePink storePink = new StorePink();
|
||||
storePink.setUid(user.getUid());
|
||||
@@ -226,10 +228,8 @@ public class CallbackServiceImpl implements CallbackService {
|
||||
storePink.setStatus(1);
|
||||
storePinkService.save(storePink);
|
||||
// 如果是开团,需要更新订单数据
|
||||
if (storePink.getKId() == 0) {
|
||||
storeOrder.setPinkId(storePink.getId());
|
||||
storeOrderService.updateById(storeOrder);
|
||||
}
|
||||
storeOrder.setPinkId(storePink.getId());
|
||||
storeOrderService.updateById(storeOrder);
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
|
||||
@@ -196,7 +196,6 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
||||
case Constants.PAY_TYPE_OFFLINE: //线下支付
|
||||
throw new CrmebException("线下支付未开通");
|
||||
case Constants.PAY_TYPE_YUE: //余额支付 判断余额支付成功CreateOrderResponseVo.ResultCode = 1;
|
||||
// boolean yuePay = storeOrderService.yuePay(storeOrder, userService.getInfo(),"");
|
||||
boolean yuePay = storeOrderService.yuePay(storeOrder, userService.getInfo(),"");
|
||||
responseVo = responseVo.setResultCode(yuePay + "");
|
||||
break;
|
||||
@@ -395,58 +394,6 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
||||
storeBargainUser.setStatus(3);
|
||||
storeBargainUserService.updateById(storeBargainUser);
|
||||
}
|
||||
// 如果是拼团商品,拼团处理
|
||||
// TODO 拼团整体逻辑需调整
|
||||
// TODO 将拼团生成放到订单生成,如果取消订单,则删除生成的拼团的数据
|
||||
// TODO 在这里,只负责将拼团状态改为已完成(用消息列队发送拼团task形式处理)
|
||||
// if (storeOrder.getCombinationId() > 0) {
|
||||
// // 判断拼团团长是否存在
|
||||
// StorePink headPink = new StorePink();
|
||||
// Integer pinkId = storeOrder.getPinkId();
|
||||
// if (pinkId > 0) {
|
||||
// headPink = storePinkService.getById(pinkId);
|
||||
// if (ObjectUtil.isNull(headPink) || headPink.getIsRefund().equals(true) || headPink.getStatus() == 3) {
|
||||
// pinkId = 0;
|
||||
// }
|
||||
// }
|
||||
// StoreCombination storeCombination = storeCombinationService.getById(storeOrder.getCombinationId());
|
||||
// // 生成拼团表数据
|
||||
// StorePink storePink = new StorePink();
|
||||
// storePink.setUid(user.getUid());
|
||||
// storePink.setAvatar(user.getAvatar());
|
||||
// storePink.setNickname(user.getNickname());
|
||||
// storePink.setOrderId(storeOrder.getOrderId());
|
||||
// storePink.setOrderIdKey(storeOrder.getId());
|
||||
// storePink.setTotalNum(storeOrder.getTotalNum());
|
||||
// storePink.setTotalPrice(storeOrder.getTotalPrice());
|
||||
// storePink.setCid(storeCombination.getId());
|
||||
// storePink.setPid(storeCombination.getProductId());
|
||||
// storePink.setPeople(storeCombination.getPeople());
|
||||
// storePink.setPrice(storeCombination.getPrice());
|
||||
// Integer effectiveTime = storeCombination.getEffectiveTime();// 有效小时数
|
||||
// DateTime dateTime = cn.hutool.core.date.DateUtil.date();
|
||||
// storePink.setAddTime(dateTime.getTime());
|
||||
// if (pinkId > 0) {
|
||||
// storePink.setStopTime(headPink.getStopTime());
|
||||
// } else {
|
||||
// DateTime hourTime = cn.hutool.core.date.DateUtil.offsetHour(dateTime, effectiveTime);
|
||||
// long stopTime = hourTime.getTime();
|
||||
// if (stopTime > storeCombination.getStopTime()) {
|
||||
// stopTime = storeCombination.getStopTime();
|
||||
// }
|
||||
// storePink.setStopTime(stopTime);
|
||||
// }
|
||||
// storePink.setKId(pinkId);
|
||||
// storePink.setIsTpl(false);
|
||||
// storePink.setIsRefund(false);
|
||||
// storePink.setStatus(1);
|
||||
// storePinkService.save(storePink);
|
||||
// // 如果是开团,需要更新订单数据
|
||||
// if (storePink.getKId() == 0) {
|
||||
// storeOrder.setPinkId(storePink.getId());
|
||||
// storeOrderService.updateById(storeOrder);
|
||||
// }
|
||||
// }
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
|
||||
@@ -671,6 +618,13 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
||||
}
|
||||
}
|
||||
StoreCombination storeCombination = storeCombinationService.getById(storeOrder.getCombinationId());
|
||||
// 如果拼团人数已满,重新开团
|
||||
if (pinkId > 0) {
|
||||
Integer count = storePinkService.getCountByKid(pinkId);
|
||||
if (count >= storeCombination.getPeople()) {
|
||||
pinkId = 0;
|
||||
}
|
||||
}
|
||||
// 生成拼团表数据
|
||||
StorePink storePink = new StorePink();
|
||||
storePink.setUid(user.getUid());
|
||||
@@ -703,10 +657,8 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
||||
storePink.setStatus(1);
|
||||
storePinkService.save(storePink);
|
||||
// 如果是开团,需要更新订单数据
|
||||
if (storePink.getKId() == 0) {
|
||||
storeOrder.setPinkId(storePink.getId());
|
||||
storeOrderService.updateById(storeOrder);
|
||||
}
|
||||
storeOrder.setPinkId(storePink.getId());
|
||||
storeOrderService.updateById(storeOrder);
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
@@ -924,13 +876,6 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
||||
temMap.put("amount2", storeOrder.getPayPrice().toString() + "元");
|
||||
temMap.put("thing7", "您的订单已支付成功");
|
||||
templateMessageService.pushMiniTemplateMessage(Constants.WE_CHAT_PROGRAM_TEMP_KEY_ORDER_PAY, temMap, userToken.getToken());
|
||||
// String storeNameAndCarNumString = orderUtils.getStoreNameAndCarNumString(storeOrder.getId());
|
||||
// if(StringUtils.isNotBlank(storeNameAndCarNumString)){
|
||||
// WechatSendMessageForPaySuccess paySuccess = new WechatSendMessageForPaySuccess(
|
||||
// storeOrder.getId()+"",storeOrder.getPayPrice()+"",storeOrder.getPayTime()+"","暂无",
|
||||
// storeOrder.getTotalPrice()+"",storeNameAndCarNumString);
|
||||
// orderUtils.sendWeiChatMiniMessageForPaySuccess(paySuccess, userService.getById(storeOrder).getUid());
|
||||
// }
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -960,13 +905,6 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
||||
Map<Integer, Boolean> couponMap = CollUtil.newHashMap();
|
||||
for (StoreOrderInfoVo order : orders) {
|
||||
List<StoreProductCoupon> couponsForGiveUser = storeProductCouponService.getListByProductId(order.getProductId());
|
||||
// User currentUser = userService.getById(storeOrder.getUid());
|
||||
// for (StoreProductCoupon storeProductCoupon : couponsForGiveUser) {
|
||||
// StoreCouponUserRequest crp = new StoreCouponUserRequest();
|
||||
// crp.setUid(currentUser.getUid()+"");
|
||||
// crp.setCouponId(storeProductCoupon.getIssueCouponId());
|
||||
// storeCouponUserService.receive(crp);
|
||||
// }
|
||||
for (int i = 0; i < couponsForGiveUser.size();) {
|
||||
StoreProductCoupon storeProductCoupon = couponsForGiveUser.get(i);
|
||||
MyRecord record = storeCouponUserService.paySuccessGiveAway(storeProductCoupon.getIssueCouponId(), storeOrder.getUid());
|
||||
@@ -1088,7 +1026,6 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
||||
if(orderList.size() < 1){
|
||||
throw new CrmebException("在订单里没有找到商品数据");
|
||||
}
|
||||
// return orderList.get(0).getInfo().getJSONObject("productInfo").getString("store_name");
|
||||
return orderList.get(0).getInfo().getProductInfo().getStoreName();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,7 +15,6 @@ import com.zbkj.crmeb.payment.wechat.WeChatPayService;
|
||||
import com.zbkj.crmeb.sms.service.SmsService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.model.UserBill;
|
||||
import com.zbkj.crmeb.user.model.UserToken;
|
||||
import com.zbkj.crmeb.user.request.UserOperateFundsRequest;
|
||||
import com.zbkj.crmeb.user.service.UserBillService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
@@ -77,9 +76,6 @@ public class RechargePayServiceImpl extends PayService implements RechargePaySer
|
||||
//订单类
|
||||
private UserRecharge userRecharge;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
* @param orderId Integer 订单号
|
||||
@@ -206,33 +202,9 @@ public class RechargePayServiceImpl extends PayService implements RechargePaySer
|
||||
userBillService.save(userBill);
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (execute) {
|
||||
//下发模板通知
|
||||
// pushTempMessageRecharge(userRecharge);
|
||||
}
|
||||
return execute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 发送模板消息通知
|
||||
*/
|
||||
private void pushTempMessageRecharge(UserRecharge userRecharge) {
|
||||
User info = userService.getById(userRecharge.getUid());
|
||||
|
||||
String tempKey = Constants.WE_CHAT_PUBLIC_TEMP_KEY_RECHARGE;
|
||||
if(Constants.PAY_TYPE_WE_CHAT_FROM_PROGRAM.equals(userRecharge.getRechargeType())){
|
||||
tempKey = Constants.WE_CHAT_PROGRAM_TEMP_KEY_RECHARGE;
|
||||
}
|
||||
|
||||
HashMap<String, String> map = new HashMap<>();
|
||||
map.put("rechargeOrderId", userRecharge.getOrderId());
|
||||
map.put("rechargeAmount", userRecharge.getPrice().add(userRecharge.getGivePrice()).toString());
|
||||
map.put("rechargeAfterBalance", info.getNowMoney().toString());
|
||||
map.put("rechargeDate", userRecharge.getOrderId());
|
||||
|
||||
templateMessageService.push(tempKey, map, userRecharge.getUid(), userRecharge.getRechargeType());
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付成功之后, 需要事物处理
|
||||
* @author Mr.Zhang
|
||||
@@ -311,7 +283,6 @@ public class RechargePayServiceImpl extends PayService implements RechargePaySer
|
||||
* @return String
|
||||
*/
|
||||
private String getProductName(){
|
||||
|
||||
return "余额充值" + getUserRecharge().getPrice() + "元!";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,7 +38,6 @@ import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -250,9 +249,6 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
getCreateOrderRequestVo().setSign(CrmebUtil.getSign(CrmebUtil.objectToMap(getCreateOrderRequestVo()), getSignKey()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 计算价格微信需要以分为单位,所以需要乘以100
|
||||
* @author Mr.Zhang
|
||||
@@ -304,7 +300,6 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
userToken = userTokenService.getTokenByUserId(storeOrder.getUid(), 2);
|
||||
}
|
||||
if (storeOrder.getIsChannel() == 2) {// H5
|
||||
// userTokenService.getByUid(storeOrder.getUid());
|
||||
userToken.setToken("");
|
||||
}
|
||||
|
||||
@@ -378,7 +373,6 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
}
|
||||
|
||||
if (storeOrder.getPaid()) {
|
||||
// throw new CrmebException("订单已支付");
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
@@ -429,6 +423,13 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
}
|
||||
}
|
||||
StoreCombination storeCombination = storeCombinationService.getById(storeOrder.getCombinationId());
|
||||
// 如果拼团人数已满,重新开团
|
||||
if (pinkId > 0) {
|
||||
Integer count = storePinkService.getCountByKid(pinkId);
|
||||
if (count >= storeCombination.getPeople()) {
|
||||
pinkId = 0;
|
||||
}
|
||||
}
|
||||
// 生成拼团表数据
|
||||
StorePink storePink = new StorePink();
|
||||
storePink.setUid(user.getUid());
|
||||
@@ -461,10 +462,8 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
storePink.setStatus(1);
|
||||
storePinkService.save(storePink);
|
||||
// 如果是开团,需要更新订单数据
|
||||
if (storePink.getKId() == 0) {
|
||||
storeOrder.setPinkId(storePink.getId());
|
||||
storeOrderService.updateById(storeOrder);
|
||||
}
|
||||
storeOrder.setPinkId(storePink.getId());
|
||||
storeOrderService.updateById(storeOrder);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
@@ -524,9 +523,6 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
if (ObjectUtil.isNull(userRecharge)) {
|
||||
throw new CrmebException("订单不存在");
|
||||
}
|
||||
// if (userRecharge.getPaid()) {
|
||||
// throw new CrmebException("订单已支付");
|
||||
// }
|
||||
// 获取用户openId
|
||||
// 根据订单支付类型来判断获取公众号openId还是小程序openId
|
||||
UserToken userToken = new UserToken();
|
||||
@@ -619,7 +615,7 @@ public class WeChatPayServiceImpl implements WeChatPayService {
|
||||
* 生成微信查询订单对象
|
||||
* @return
|
||||
*/
|
||||
private Map<String, String> getWxChantQueryPayVo(String no, String appId, String mchId, String orderNo) {
|
||||
private Map<String, String> getWxChantQueryPayVo(String orderNo, String appId, String mchId, String signKey) {
|
||||
Map<String, String> map = CollUtil.newHashMap();
|
||||
map.put("appid", appId);
|
||||
map.put("mch_id", mchId);
|
||||
|
||||
@@ -3,10 +3,12 @@ package com.zbkj.crmeb.seckill.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.front.response.SecKillResponse;
|
||||
import com.zbkj.crmeb.seckill.model.StoreSeckill;
|
||||
import com.zbkj.crmeb.seckill.request.StoreSeckillRequest;
|
||||
import com.zbkj.crmeb.seckill.request.StoreSeckillSearchRequest;
|
||||
import com.zbkj.crmeb.seckill.response.StoreSeckillDetailResponse;
|
||||
import com.zbkj.crmeb.seckill.response.StoreSeckillManagerResponse;
|
||||
import com.zbkj.crmeb.seckill.response.StoreSeckillResponse;
|
||||
import com.zbkj.crmeb.store.request.StoreProductStockRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreProductResponse;
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.zbkj.crmeb.seckill.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.common.CommonResult;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.utils.DateUtil;
|
||||
import com.zbkj.crmeb.seckill.dao.StoreSeckillMangerDao;
|
||||
import com.zbkj.crmeb.seckill.model.StoreSeckillManger;
|
||||
@@ -90,8 +87,6 @@ public class StoreSeckillMangerServiceImpl extends ServiceImpl<StoreSeckillMange
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteLogicById(int id) {
|
||||
// StoreSeckillManger storeSeckillManger = new StoreSeckillManger().setId(id).setIsDel(true);
|
||||
// return dao.updateById(storeSeckillManger) > 0;
|
||||
return dao.deleteById(id) > 0;
|
||||
}
|
||||
|
||||
@@ -192,22 +187,12 @@ public class StoreSeckillMangerServiceImpl extends ServiceImpl<StoreSeckillMange
|
||||
// 对request中的time做分割后赋值给mode中的start和end属性
|
||||
setTimeRangeFromRequest(storeSeckillMangerRequest, storeSeckillManger);
|
||||
List<StoreSeckillManger> existTimes = checkTimeRangeUnique(storeSeckillManger);
|
||||
if(existTimes.size() == 0){
|
||||
return updateByCondition(storeSeckillManger);
|
||||
}
|
||||
// 更新时排除自身更新
|
||||
StoreSeckillManger ssm = existTimes.get(0);
|
||||
// if(ssm.getStartTime().equals(storeSeckillManger.getStartTime())
|
||||
// && ssm.getEndTime().equals(storeSeckillManger.getEndTime())){
|
||||
// return updateByCondition(storeSeckillManger);
|
||||
// // 更新时 时间更改的判断
|
||||
// }else
|
||||
if (!ssm.getStartTime().equals(storeSeckillManger.getStartTime())
|
||||
|| !ssm.getEndTime().equals(storeSeckillManger.getEndTime())){
|
||||
if(existTimes.size() > 1){
|
||||
throw new CrmebException("当前时间段的秒杀配置已存在");
|
||||
}else if(existTimes.size() == 1) {
|
||||
// 判断开始时间 结束时间 是否被包涵
|
||||
LambdaQueryWrapper<StoreSeckillManger> startAndEndExcuseQuery = Wrappers.lambdaQuery();
|
||||
startAndEndExcuseQuery.ge(StoreSeckillManger::getStartTime,storeSeckillManger.getStartTime())
|
||||
.or()
|
||||
.le(StoreSeckillManger::getEndTime,storeSeckillManger.getEndTime());
|
||||
List<StoreSeckillManger> storeSeckillMangers = dao.selectList(startAndEndExcuseQuery);
|
||||
// 时间区间改大 不存在的情况
|
||||
@@ -220,7 +205,7 @@ public class StoreSeckillMangerServiceImpl extends ServiceImpl<StoreSeckillMange
|
||||
throw new CrmebException("当前时间段的秒杀配置已存在");
|
||||
}
|
||||
}else {
|
||||
throw new CrmebException("当前时间段的秒杀配置已存在");
|
||||
return updateByCondition(storeSeckillManger);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -175,16 +175,9 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
StoreProductAttrValueResponse response = new StoreProductAttrValueResponse();
|
||||
BeanUtils.copyProperties(e,response);
|
||||
storeProductAttrValueResponse.add(response);
|
||||
// 设置商品秒杀数量和秒杀剩余数量
|
||||
// int limitNum = 0;
|
||||
// if(null != e.getQuotaShow() && e.getQuotaShow()>= 0 && null != e.getQuota() && e.getQuota()>= 0){
|
||||
// limitNum = e.getQuotaShow() - e.getQuota();
|
||||
// }
|
||||
// storeProductResponse.setLimitLeftNum(limitNum);
|
||||
return e;
|
||||
}).collect(Collectors.toList());
|
||||
storeProductResponse.setAttrValue(storeProductAttrValueResponse);
|
||||
// }
|
||||
// 处理富文本
|
||||
StoreProductDescription sd = storeProductDescriptionService.getOne(
|
||||
new LambdaQueryWrapper<StoreProductDescription>()
|
||||
@@ -354,58 +347,55 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
//轮播图
|
||||
storeProduct.setImages(systemAttachmentService.clearPrefix(storeProduct.getImages()));
|
||||
|
||||
// List<StoreProductAttrValueRequest> storeProductAttrValuesRequest = getStoreProductAttrValueRequests(storeProductRequest);
|
||||
|
||||
productUtils.calcPriceForAttrValuesSeckill(request, storeProduct);
|
||||
int saveCount = dao.updateById(storeProduct);
|
||||
// 对attr表做全量更新,删除原有数据保存现有数据
|
||||
attrService.removeByProductId(request.getId(),Constants.PRODUCT_TYPE_SECKILL);
|
||||
storeProductAttrValueService.removeByProductId(request.getId(),Constants.PRODUCT_TYPE_SECKILL);
|
||||
// if(request.getSpecType()) {
|
||||
request.getAttr().forEach(e->{
|
||||
e.setProductId(request.getId());
|
||||
e.setAttrValues(StringUtils.strip(e.getAttrValues().replace("\"",""),"[]"));
|
||||
e.setType(Constants.PRODUCT_TYPE_SECKILL);
|
||||
});
|
||||
request.getAttr().forEach(e->{
|
||||
e.setProductId(request.getId());
|
||||
e.setAttrValues(StringUtils.strip(e.getAttrValues().replace("\"",""),"[]"));
|
||||
e.setType(Constants.PRODUCT_TYPE_SECKILL);
|
||||
});
|
||||
attrService.saveBatch(request.getAttr());
|
||||
if(null != request.getAttrValue() && request.getAttrValue().size() > 0){
|
||||
List<StoreProductAttrValueRequest> storeProductAttrValuesRequest = request.getAttrValue();
|
||||
// 批量设置attrValues对象的商品id
|
||||
storeProductAttrValuesRequest.forEach(e->e.setProductId(request.getId()));
|
||||
List<StoreProductAttrValue> storeProductAttrValues = new ArrayList<>();
|
||||
for (StoreProductAttrValueRequest attrValuesRequest : storeProductAttrValuesRequest) {
|
||||
StoreProductAttrValue spav = new StoreProductAttrValue();
|
||||
BeanUtils.copyProperties(attrValuesRequest,spav);
|
||||
//设置sku字段
|
||||
if(null != attrValuesRequest.getAttrValue()){
|
||||
List<String> skuList = new ArrayList<>();
|
||||
for(Map.Entry<String,String> vo: attrValuesRequest.getAttrValue().entrySet()){
|
||||
skuList.add(vo.getValue());
|
||||
}
|
||||
spav.setSuk(String.join(",",skuList));
|
||||
if(null != request.getAttrValue() && request.getAttrValue().size() > 0){
|
||||
List<StoreProductAttrValueRequest> storeProductAttrValuesRequest = request.getAttrValue();
|
||||
// 批量设置attrValues对象的商品id
|
||||
storeProductAttrValuesRequest.forEach(e->e.setProductId(request.getId()));
|
||||
List<StoreProductAttrValue> storeProductAttrValues = new ArrayList<>();
|
||||
for (StoreProductAttrValueRequest attrValuesRequest : storeProductAttrValuesRequest) {
|
||||
StoreProductAttrValue spav = new StoreProductAttrValue();
|
||||
BeanUtils.copyProperties(attrValuesRequest,spav);
|
||||
//设置sku字段
|
||||
if(null != attrValuesRequest.getAttrValue()){
|
||||
List<String> skuList = new ArrayList<>();
|
||||
for(Map.Entry<String,String> vo: attrValuesRequest.getAttrValue().entrySet()){
|
||||
skuList.add(vo.getValue());
|
||||
}
|
||||
String attrValue = null;
|
||||
if(null != attrValuesRequest.getAttrValue() && attrValuesRequest.getAttrValue().size() > 0){
|
||||
attrValue = JSON.toJSONString(attrValuesRequest.getAttrValue());
|
||||
}
|
||||
spav.setAttrValue(attrValue);
|
||||
spav.setImage(systemAttachmentService.clearPrefix(spav.getImage()));
|
||||
spav.setType(Constants.PRODUCT_TYPE_SECKILL);
|
||||
spav.setQuotaShow(spav.getQuota());
|
||||
storeProductAttrValues.add(spav);
|
||||
spav.setSuk(String.join(",",skuList));
|
||||
}
|
||||
boolean saveOrUpdateResult = storeProductAttrValueService.saveBatch(storeProductAttrValues);
|
||||
// attrResult整存整取,不做更新
|
||||
storeProductAttrResultService.deleteByProductId(storeProduct.getId(),Constants.PRODUCT_TYPE_SECKILL);
|
||||
StoreProductAttrResult attrResult = new StoreProductAttrResult(
|
||||
0,
|
||||
storeProduct.getId(),
|
||||
systemAttachmentService.clearPrefix(JSON.toJSONString(request.getAttrValue())),
|
||||
DateUtil.getNowTime(),Constants.PRODUCT_TYPE_SECKILL);
|
||||
storeProductAttrResultService.save(attrResult);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("编辑属性详情失败");
|
||||
|
||||
String attrValue = null;
|
||||
if(null != attrValuesRequest.getAttrValue() && attrValuesRequest.getAttrValue().size() > 0){
|
||||
attrValue = JSON.toJSONString(attrValuesRequest.getAttrValue());
|
||||
}
|
||||
spav.setAttrValue(attrValue);
|
||||
spav.setImage(systemAttachmentService.clearPrefix(spav.getImage()));
|
||||
spav.setType(Constants.PRODUCT_TYPE_SECKILL);
|
||||
spav.setQuotaShow(spav.getQuota());
|
||||
storeProductAttrValues.add(spav);
|
||||
}
|
||||
boolean saveOrUpdateResult = storeProductAttrValueService.saveBatch(storeProductAttrValues);
|
||||
// attrResult整存整取,不做更新
|
||||
storeProductAttrResultService.deleteByProductId(storeProduct.getId(),Constants.PRODUCT_TYPE_SECKILL);
|
||||
StoreProductAttrResult attrResult = new StoreProductAttrResult(
|
||||
0,
|
||||
storeProduct.getId(),
|
||||
systemAttachmentService.clearPrefix(JSON.toJSONString(request.getAttrValue())),
|
||||
DateUtil.getNowTime(),Constants.PRODUCT_TYPE_SECKILL);
|
||||
storeProductAttrResultService.save(attrResult);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("编辑属性详情失败");
|
||||
|
||||
}
|
||||
|
||||
// 处理富文本
|
||||
StoreProductDescription spd = new StoreProductDescription(
|
||||
@@ -416,8 +406,6 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
storeProductDescriptionService.deleteByProductId(storeProduct.getId(),Constants.PRODUCT_TYPE_SECKILL);
|
||||
storeProductDescriptionService.save(spd);
|
||||
|
||||
// 处理优惠券关联信息
|
||||
// shipProductCoupons(request, storeProduct);
|
||||
return saveCount > 0;
|
||||
}
|
||||
|
||||
@@ -467,8 +455,6 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
if(null != user && null != user.getUid()){
|
||||
storeInfo.setUserLike(storeProductRelationService.getLikeOrCollectByUser(user.getUid(),productResponse.getProductId(),true).size() > 0);
|
||||
storeInfo.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(),productResponse.getProductId(),false).size() > 0);
|
||||
// user = userService.updateForPromoter(user);
|
||||
// productDetailResponse.setPriceName(getPacketPriceRange(productResponse,user.getIsPromoter()));
|
||||
}else{
|
||||
storeInfo.setUserLike(false);
|
||||
storeInfo.setUserCollect(false);
|
||||
@@ -494,18 +480,6 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
skuMap.put(attrValue.getSuk(),attrValue);
|
||||
}
|
||||
productDetailResponse.setProductValue(skuMap);
|
||||
// // 优品推荐
|
||||
// List<StoreProduct> storeProducts = storeProductService.getRecommendStoreProduct(18);
|
||||
// List<StoreProductRecommendResponse> storeProductRecommendResponses = new ArrayList<>();
|
||||
// for (StoreProduct product:storeProducts) {
|
||||
// StoreProductRecommendResponse sPRecommendResponse = new StoreProductRecommendResponse();
|
||||
// BeanUtils.copyProperties(product,sPRecommendResponse);
|
||||
// sPRecommendResponse.setActivity(null);
|
||||
//// sPRecommendResponse.setCheckCoupon(storeCouponService.getListByUser(product.getId()).size() > 0);
|
||||
// storeProductRecommendResponses.add(sPRecommendResponse);
|
||||
// }
|
||||
// productDetailResponse.setGoodList(storeProductRecommendResponses);
|
||||
|
||||
return productDetailResponse;
|
||||
}
|
||||
|
||||
@@ -548,10 +522,6 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
BeanUtils.copyProperties(storeProductAttrValue,atr);
|
||||
// 单规格秒杀限量数据处理
|
||||
atr.setQuota(storeProductResponse.getQuota());
|
||||
// if(storeProductAttrValuesSkill.size() == 0){ // 初次添加未设置时默认为商品库存
|
||||
// atr.setStock(storeProductResponse.getStock());
|
||||
// atr.setPrice(storeProductResponse.getPrice());
|
||||
// }
|
||||
sPAVResponses.add(atr);
|
||||
}
|
||||
|
||||
@@ -592,7 +562,6 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
*/
|
||||
@Override
|
||||
public HashMap<String,Object> getForH5Index() {
|
||||
// Integer timeSwap = DateUtil.getSecondTimestamp();
|
||||
HashMap<String,Object> result = new HashMap<>();
|
||||
List<SecKillResponse> response = new ArrayList<>();
|
||||
StoreSeckillManger storeSeckillManger = new StoreSeckillManger();
|
||||
@@ -1054,15 +1023,9 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
storeProductService.getByProductId(storeProduct.getProductId());
|
||||
storeProductResponse.setSales(currentSeckillProductInfo.getSales());
|
||||
storeProductResponse.setFicti(currentSeckillProductInfo.getFicti());
|
||||
// if(storeProduct.getSpecType()){
|
||||
StoreProductAttr spaPram = new StoreProductAttr();
|
||||
spaPram.setProductId(skillId).setType(Constants.PRODUCT_TYPE_SECKILL);
|
||||
storeProductResponse.setAttr(attrService.getByEntity(spaPram));
|
||||
// storeProductResponse.setSliderImage(String.join(",",storeProduct.getImages()));
|
||||
// }else{
|
||||
// storeProductResponse.setAttr(new ArrayList<>());
|
||||
// }
|
||||
// List<StoreProductAttrValue> storeProductAttrValues = storeProductAttrValueService.getListByProductId(storeProduct.getId());
|
||||
|
||||
// 注意:数据瓶装步骤:分别查询秒杀和商品本山信息组装sku信息之后,再对比sku属性是否相等来赋值是否秒杀sku信息
|
||||
StoreProductAttrValue spavPramSkill = new StoreProductAttrValue();
|
||||
@@ -1070,11 +1033,6 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
List<StoreProductAttrValue> storeProductAttrValuesSkill = storeProductAttrValueService.getByEntity(spavPramSkill);
|
||||
List<HashMap<String, Object>> attrValuesSkill = genratorSkuInfo(skillId,storeProduct, storeProductAttrValuesSkill, Constants.PRODUCT_TYPE_SECKILL);
|
||||
|
||||
// StoreProductAttrValue spavPramProduct = new StoreProductAttrValue();
|
||||
// spavPramProduct.setProductId(storeProduct.getProductId()).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
// List<StoreProductAttrValue> storeProductAttrValuesProduct = storeProductAttrValueService.getByEntity(spavPramProduct);
|
||||
// List<HashMap<String, Object>> attrValuesProduct = genratorSkuInfo(storeProduct.getProductId(),storeProduct, storeProductAttrValuesProduct, Constants.PRODUCT_TYPE_NORMAL);
|
||||
|
||||
// H5 端用于生成skuList
|
||||
List<StoreProductAttrValueResponse> sPAVResponses = new ArrayList<>();
|
||||
|
||||
@@ -1086,7 +1044,6 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
|
||||
storeProductResponse.setAttrValues(attrValuesSkill);
|
||||
storeProductResponse.setAttrValue(sPAVResponses);
|
||||
// if(null != storeProductAttrResult){
|
||||
StoreProductDescription sd = storeProductDescriptionService.getOne(
|
||||
new LambdaQueryWrapper<StoreProductDescription>()
|
||||
.eq(StoreProductDescription::getProductId, skillId)
|
||||
@@ -1094,7 +1051,6 @@ public class StoreSeckillServiceImpl extends ServiceImpl<StoreSeckillDao, StoreS
|
||||
if(null != sd){
|
||||
storeProductResponse.setContent(null == sd.getDescription()?"":sd.getDescription());
|
||||
}
|
||||
// }
|
||||
return storeProductResponse;
|
||||
}
|
||||
|
||||
|
||||
@@ -93,7 +93,11 @@ public class StoreProductController {
|
||||
public CommonResult<String> delete(@RequestBody @PathVariable Integer id, @RequestParam(value = "type", required = false, defaultValue = "recycle")String type){
|
||||
if(storeProductService.deleteProduct(id, type)){
|
||||
// if(storeProductService.removeById(id)){
|
||||
storeCartService.productStatusNotEnable(id);
|
||||
if (type.equals("recycle")) {
|
||||
storeCartService.productStatusNotEnable(id);
|
||||
} else {
|
||||
storeCartService.productDelete(id);
|
||||
}
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.zbkj.crmeb.store.model;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
@@ -38,6 +40,9 @@ public class StoreProductDescription implements Serializable {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private Integer productId;
|
||||
|
||||
|
||||
@@ -1,11 +0,0 @@
|
||||
package com.zbkj.crmeb.store.request;
|
||||
|
||||
/**
|
||||
* @author stivepeim
|
||||
* @title: StoreProductRelationRequest
|
||||
* @projectName crmeb
|
||||
* @description: TODO
|
||||
* @date 2020/5/2811:35
|
||||
*/
|
||||
public class StoreProductRelationRequest {
|
||||
}
|
||||
@@ -21,8 +21,6 @@ package com.zbkj.crmeb.store.service;
|
||||
|
||||
void complete();
|
||||
|
||||
void takeByUser();
|
||||
|
||||
void deleteByUser();
|
||||
|
||||
void orderPaySuccessAfter();
|
||||
|
||||
@@ -3,15 +3,10 @@ package com.zbkj.crmeb.store.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.CommonPage;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.store.request.RetailShopRequest;
|
||||
import com.zbkj.crmeb.store.request.RetailShopStairUserRequest;
|
||||
import com.zbkj.crmeb.store.response.RetailShopStatisticsResponse;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.response.SpreadUserResponse;
|
||||
import com.zbkj.crmeb.user.response.UserResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 分销业务
|
||||
@@ -36,20 +31,6 @@ public interface RetailShopService extends IService<User> {
|
||||
*/
|
||||
CommonPage<SpreadUserResponse> getSpreadPeopleList(String keywords, String dateLimit, PageParamRequest pageRequest);
|
||||
|
||||
/**
|
||||
* 获取分销头部数据
|
||||
* @param nickName 查询参数
|
||||
* @param dateLimit 时间参数对象
|
||||
*/
|
||||
List<UserResponse> getStatisticsData(String nickName, String dateLimit);
|
||||
|
||||
/**
|
||||
* 统计推广人员列表
|
||||
* @param request 查询参数
|
||||
* @return 推广人员集合列表
|
||||
*/
|
||||
PageInfo<User> getStairUsers(RetailShopStairUserRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 获取分销配置
|
||||
* @return 分销配置信息
|
||||
|
||||
@@ -85,7 +85,7 @@ public interface StoreCartService extends IService<StoreCart> {
|
||||
* @param ids 待删除id
|
||||
* @return 返回删除状态
|
||||
*/
|
||||
boolean deleteCartByIds(List<Integer> ids);
|
||||
boolean deleteCartByIds(List<Long> ids);
|
||||
|
||||
|
||||
/**
|
||||
@@ -107,4 +107,10 @@ public interface StoreCartService extends IService<StoreCart> {
|
||||
* @param skuIdList skuIdList
|
||||
*/
|
||||
Boolean productStatusNoEnable(List<Integer> skuIdList);
|
||||
|
||||
/**
|
||||
* 删除商品对应的购物车
|
||||
* @param productId 商品id
|
||||
*/
|
||||
Boolean productDelete(Integer productId);
|
||||
}
|
||||
|
||||
@@ -18,5 +18,6 @@ import com.zbkj.crmeb.store.request.StoreOrderRefundRequest;
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface StoreOrderRefundService extends IService<StoreOrder> {
|
||||
|
||||
void refund(StoreOrderRefundRequest request, StoreOrder storeOrder);
|
||||
}
|
||||
|
||||
@@ -145,13 +145,6 @@ public interface StoreOrderService extends IService<StoreOrder> {
|
||||
*/
|
||||
boolean editPrice(StoreOrderEditPriceRequest request);
|
||||
|
||||
/**
|
||||
* 确认付款
|
||||
* @param orderId 订单号
|
||||
* @return 确认付款结果
|
||||
*/
|
||||
boolean confirmPayed(String orderId);
|
||||
|
||||
/**
|
||||
* 线下付款
|
||||
* @param orderId 待付款订单id
|
||||
@@ -181,13 +174,6 @@ public interface StoreOrderService extends IService<StoreOrder> {
|
||||
*/
|
||||
List<StoreOrder> getUserCurrentBargainOrders(StoreOrder storeOrder);
|
||||
|
||||
/**
|
||||
* 获取砍价商品订单数量(销量)
|
||||
* @param bargainId 砍价商品编号
|
||||
* @return
|
||||
*/
|
||||
Integer getCountByBargainId(Integer bargainId);
|
||||
|
||||
/**
|
||||
* 获取砍价商品订单数量(销量)
|
||||
* @param bargainId 砍价商品编号
|
||||
|
||||
@@ -21,8 +21,6 @@ public interface StoreOrderTaskService {
|
||||
|
||||
Boolean complete(StoreOrder storeOrder);
|
||||
|
||||
Boolean takeByUser(StoreOrder storeOrder);
|
||||
|
||||
Boolean deleteByUser(StoreOrder storeOrder);
|
||||
|
||||
Boolean refundOrder(StoreOrder storeOrder);
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.zbkj.crmeb.store.service;
|
||||
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.store.request.StoreOrderStaticsticsRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreOrderVerificationConfirmResponse;
|
||||
import com.zbkj.crmeb.store.response.StoreStaffDetail;
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zbkj.crmeb.store.service;
|
||||
|
||||
import com.common.PageParamRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.store.model.StoreProductAttrResult;
|
||||
import com.zbkj.crmeb.store.request.StoreProductAttrResultSearchRequest;
|
||||
|
||||
@@ -25,8 +25,6 @@ public interface StoreProductAttrResultService extends IService<StoreProductAttr
|
||||
|
||||
StoreProductAttrResult getByProductId(int productId);
|
||||
|
||||
Integer updateByProductId(StoreProductAttrResult storeProductAttrResult);
|
||||
|
||||
void deleteByProductId(int productId, int type);
|
||||
|
||||
/**
|
||||
|
||||
@@ -23,10 +23,6 @@ public interface StoreProductAttrService extends IService<StoreProductAttr> {
|
||||
|
||||
List<StoreProductAttr> getList(StoreProductAttrSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
Boolean batchSave(List<StoreProductAttr> storeProductAttrs);
|
||||
|
||||
Boolean batchUpdate(List<StoreProductAttr> storeProductAttrs);
|
||||
|
||||
/**
|
||||
* 根据基本属性查询商品属性详情
|
||||
* @param storeProductAttr 商品属性
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zbkj.crmeb.store.service;
|
||||
|
||||
import com.common.PageParamRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.store.model.StoreProductCate;
|
||||
import com.zbkj.crmeb.store.request.StoreProductCateSearchRequest;
|
||||
|
||||
@@ -25,5 +25,4 @@ public interface StoreProductCateService extends IService<StoreProductCate> {
|
||||
|
||||
List<StoreProductCate> getByProductId(Integer productId);
|
||||
|
||||
// Integer updateByProductId(StoreProductCate storeProductCate);
|
||||
}
|
||||
|
||||
@@ -1,15 +1,13 @@
|
||||
package com.zbkj.crmeb.store.service;
|
||||
|
||||
import com.common.PageParamRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.front.request.UserCollectAllRequest;
|
||||
import com.zbkj.crmeb.front.request.UserCollectRequest;
|
||||
import com.zbkj.crmeb.store.model.StoreProduct;
|
||||
import com.zbkj.crmeb.store.model.StoreProductRelation;
|
||||
import com.zbkj.crmeb.store.request.StoreProductRelationSearchRequest;
|
||||
import com.zbkj.crmeb.store.vo.StoreProductRelationCountVo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -28,10 +26,6 @@ public interface StoreProductRelationService extends IService<StoreProductRelati
|
||||
|
||||
List<StoreProduct> getList(StoreProductRelationSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
HashMap<Integer, Integer> getLikeCountListInProductId(List<Integer> idList);
|
||||
|
||||
HashMap<Integer, Integer> getCollectCountListInProductId(List<Integer> idList);
|
||||
|
||||
List<StoreProductRelation> getList(Integer productId, String type);
|
||||
|
||||
boolean delete(UserCollectRequest request);
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zbkj.crmeb.store.service;
|
||||
|
||||
import com.common.PageParamRequest;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.store.model.StoreProductRule;
|
||||
import com.zbkj.crmeb.store.request.StoreProductRuleRequest;
|
||||
import com.zbkj.crmeb.store.request.StoreProductRuleSearchRequest;
|
||||
|
||||
@@ -145,9 +145,11 @@ public class OrderTaskServiceImpl implements OrderTaskService {
|
||||
// boolean result = storeOrderTaskService.refundApply(storeOrder);
|
||||
boolean result = storeOrderTaskService.refundOrder(storeOrder);
|
||||
if(!result){
|
||||
logger.error("订单退款错误:result = " + result);
|
||||
redisUtil.lPush(redisKey, orderId);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.error("订单退款错误:" + e.getMessage());
|
||||
redisUtil.lPush(redisKey, orderId);
|
||||
}
|
||||
}
|
||||
@@ -184,44 +186,6 @@ public class OrderTaskServiceImpl implements OrderTaskService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户已收货
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-07-09
|
||||
*/
|
||||
@Override
|
||||
public void takeByUser() {
|
||||
String redisKey = Constants.ORDER_TASK_REDIS_KEY_AFTER_TAKE_BY_USER;
|
||||
Long size = redisUtil.getListSize(redisKey);
|
||||
logger.info("OrderTaskServiceImpl.takeByUser | size:" + size);
|
||||
if(size < 1){
|
||||
return;
|
||||
}
|
||||
for (int i = 0; i < size; i++) {
|
||||
//如果10秒钟拿不到一个数据,那么退出循环
|
||||
Object id = redisUtil.getRightPop(redisKey, 10L);
|
||||
if(null == id){
|
||||
continue;
|
||||
}
|
||||
try{
|
||||
StoreOrder storeOrder = storeOrderService.getByEntityOne(new StoreOrder().setId(Integer.valueOf(id.toString())));
|
||||
boolean result = storeOrderTaskService.takeByUser(storeOrder);
|
||||
if(!result){
|
||||
redisUtil.lPush(redisKey, id);
|
||||
}else{
|
||||
// 微信小程序订阅消息通知 确认收货
|
||||
WechatSendMessageForGetPackage getPackage = new WechatSendMessageForGetPackage(
|
||||
orderUtils.getPayTypeStrByOrder(storeOrder),orderUtils.getStoreNameAndCarNumString(storeOrder.getId()),
|
||||
"CRMEB",storeOrder.getUserAddress(), DateUtil.nowDateTimeStr(),storeOrder.getOrderId()
|
||||
);
|
||||
wechatSendMessageForMinService.sendGetPackageMessage(getPackage, storeOrder.getUid());
|
||||
}
|
||||
}catch (Exception e){
|
||||
redisUtil.lPush(redisKey, id);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户删除订单
|
||||
* @author Mr.Zhang
|
||||
|
||||
@@ -13,7 +13,6 @@ import com.zbkj.crmeb.finance.response.UserExtractResponse;
|
||||
import com.zbkj.crmeb.finance.service.UserExtractService;
|
||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.store.request.RetailShopRequest;
|
||||
import com.zbkj.crmeb.store.request.RetailShopStairUserRequest;
|
||||
import com.zbkj.crmeb.store.response.RetailShopStatisticsResponse;
|
||||
import com.zbkj.crmeb.store.service.RetailShopService;
|
||||
import com.zbkj.crmeb.store.service.StoreOrderService;
|
||||
@@ -21,10 +20,7 @@ import com.zbkj.crmeb.system.service.SystemConfigService;
|
||||
import com.zbkj.crmeb.user.dao.UserDao;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.model.UserBrokerageRecord;
|
||||
import com.zbkj.crmeb.user.request.UserSearchRequest;
|
||||
import com.zbkj.crmeb.user.response.SpreadUserResponse;
|
||||
import com.zbkj.crmeb.user.response.UserResponse;
|
||||
import com.zbkj.crmeb.user.service.UserBillService;
|
||||
import com.zbkj.crmeb.user.service.UserBrokerageRecordService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -61,9 +57,6 @@ public class RetailShopServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
@Autowired
|
||||
private UserBillService userBillService;
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@@ -136,35 +129,6 @@ public class RetailShopServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
return CommonPage.restPage(responsePageInfo);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分销头部数据
|
||||
* @param nickName 查询参数
|
||||
* @param dateLimit 时间参数对象
|
||||
*/
|
||||
@Override
|
||||
public List<UserResponse> getStatisticsData(String nickName, String dateLimit) {
|
||||
UserSearchRequest request = new UserSearchRequest();
|
||||
request.setIsPromoter(true);
|
||||
request.setDateLimit(dateLimit);
|
||||
request.setKeywords(nickName);
|
||||
|
||||
PageParamRequest pageParamRequest = new PageParamRequest();
|
||||
pageParamRequest.setLimit(1);
|
||||
|
||||
PageInfo<UserResponse> list = userService.getList(request, pageParamRequest);
|
||||
return list.getList();
|
||||
}
|
||||
|
||||
/**
|
||||
* 统计推广人员列表
|
||||
* @param request 查询参数
|
||||
* @return 推广人员集合列表
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<User> getStairUsers(RetailShopStairUserRequest request, PageParamRequest pageParamRequest) {
|
||||
return userService.getUserListBySpreadLevel(request, pageParamRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分销配置信息
|
||||
* @return 返回配置信息
|
||||
@@ -180,7 +144,6 @@ public class RetailShopServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
response.setUserExtractMinPrice(new BigDecimal(systemConfigService.getValueByKey(keys.get(4))));
|
||||
response.setUserExtractBank(systemConfigService.getValueByKey(keys.get(5)).replace("\\n","\n"));
|
||||
response.setExtractTime(Integer.parseInt(systemConfigService.getValueByKey(keys.get(6))));
|
||||
// response.setStoreBrokeragePrice(new BigDecimal(systemConfigService.getValueByKey(keys.get(7))));
|
||||
response.setBrokerageBindind(systemConfigService.getValueByKey(keys.get(7)));
|
||||
return response;
|
||||
}
|
||||
|
||||
@@ -189,7 +189,6 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
||||
LambdaQueryWrapper<StoreCart> lqwStoreList = new LambdaQueryWrapper<>();
|
||||
lqwStoreList.eq(StoreCart::getUid,userId);
|
||||
lqwStoreList.eq(StoreCart::getType, "product");
|
||||
// lqwStoreList.eq(StoreCart::getI)
|
||||
lqwStoreList.in(StoreCart::getId,cartIds);
|
||||
lqwStoreList.orderByDesc(StoreCart::getCreateTime);
|
||||
return dao.selectList(lqwStoreList);
|
||||
@@ -298,7 +297,6 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
||||
@Override
|
||||
public BigDecimal setVipPrice(BigDecimal price, Integer userId, boolean isSingle) {
|
||||
// 判断会员功能是否开启
|
||||
// Integer memberFuncStatus = Integer.valueOf(systemConfigService.getValueByKey("member_func_status"));
|
||||
Integer memberFuncStatus = Integer.valueOf(systemConfigService.getValueByKey("vip_open"));
|
||||
if(memberFuncStatus <= 0){
|
||||
return price;
|
||||
@@ -320,7 +318,7 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
||||
* @return 删除结果状态
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteCartByIds(List<Integer> ids) {
|
||||
public boolean deleteCartByIds(List<Long> ids) {
|
||||
return dao.deleteBatchIds(ids) > 0;
|
||||
}
|
||||
|
||||
@@ -389,6 +387,23 @@ public class StoreCartServiceImpl extends ServiceImpl<StoreCartDao, StoreCart> i
|
||||
return update(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除商品对应的购物车
|
||||
* @param productId 商品id
|
||||
*/
|
||||
@Override
|
||||
public Boolean productDelete(Integer productId) {
|
||||
StoreCart storeCartPram = new StoreCart();
|
||||
storeCartPram.setProductId(productId);
|
||||
List<StoreCart> existStoreCartProducts = getByEntity(storeCartPram);
|
||||
if(null == existStoreCartProducts || existStoreCartProducts.size()==0) return true;
|
||||
List<Long> cartIds = existStoreCartProducts.stream().map(StoreCart::getId).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(cartIds)) {
|
||||
deleteCartByIds(cartIds);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////自定义方法
|
||||
/**
|
||||
* 购物车商品种类数量
|
||||
|
||||
@@ -1,25 +1,21 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.zbkj.crmeb.store.model.StoreOrderInfo;
|
||||
import com.zbkj.crmeb.store.dao.StoreOrderInfoDao;
|
||||
import com.zbkj.crmeb.store.model.StoreOrderInfo;
|
||||
import com.zbkj.crmeb.store.request.StoreOrderInfoSearchRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreCartResponse;
|
||||
import com.zbkj.crmeb.store.service.StoreOrderInfoService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zbkj.crmeb.store.service.StoreProductReplyService;
|
||||
import com.zbkj.crmeb.store.vo.StoreOrderInfoVo;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
|
||||
@@ -56,30 +56,6 @@ public class StoreOrderRefundServiceImpl extends ServiceImpl<StoreOrderDao, Stor
|
||||
refundWx(request, storeOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 小程序退款
|
||||
* @param request
|
||||
* @param storeOrder
|
||||
*/
|
||||
private void refundMiniWx(StoreOrderRefundRequest request, StoreOrder storeOrder) {
|
||||
WxRefundVo wxRefundVo = new WxRefundVo();
|
||||
|
||||
String appId = systemConfigService.getValueByKeyException(Constants.CONFIG_KEY_PAY_ROUTINE_APP_ID);
|
||||
String mchId = systemConfigService.getValueByKey(Constants.CONFIG_KEY_PAY_ROUTINE_MCH_ID);
|
||||
wxRefundVo.setAppid(appId);
|
||||
wxRefundVo.setMch_id(mchId);
|
||||
wxRefundVo.setNonce_str(DigestUtils.md5Hex(CrmebUtil.getUuid() + CrmebUtil.randomCount(111111, 666666)));
|
||||
wxRefundVo.setOut_trade_no(storeOrder.getOrderId());
|
||||
wxRefundVo.setOut_refund_no(storeOrder.getOrderId());
|
||||
wxRefundVo.setTotal_fee(storeOrder.getPayPrice().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue());
|
||||
wxRefundVo.setRefund_fee(request.getAmount().multiply(BigDecimal.TEN).multiply(BigDecimal.TEN).intValue());
|
||||
String signKey = systemConfigService.getValueByKey(Constants.CONFIG_KEY_PAY_WE_CHAT_APP_KEY);
|
||||
String sign = CrmebUtil.getSign(CrmebUtil.objectToMap(wxRefundVo), signKey);
|
||||
wxRefundVo.setSign(sign);
|
||||
String path = systemConfigService.getValueByKeyException("pay_mini_client_p12");
|
||||
commonRefound(wxRefundVo, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共号退款
|
||||
* @param request
|
||||
|
||||
@@ -29,7 +29,6 @@ import com.zbkj.crmeb.express.service.ExpressService;
|
||||
import com.zbkj.crmeb.express.service.LogisticService;
|
||||
import com.zbkj.crmeb.express.vo.ExpressSheetVo;
|
||||
import com.zbkj.crmeb.express.vo.LogisticsResultVo;
|
||||
import com.zbkj.crmeb.finance.request.FundsMonitorSearchRequest;
|
||||
import com.zbkj.crmeb.front.vo.OrderAgainVo;
|
||||
import com.zbkj.crmeb.pass.service.OnePassService;
|
||||
import com.zbkj.crmeb.payment.service.OrderPayService;
|
||||
@@ -320,7 +319,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
StoreOrder existOrder = getByEntityOne(storeOrderPram);
|
||||
if(null == existOrder) throw new CrmebException("订单不存在");
|
||||
OrderAgainVo orderAgainVo = orderUtils.tidyOrder(existOrder, true, false);
|
||||
// Long cacheKey = DateUtil.getTime()+userId;
|
||||
List<StoreCartResponse> orderAgainCache = new ArrayList<>();
|
||||
for (StoreOrderInfoVo so : orderAgainVo.getCartInfo()) {
|
||||
// 判断商品是否有效
|
||||
@@ -344,7 +342,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
// 添加有效商品至缓存 缓存为购物车对象
|
||||
if(isNew){
|
||||
StoreCartResponse storeCartResponse = new StoreCartResponse();
|
||||
// storeCartResponse.setId(cacheKey);
|
||||
storeCartResponse.setType(type);
|
||||
storeCartResponse.setProductId(productId);
|
||||
storeCartResponse.setProductAttrUnique(so.getUnique());
|
||||
@@ -355,7 +352,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
storeCartResponse.setProductInfo(spcpInfo);
|
||||
storeCartResponse.setTrueStock(storeCartResponse.getProductInfo().getAttrInfo().getStock());
|
||||
storeCartResponse.setCostPrice(storeCartResponse.getProductInfo().getAttrInfo().getCost());
|
||||
// storeCartResponse.setTruePrice(BigDecimal.ZERO);
|
||||
storeCartResponse.setTruePrice(existSPAttrValue.getPrice());
|
||||
storeCartResponse.setVipTruePrice(BigDecimal.ZERO);
|
||||
orderAgainCache.add(storeCartResponse);
|
||||
@@ -459,35 +455,10 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
if(currentUser.getNowMoney().compareTo(storeOrder.getPayPrice()) < 0){// 支持0元购
|
||||
throw new CrmebException("余额不足");
|
||||
}
|
||||
// BigDecimal priceSubtract = currentUser.getNowMoney().subtract(storeOrder.getPayPrice());
|
||||
// UserBill userBill = new UserBill();
|
||||
// userBill.setTitle("购买商品");
|
||||
// userBill.setUid(currentUser.getUid());
|
||||
// userBill.setCategory(Constants.USER_BILL_CATEGORY_MONEY);
|
||||
// userBill.setType(Constants.USER_BILL_TYPE_PAY_PRODUCT);
|
||||
// userBill.setNumber(storeOrder.getPayPrice());
|
||||
// userBill.setLinkId(storeOrder.getId()+"");
|
||||
// userBill.setBalance(currentUser.getNowMoney());
|
||||
// userBill.setMark("余额支付" + storeOrder.getPayPrice() + "元购买商品");
|
||||
|
||||
UserToken userToken = userTokenService.getByUid(currentUser.getUid());
|
||||
|
||||
Boolean execute = orderPayService.paySuccess(storeOrder);
|
||||
// Boolean execute = transactionTemplate.execute(e -> {
|
||||
// userService.updateNowMoney(currentUser.getUid(), priceSubtract);
|
||||
// userBillService.save(userBill);
|
||||
// paySuccess(storeOrder, currentUser, formId);
|
||||
// return Boolean.TRUE;
|
||||
// });
|
||||
|
||||
// 微信小程序订阅消息 付款成功
|
||||
// String storeNameAndCarNumString = orderUtils.getStoreNameAndCarNumString(storeOrder.getId());
|
||||
// if(StringUtils.isNotBlank(storeNameAndCarNumString)){
|
||||
// WechatSendMessageForPaySuccess paySuccess = new WechatSendMessageForPaySuccess(
|
||||
// storeOrder.getOrderId(),storeOrder.getPayPrice()+"",storeOrder.getPayTime()+"","暂无",
|
||||
// storeOrder.getTotalPrice()+"",storeNameAndCarNumString);
|
||||
// orderUtils.sendWeiChatMiniMessageForPaySuccess(paySuccess, currentUser.getUid());
|
||||
// }
|
||||
return execute;
|
||||
}
|
||||
|
||||
@@ -834,16 +805,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
temMap.put("keyword3", DateUtil.dateToStr(storeOrder.getCreateTime(), Constants.DATE_FORMAT));
|
||||
temMap.put(Constants.WE_CHAT_TEMP_KEY_END, "感谢你的使用。");
|
||||
pushMessageRefundOrder(storeOrder, user, temMap);
|
||||
// // 小程序订阅消息 退款成功
|
||||
// String storeNameAndCarNumString = orderUtils.getStoreNameAndCarNumString(storeOrder.getId());
|
||||
// WechatSendMessageForReFundEd forReFundEd = new WechatSendMessageForReFundEd(
|
||||
// "退款成功",storeNameAndCarNumString,request.getAmount()+"",DateUtil.nowDateTimeStr(),"退款金额已到余额中",
|
||||
// storeOrder.getOrderId(),storeOrder.getId()+"",storeOrder.getCreateTime()+"",storeOrder.getRefundPrice()+"",
|
||||
// storeNameAndCarNumString,storeOrder.getRefundReason(),"CRMEB",storeOrder.getRefundReasonWapExplain(),
|
||||
// "暂无"
|
||||
// );
|
||||
// wechatSendMessageForMinService.sendReFundEdMessage(forReFundEd, userService.getUserIdException());
|
||||
|
||||
return execute;
|
||||
}
|
||||
|
||||
@@ -927,11 +888,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
switch (request.getType()){
|
||||
case "1":// 发货
|
||||
express(request, storeOrder);
|
||||
// orderUtils.sendWeiChatMiniMessageForPackageExpress(storeOrder,currentAdmin.getId());
|
||||
break;
|
||||
case "2":// 送货
|
||||
delivery(request, storeOrder);
|
||||
// orderUtils.senWeiChatMiniMessageForDeliver(storeOrder,currentAdmin.getId());
|
||||
break;
|
||||
case "3":// 虚拟
|
||||
virtual(request, storeOrder);
|
||||
@@ -940,8 +899,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
throw new CrmebException("类型错误");
|
||||
}
|
||||
|
||||
//短信发送
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -1166,19 +1123,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
return update(luw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 确认付款
|
||||
*
|
||||
* @param orderId 订单号
|
||||
* @return 确认付款结果
|
||||
*/
|
||||
@Override
|
||||
public boolean confirmPayed(String orderId) {
|
||||
StoreOrder existOrder = getByEntityOne(new StoreOrder().setOrderId(orderId));
|
||||
if(null == existOrder) throw new CrmebException(Constants.RESULT_ORDER_NOTFOUND.replace("${orderCode}", orderId));
|
||||
return payOrderOffLine(existOrder.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 线下付款
|
||||
*
|
||||
@@ -1286,21 +1230,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取砍价商品订单数量(销量)
|
||||
* 用户砍价成功支付订单数量
|
||||
* @param bargainId 砍价商品编号
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Integer getCountByBargainId(Integer bargainId) {
|
||||
LambdaQueryWrapper<StoreOrder> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StoreOrder::getBargainId, bargainId);
|
||||
lqw.eq(StoreOrder::getPaid, true);
|
||||
lqw.eq(StoreOrder::getRefundStatus, 0);
|
||||
return dao.selectCount(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取砍价商品订单数量(销量)
|
||||
* 用户砍价成功支付订单数量
|
||||
@@ -1423,7 +1352,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
lqw.eq(StoreOrder::getUid, userId);
|
||||
lqw.eq(StoreOrder::getPaid, true);
|
||||
lqw.eq(StoreOrder::getIsDel, false);
|
||||
// lqw.in(StoreOrder::getRefundStatus, 0, 1);
|
||||
lqw.orderByDesc(StoreOrder::getId);
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
@@ -1441,59 +1369,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/** 退款扣除积分/余额
|
||||
* @param request StoreOrderRefundRequest 退款参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-10
|
||||
*/
|
||||
private void subtractBill(StoreOrderRefundRequest request, String category, String type, String foundsType) {
|
||||
try{
|
||||
FundsMonitorSearchRequest fundsMonitorSearchRequest = new FundsMonitorSearchRequest();
|
||||
fundsMonitorSearchRequest.setCategory(category);
|
||||
fundsMonitorSearchRequest.setType(type);
|
||||
fundsMonitorSearchRequest.setLinkId(request.getOrderId().toString());
|
||||
fundsMonitorSearchRequest.setPm(1);
|
||||
|
||||
PageParamRequest pageParamRequest = new PageParamRequest();
|
||||
pageParamRequest.setLimit(Constants.EXPORT_MAX_LIMIT);
|
||||
List<UserBill> list = userBillService.getList(fundsMonitorSearchRequest, pageParamRequest);
|
||||
|
||||
if(null == list || list.size() < 1){
|
||||
return;
|
||||
}
|
||||
|
||||
for (UserBill userBill : list) {
|
||||
User user = userService.getById(userBill.getUid());
|
||||
if(null == user){
|
||||
continue;
|
||||
}
|
||||
BigDecimal price;
|
||||
if(category.equals(Constants.USER_BILL_CATEGORY_INTEGRAL)){
|
||||
price = new BigDecimal(user.getIntegral());
|
||||
}else{
|
||||
price = user.getBrokeragePrice();
|
||||
}
|
||||
|
||||
if(userBill.getNumber().compareTo(price) > 0){
|
||||
userBill.setNumber(price);
|
||||
//更新佣金
|
||||
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
|
||||
userOperateFundsRequest.setUid(user.getUid());
|
||||
userOperateFundsRequest.setValue(request.getAmount());
|
||||
userOperateFundsRequest.setFoundsType(foundsType);
|
||||
userOperateFundsRequest.setType(0);
|
||||
userService.updateFounds(userOperateFundsRequest, false); //更新佣金/积分
|
||||
if(category.equals(Constants.USER_BILL_CATEGORY_INTEGRAL)){
|
||||
userBillService.saveRefundIntegralBill(request, user);
|
||||
}else{
|
||||
userBillService.saveRefundBrokeragePriceBill(request, user);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
throw new CrmebException("更新退款佣金/积分失败");
|
||||
}
|
||||
}
|
||||
|
||||
/** 发货
|
||||
* @param id Integer id
|
||||
@@ -1509,7 +1384,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
return info;
|
||||
}
|
||||
|
||||
|
||||
/** 快递
|
||||
* @param request StoreOrderSendRequest 发货参数
|
||||
* @param storeOrder StoreOrder 订单信息
|
||||
@@ -1561,15 +1435,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
|
||||
// 发送消息通知
|
||||
pushMessageOrder(storeOrder, user);
|
||||
|
||||
// //微信模板消息发送
|
||||
// HashMap<String, String> map = new HashMap<>();
|
||||
// map.put(Constants.WE_CHAT_TEMP_KEY_FIRST, "订单发货提醒");
|
||||
// map.put("keyword1", storeOrder.getOrderId());
|
||||
// map.put("keyword2", storeOrder.getDeliveryName());
|
||||
// map.put("keyword3", storeOrder.getDeliveryId());
|
||||
// map.put(Constants.WE_CHAT_TEMP_KEY_END, "欢迎再次购买!");
|
||||
// templateMessageService.push(Constants.WE_CHAT_TEMP_KEY_EXPRESS, map, storeOrder.getUid(), Constants.PAY_TYPE_WE_CHAT_FROM_PUBLIC);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1678,7 +1543,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
if (StrUtil.isBlank(request.getExpressNumber())) throw new CrmebException("请填写快递单号");
|
||||
return;
|
||||
}
|
||||
// if (StrUtil.isBlank(request.getExpressName())) throw new CrmebException("请选择快递公司");
|
||||
if (StrUtil.isBlank(request.getExpressCode())) throw new CrmebException("请选择快递公司");
|
||||
if (StrUtil.isBlank(request.getExpressRecordType())) throw new CrmebException("请选择发货记录类型");
|
||||
if (StrUtil.isBlank(request.getExpressTempId())) throw new CrmebException("请选择电子面单");
|
||||
@@ -1779,13 +1643,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
map.put("name4", request.getDeliveryName());
|
||||
map.put("phone_number10", request.getDeliveryTel());
|
||||
templateMessageService.pushMiniTemplateMessage(Constants.WE_CHAT_PROGRAM_TEMP_KEY_DELIVERY, map, userToken.getToken());
|
||||
// String storeNameAndCarNumString = orderUtils.getStoreNameAndCarNumString(storeOrder.getId());
|
||||
// if(StringUtils.isNotBlank(storeNameAndCarNumString)){
|
||||
// WechatSendMessageForPaySuccess paySuccess = new WechatSendMessageForPaySuccess(
|
||||
// storeOrder.getId()+"",storeOrder.getPayPrice()+"",storeOrder.getPayTime()+"","暂无",
|
||||
// storeOrder.getTotalPrice()+"",storeNameAndCarNumString);
|
||||
// orderUtils.sendWeiChatMiniMessageForPaySuccess(paySuccess, userService.getById(storeOrder).getUid());
|
||||
// }
|
||||
}
|
||||
|
||||
/** 虚拟
|
||||
@@ -1806,7 +1663,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) throw new CrmebException("虚拟物品发货失败");
|
||||
//微信模板消息发送
|
||||
}
|
||||
/**
|
||||
* 支付成功操作
|
||||
@@ -2120,34 +1976,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
map.put("value", Constants.ORDER_STATUS_STR_REFUNDED);
|
||||
}
|
||||
|
||||
// //未发货
|
||||
// if(storeOrder.getPaid()
|
||||
// && storeOrder.getStatus() == 0
|
||||
// && !storeOrder.getIsDel()
|
||||
// && !storeOrder.getIsSystemDel()){
|
||||
// map.put("key", Constants.ORDER_STATUS_NOT_SHIPPED);
|
||||
// map.put("value", Constants.ORDER_STATUS_STR_NOT_SHIPPED);
|
||||
// }
|
||||
|
||||
// //待收货
|
||||
// if(storeOrder.getPaid()
|
||||
// && storeOrder.getStatus() == 1
|
||||
// && !storeOrder.getIsDel()
|
||||
// && !storeOrder.getIsSystemDel()){
|
||||
// map.put("key", Constants.ORDER_STATUS_SPIKE);
|
||||
// map.put("value", Constants.ORDER_STATUS_STR_SPIKE);
|
||||
// }
|
||||
|
||||
// //用户已收货
|
||||
// if(storeOrder.getPaid()
|
||||
// && storeOrder.getStatus() == 2
|
||||
// && !storeOrder.getIsDel()
|
||||
// && !storeOrder.getIsSystemDel()){
|
||||
// map.put("key", Constants.ORDER_STATUS_COMPLETE);
|
||||
// map.put("value", Constants.ORDER_STATUS_STR_TAKE);
|
||||
// }
|
||||
|
||||
|
||||
//已删除
|
||||
if(storeOrder.getIsDel() || storeOrder.getIsSystemDel()){
|
||||
map.put("key", Constants.ORDER_STATUS_DELETED);
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.utils.DateUtil;
|
||||
import com.zbkj.crmeb.store.model.StoreOrderStatus;
|
||||
import com.zbkj.crmeb.store.dao.StoreOrderStatusDao;
|
||||
import com.zbkj.crmeb.store.model.StoreOrderStatus;
|
||||
import com.zbkj.crmeb.store.request.StoreOrderStatusSearchRequest;
|
||||
import com.zbkj.crmeb.store.service.StoreOrderStatusService;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -39,7 +37,6 @@ public class StoreOrderStatusServiceImpl extends ServiceImpl<StoreOrderStatusDao
|
||||
@Resource
|
||||
private StoreOrderStatusDao dao;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param request 请求参数
|
||||
|
||||
@@ -6,7 +6,6 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.common.MyRecord;
|
||||
import com.constants.BrokerageRecordConstants;
|
||||
import com.constants.Constants;
|
||||
import com.constants.SmsConstants;
|
||||
@@ -18,7 +17,6 @@ import com.zbkj.crmeb.bargain.service.StoreBargainService;
|
||||
import com.zbkj.crmeb.combination.model.StorePink;
|
||||
import com.zbkj.crmeb.combination.service.StoreCombinationService;
|
||||
import com.zbkj.crmeb.combination.service.StorePinkService;
|
||||
import com.zbkj.crmeb.marketing.service.StoreCouponUserService;
|
||||
import com.zbkj.crmeb.payment.service.OrderPayService;
|
||||
import com.zbkj.crmeb.seckill.service.StoreSeckillService;
|
||||
import com.zbkj.crmeb.sms.service.SmsService;
|
||||
@@ -40,7 +38,6 @@ import com.zbkj.crmeb.user.service.UserBrokerageRecordService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import com.zbkj.crmeb.user.service.UserTokenService;
|
||||
import com.zbkj.crmeb.wechat.service.TemplateMessageService;
|
||||
import com.zbkj.crmeb.wechat.vo.WechatSendMessageForPaySuccess;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
@@ -86,9 +83,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private StoreCouponUserService couponUserService;
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@@ -107,9 +101,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
@Autowired
|
||||
private UserBillService userBillService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductAttrValueService storeProductAttrValueService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
@@ -187,30 +178,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户已收货
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-07-09
|
||||
*/
|
||||
@Override
|
||||
public Boolean takeByUser(StoreOrder storeOrder) {
|
||||
/*
|
||||
* 1、写订单日志
|
||||
* 2、获得佣金
|
||||
* */
|
||||
try{
|
||||
//日志
|
||||
storeOrderStatusService.createLog(storeOrder.getId(), "user_take_delivery", Constants.ORDER_STATUS_STR_TAKE);
|
||||
|
||||
//获得佣金
|
||||
setBrokeragePrice(storeOrder, 1);
|
||||
|
||||
return true;
|
||||
}catch (Exception e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得经验
|
||||
* @param storeOrder StoreOrder 订单信息
|
||||
@@ -548,7 +515,7 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
stockRequest.setNum(orderInfoVo.getInfo().getCartNum());
|
||||
storeBargainService.stockAddRedis(stockRequest);
|
||||
}
|
||||
} if (ObjectUtil.isNotNull(storeOrder.getCombinationId()) && storeOrder.getCombinationId() > 0) { // 拼团商品回滚销量库存
|
||||
} else if (ObjectUtil.isNotNull(storeOrder.getCombinationId()) && storeOrder.getCombinationId() > 0) { // 拼团商品回滚销量库存
|
||||
for (StoreOrderInfoVo orderInfoVo : orderInfoVoList) {
|
||||
StoreProductStockRequest stockRequest = new StoreProductStockRequest();
|
||||
stockRequest.setCombinationId(orderInfoVo.getInfo().getCombinationId());
|
||||
@@ -607,15 +574,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 回滚优惠券
|
||||
* @param storeOrder 订单信息
|
||||
*/
|
||||
private void rollbackCoupon(StoreOrder storeOrder){
|
||||
//回滚用户已使用的优惠券
|
||||
couponUserService.rollbackByCancelOrder(storeOrder);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款处理
|
||||
* 退款得时候根据userBill 来进行回滚
|
||||
@@ -656,7 +614,8 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
userBill.setTitle(Constants.ORDER_STATUS_STR_REFUNDED);
|
||||
userBill.setPm(0);
|
||||
userBill.setType(Constants.USER_BILL_TYPE_PAY_PRODUCT_REFUND);
|
||||
userBill.setBalance(new BigDecimal(user.getExperience()));
|
||||
userBill.setNumber(bill.getNumber());
|
||||
userBill.setBalance(new BigDecimal(user.getExperience()).setScale(2));
|
||||
userBill.setMark(StrUtil.format("订单退款,扣除{}赠送经验", bill.getNumber().intValue()));
|
||||
userBill.setStatus(1);
|
||||
userBillList.add(userBill);
|
||||
@@ -669,22 +628,24 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
BeanUtils.copyProperties(bill, userBill);
|
||||
if (bill.getPm() == 0) {// 返还用户使用的积分
|
||||
user.setIntegral(user.getIntegral() + bill.getNumber().intValue());
|
||||
userBill.setNumber(bill.getNumber());
|
||||
userBill.setId(null);
|
||||
userBill.setTitle(Constants.ORDER_STATUS_STR_REFUNDED);
|
||||
userBill.setPm(1);
|
||||
userBill.setType(Constants.USER_BILL_TYPE_PAY_PRODUCT_REFUND);
|
||||
userBill.setBalance(new BigDecimal(user.getIntegral()));
|
||||
userBill.setBalance(new BigDecimal(user.getIntegral()).setScale(2));
|
||||
userBill.setMark(StrUtil.format("订单退款,返还{}支付扣除积分", bill.getNumber().intValue()));
|
||||
userBill.setStatus(1);
|
||||
userBillList.add(userBill);
|
||||
}
|
||||
if (bill.getPm() == 1) {// 回滚之前获得的积分
|
||||
user.setIntegral(user.getIntegral() - bill.getNumber().intValue());
|
||||
userBill.setNumber(bill.getNumber());
|
||||
userBill.setId(null);
|
||||
userBill.setTitle(Constants.ORDER_STATUS_STR_REFUNDED);
|
||||
userBill.setPm(0);
|
||||
userBill.setType(Constants.USER_BILL_TYPE_PAY_PRODUCT_REFUND);
|
||||
userBill.setBalance(new BigDecimal(user.getIntegral()));
|
||||
userBill.setBalance(new BigDecimal(user.getIntegral()).setScale(2));
|
||||
userBill.setMark(StrUtil.format("订单退款,扣除{}订单赠送积分", bill.getNumber().intValue()));
|
||||
userBill.setStatus(1);
|
||||
userBillList.add(userBill);
|
||||
@@ -708,6 +669,7 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
});
|
||||
}
|
||||
|
||||
System.out.println("退款task userBillList = " + userBillList);
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
//写订单日志
|
||||
storeOrderStatusService.saveRefund(storeOrder.getId(), storeOrder.getRefundPrice(), "成功");
|
||||
@@ -722,7 +684,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
if (CollUtil.isNotEmpty(brokerageRecordList)) {
|
||||
userBrokerageRecordService.updateBatchById(brokerageRecordList);
|
||||
}
|
||||
// rollbackBrokeragePrice(storeOrder);
|
||||
|
||||
// 回滚库存
|
||||
rollbackStock(storeOrder);
|
||||
@@ -739,10 +700,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
|
||||
if (execute) {
|
||||
// 发送通知
|
||||
}
|
||||
|
||||
return execute;
|
||||
}
|
||||
|
||||
@@ -791,30 +748,6 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
if (execute) {
|
||||
// 回滚库存
|
||||
rollbackStock(storeOrder);
|
||||
/*// 查找出商品详情
|
||||
List<StoreOrderInfoVo> orderInfoVoList = storeOrderInfoService.getOrderListByOrderId(storeOrder.getId());
|
||||
if(null == orderInfoVoList || orderInfoVoList.size() < 1){
|
||||
logger.error("自动取消未付款订单式,未找到对应的订单商品详情,orderNo===" + storeOrder.getOrderId());
|
||||
return true;
|
||||
}
|
||||
if (storeOrder.getSeckillId() > 0) {// 秒杀回滚
|
||||
StoreOrderInfoVo storeOrderInfoVo = orderInfoVoList.get(0);
|
||||
// 秒杀商品回滚库存
|
||||
storeSeckillService.operationStock(storeOrderInfoVo.getInfo().getSeckillId(), storeOrderInfoVo.getInfo().getCartNum(), "add");
|
||||
// 秒杀商品规格回滚库存
|
||||
storeProductAttrValueService.operationStock(Integer.valueOf(storeOrderInfoVo.getInfo().getProductAttrUnique()), storeOrderInfoVo.getInfo().getCartNum(), "add", Constants.PRODUCT_TYPE_SECKILL);
|
||||
// 普通商品回滚库存
|
||||
storeProductService.operationStock(storeOrderInfoVo.getProductId(), storeOrderInfoVo.getInfo().getCartNum(), "add");
|
||||
// 普通商品规格回滚库存
|
||||
storeProductAttrValueService.operationStock(skuRecord.getInt("attrValueId"), storeOrderInfoVo.getInfo().getCartNum(), "add", Constants.PRODUCT_TYPE_NORMAL);
|
||||
}
|
||||
if (storeOrder.getBargainId() > 0) {// 砍价回滚
|
||||
|
||||
}
|
||||
if (storeOrder.getCombinationId() > 0) {// 拼团回滚
|
||||
|
||||
}
|
||||
// 普通回滚*/
|
||||
}
|
||||
return execute;
|
||||
}
|
||||
@@ -930,131 +863,4 @@ public class StoreOrderTaskServiceImpl implements StoreOrderTaskService {
|
||||
temMap.put("thing5", "您购买的商品已确认收货!");
|
||||
templateMessageService.pushMiniTemplateMessage(Constants.WE_CHAT_PROGRAM_TEMP_KEY_ORDER_RECEIVING, temMap, userToken.getToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 分配佣金
|
||||
* @param storeOrder
|
||||
* @return
|
||||
*/
|
||||
private List<MyRecord> assignCommission(StoreOrder storeOrder) {
|
||||
// 检测商城是否开启分销功能
|
||||
String isOpen = systemConfigService.getValueByKey(Constants.CONFIG_KEY_STORE_BROKERAGE_IS_OPEN);
|
||||
if(StrUtil.isBlank(isOpen) || isOpen.equals("0")){
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
// 营销产品不参与
|
||||
if(storeOrder.getCombinationId() > 0 || storeOrder.getSeckillId() > 0 || storeOrder.getBargainId() > 0){
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
// 查找订单所属人信息
|
||||
User user = userService.getById(storeOrder.getUid());
|
||||
// 当前用户不存在 没有上级 或者 当用用户上级时自己 直接返回
|
||||
if(null == user.getSpreadUid() || user.getSpreadUid() < 1 || user.getSpreadUid().equals(storeOrder.getUid())){
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
// 获取参与分佣的人(两级)
|
||||
List<MyRecord> spreadRecordList = getSpreadRecordList(user.getSpreadUid());
|
||||
if (CollUtil.isEmpty(spreadRecordList)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
spreadRecordList.forEach(record -> {
|
||||
BigDecimal brokerage = calculateCommission(record, storeOrder.getId());
|
||||
record.set("brokerage", brokerage);
|
||||
});
|
||||
return spreadRecordList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 计算佣金
|
||||
* @param record index-分销级数,spreadUid-分销人
|
||||
* @param orderId 订单id
|
||||
* @return
|
||||
*/
|
||||
private BigDecimal calculateCommission(MyRecord record, Integer orderId) {
|
||||
BigDecimal brokeragePrice = BigDecimal.ZERO;
|
||||
//先看商品是否有固定分佣
|
||||
List<StoreOrderInfoVo> orderInfoVoList = storeOrderInfoService.getOrderListByOrderId(orderId);
|
||||
if(null == orderInfoVoList || orderInfoVoList.size() < 1){
|
||||
return brokeragePrice;
|
||||
}
|
||||
|
||||
//查询对应等级的分销比例
|
||||
Integer index = record.getInt("index");
|
||||
String key = "";
|
||||
if (index == 1) {
|
||||
key = Constants.CONFIG_KEY_STORE_BROKERAGE_RATE_ONE;
|
||||
}
|
||||
if (index == 2) {
|
||||
key = Constants.CONFIG_KEY_STORE_BROKERAGE_RATE_TWO;
|
||||
}
|
||||
String rate = systemConfigService.getValueByKey(key);
|
||||
if(StringUtils.isBlank(rate)){
|
||||
rate = "1";
|
||||
}
|
||||
//佣金比例整数存储, 例如80, 所以计算的时候要除以 10*10
|
||||
BigDecimal rateBigDecimal = brokeragePrice;
|
||||
if(StringUtils.isNotBlank(rate)){
|
||||
rateBigDecimal = new BigDecimal(rate).divide(BigDecimal.TEN.multiply(BigDecimal.TEN));
|
||||
}
|
||||
|
||||
BigDecimal totalBrokerPrice = BigDecimal.ZERO;
|
||||
for (StoreOrderInfoVo orderInfoVo : orderInfoVoList) {
|
||||
if(index == 1){
|
||||
brokeragePrice = orderInfoVo.getInfo().getProductInfo().getAttrInfo().getBrokerage();
|
||||
}
|
||||
if(index == 2){
|
||||
brokeragePrice = orderInfoVo.getInfo().getProductInfo().getAttrInfo().getBrokerageTwo();
|
||||
}
|
||||
|
||||
if(brokeragePrice.compareTo(BigDecimal.ZERO) == 0 && !rateBigDecimal.equals(BigDecimal.ZERO)){
|
||||
// 商品没有分销金额, 并且有设置对应等级的分佣比例
|
||||
// 舍入模式向零舍入。
|
||||
brokeragePrice = orderInfoVo.getInfo().getTruePrice().multiply(rateBigDecimal).setScale(2, BigDecimal.ROUND_DOWN);
|
||||
}
|
||||
|
||||
totalBrokerPrice = totalBrokerPrice.add(brokeragePrice);
|
||||
}
|
||||
return totalBrokerPrice;
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参与奋勇人员(两级)
|
||||
* @param spreadUid 一级奋分佣人Uid
|
||||
* @return
|
||||
*/
|
||||
private List<MyRecord> getSpreadRecordList(Integer spreadUid) {
|
||||
List<MyRecord> recordList = CollUtil.newArrayList();
|
||||
|
||||
// 第一级
|
||||
User spreadUser = userService.getById(spreadUid);
|
||||
if (ObjectUtil.isNull(spreadUser)) {
|
||||
return recordList;
|
||||
}
|
||||
// 判断分销模式
|
||||
String model = systemConfigService.getValueByKey(Constants.CONFIG_KEY_STORE_BROKERAGE_MODEL);
|
||||
if (StrUtil.isNotBlank(model) && model.equals("1") && !spreadUser.getIsPromoter()) {
|
||||
// 指定分销模式下:不是推广员不参与分销
|
||||
return recordList;
|
||||
}
|
||||
MyRecord firstRecord = new MyRecord();
|
||||
firstRecord.set("index", 1);
|
||||
firstRecord.set("spreadUid", spreadUid);
|
||||
|
||||
// 第二级
|
||||
User spreadSpreadUser = userService.getById(spreadUser.getSpreadUid());
|
||||
if (ObjectUtil.isNull(spreadSpreadUser)) {
|
||||
return recordList;
|
||||
}
|
||||
if (StrUtil.isNotBlank(model) && model.equals("1") && !spreadSpreadUser.getIsPromoter()) {
|
||||
// 指定分销模式下:不是推广员不参与分销
|
||||
return recordList;
|
||||
}
|
||||
MyRecord secondRecord = new MyRecord();
|
||||
secondRecord.set("index", 2);
|
||||
secondRecord.set("spreadUid", spreadSpreadUser.getUid());
|
||||
return recordList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,16 +1,13 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.ArrayUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
import com.exception.CrmebException;
|
||||
import com.utils.DateUtil;
|
||||
import com.utils.vo.dateLimitUtilVo;
|
||||
import com.zbkj.crmeb.store.dao.StoreOrderDao;
|
||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.store.model.StoreOrderInfo;
|
||||
import com.zbkj.crmeb.store.request.StoreOrderStaticsticsRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreOrderVerificationConfirmResponse;
|
||||
import com.zbkj.crmeb.store.response.StoreStaffDetail;
|
||||
@@ -20,19 +17,15 @@ import com.zbkj.crmeb.store.service.StoreOrderService;
|
||||
import com.zbkj.crmeb.store.service.StoreOrderVerification;
|
||||
import com.zbkj.crmeb.store.utilService.OrderUtils;
|
||||
import com.zbkj.crmeb.system.model.SystemAdmin;
|
||||
import com.zbkj.crmeb.system.model.SystemStoreStaff;
|
||||
import com.zbkj.crmeb.system.service.SystemAdminService;
|
||||
import com.zbkj.crmeb.system.service.SystemStoreService;
|
||||
import com.zbkj.crmeb.system.service.SystemStoreStaffService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import com.zbkj.crmeb.wechat.service.impl.WechatSendMessageForMinService;
|
||||
import com.zbkj.crmeb.wechat.vo.WechatSendMessageForVerSuccess;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.xml.ws.ServiceMode;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -101,10 +94,6 @@ public class StoreOrderVerificationImpl implements StoreOrderVerification {
|
||||
LambdaQueryWrapper<StoreOrder> lqwReceivedCount = Wrappers.lambdaQuery();
|
||||
orderUtils.statusApiByWhere(lqwReceivedCount,2);
|
||||
storeStaffTopDetail.setReceivedCount(dao.selectCount(lqwReceivedCount));
|
||||
//订单待评价 数量 verificationCount
|
||||
// LambdaQueryWrapper<StoreOrder> lqwEvaluatedCount = Wrappers.lambdaQuery();
|
||||
// orderUtils.statusApiByWhere(lqwEvaluatedCount,3);
|
||||
// storeStaffTopDetail.setEvaluatedCount(dao.selectCount(lqwEvaluatedCount));
|
||||
// 订单待核销数量
|
||||
LambdaQueryWrapper<StoreOrder> verificationCount = Wrappers.lambdaQuery();
|
||||
orderUtils.statusApiByWhere(verificationCount,3);
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zbkj.crmeb.store.dao.StoreProductAttrResultDao;
|
||||
import com.zbkj.crmeb.store.model.StoreProductAttrResult;
|
||||
import com.zbkj.crmeb.store.request.StoreProductAttrResultSearchRequest;
|
||||
@@ -71,18 +69,6 @@ public class StoreProductAttrResultServiceImpl extends ServiceImpl<StoreProductA
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Integer updateByProductId(StoreProductAttrResult storeProductAttrResult) {
|
||||
LambdaUpdateWrapper<StoreProductAttrResult> uw = Wrappers.lambdaUpdate();
|
||||
uw.eq(StoreProductAttrResult::getProductId, storeProductAttrResult.getProductId());
|
||||
uw.set(StoreProductAttrResult::getResult, storeProductAttrResult.getResult());
|
||||
uw.set(StoreProductAttrResult::getChangeTime, storeProductAttrResult.getChangeTime());
|
||||
if(null != storeProductAttrResult.getType()){
|
||||
uw.set(StoreProductAttrResult::getType, storeProductAttrResult.getType());
|
||||
}
|
||||
return dao.update(storeProductAttrResult, uw);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteByProductId(int productId, int type) {
|
||||
LambdaQueryWrapper<StoreProductAttrResult> lmdQ = Wrappers.lambdaQuery();
|
||||
|
||||
@@ -1,12 +1,10 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zbkj.crmeb.store.dao.StoreProductAttrDao;
|
||||
import com.zbkj.crmeb.store.model.StoreProductAttr;
|
||||
@@ -58,31 +56,6 @@ public class StoreProductAttrServiceImpl extends ServiceImpl<StoreProductAttrDao
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean batchSave(List<StoreProductAttr> storeProductAttrs) {
|
||||
if(null == storeProductAttrs) return false;
|
||||
int count ;
|
||||
for (StoreProductAttr attr : storeProductAttrs) {
|
||||
count = dao.insert(attr);
|
||||
if(count <= 0) throw new CrmebException("新增产品属性失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Boolean batchUpdate(List<StoreProductAttr> storeProductAttrs) {
|
||||
if(null == storeProductAttrs) return false;
|
||||
for (StoreProductAttr storeProductAttr : storeProductAttrs) {
|
||||
UpdateWrapper<StoreProductAttr> lwq = new UpdateWrapper<>();
|
||||
lwq.eq("product_id", storeProductAttr.getProductId());
|
||||
lwq.eq("attr_name", storeProductAttr.getAttrName());
|
||||
lwq.eq("attr_values", storeProductAttr.getAttrValues());
|
||||
lwq.eq("type", storeProductAttr.getType());
|
||||
if(dao.update(storeProductAttr,lwq) < 0) throw new CrmebException("更新产品属性失败");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据基本属性查询商品属性详情
|
||||
*
|
||||
|
||||
@@ -9,9 +9,7 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.Constant;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zbkj.crmeb.seckill.model.StoreSeckill;
|
||||
import com.zbkj.crmeb.store.dao.StoreProductAttrValueDao;
|
||||
import com.zbkj.crmeb.store.model.StoreProductAttrValue;
|
||||
import com.zbkj.crmeb.store.request.StoreProductAttrValueSearchRequest;
|
||||
|
||||
@@ -1,11 +1,9 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zbkj.crmeb.store.dao.StoreProductCateDao;
|
||||
import com.zbkj.crmeb.store.model.StoreProductCate;
|
||||
import com.zbkj.crmeb.store.request.StoreProductCateSearchRequest;
|
||||
@@ -63,13 +61,5 @@ public class StoreProductCateServiceImpl extends ServiceImpl<StoreProductCateDao
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
// @Override
|
||||
// public Integer updateByProductId(StoreProductCate storeProductCate) {
|
||||
// LambdaUpdateWrapper<StoreProductCate> luw = new LambdaUpdateWrapper<>();
|
||||
// luw.set(StoreProductCate::getProductId, storeProductCate.getProductId());
|
||||
// luw.set(StoreProductCate::getCateId, storeProductCate.getCateId());
|
||||
// luw.set(StoreProductCate::getAddTime, storeProductCate.getAddTime());
|
||||
// return dao.update(storeProductCate, luw);
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zbkj.crmeb.store.dao.StoreProductDescriptionDao;
|
||||
import com.zbkj.crmeb.store.model.StoreProductDescription;
|
||||
import com.zbkj.crmeb.store.request.StoreProductDescriptionSearchRequest;
|
||||
|
||||
@@ -94,30 +94,6 @@ public class StoreProductRelationServiceImpl extends ServiceImpl<StoreProductRel
|
||||
return dao.getCountInProductId(objectObjectHashMap);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据产品id获取点赞总数
|
||||
* @param productIdList List<Integer> 产品id
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-06
|
||||
* @return HashMap<Integer, Integer>
|
||||
*/
|
||||
public HashMap<Integer, Integer> getLikeCountListInProductId(List<Integer> productIdList) {
|
||||
List<StoreProductRelationCountVo> list = getCountInProductId(productIdList, "like");
|
||||
return getCountListInProductId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据产品id获取收藏总数
|
||||
* @param productIdList List<Integer> 产品id
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-06
|
||||
* @return HashMap<Integer, Integer>
|
||||
*/
|
||||
public HashMap<Integer, Integer> getCollectCountListInProductId(List<Integer> productIdList) {
|
||||
List<StoreProductRelationCountVo> list = getCountInProductId(productIdList, "collect");
|
||||
return getCountListInProductId(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加收藏产品
|
||||
* @param request UserCollectAllRequest 新增参数
|
||||
@@ -179,21 +155,6 @@ public class StoreProductRelationServiceImpl extends ServiceImpl<StoreProductRel
|
||||
dao.delete(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* product_id => count 数据组装
|
||||
* @param list List<StoreProductRelationCountVo> 数据集合
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-06
|
||||
* @return HashMap<Integer, Integer>
|
||||
*/
|
||||
private HashMap<Integer, Integer> getCountListInProductId(List<StoreProductRelationCountVo> list){
|
||||
HashMap<Integer, Integer> map = new HashMap<>();
|
||||
for (StoreProductRelationCountVo storeProductRelationCountVo : list){
|
||||
map.put(storeProductRelationCountVo.getProductId(), storeProductRelationCountVo.getCount());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据产品id和类型获取对应列表
|
||||
* @param productId 产品id
|
||||
|
||||
@@ -25,7 +25,10 @@ import com.zbkj.crmeb.store.model.StoreProductReply;
|
||||
import com.zbkj.crmeb.store.request.StoreProductReplyAddRequest;
|
||||
import com.zbkj.crmeb.store.request.StoreProductReplySearchRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreProductReplyResponse;
|
||||
import com.zbkj.crmeb.store.service.*;
|
||||
import com.zbkj.crmeb.store.service.StoreOrderInfoService;
|
||||
import com.zbkj.crmeb.store.service.StoreOrderService;
|
||||
import com.zbkj.crmeb.store.service.StoreProductReplyService;
|
||||
import com.zbkj.crmeb.store.service.StoreProductService;
|
||||
import com.zbkj.crmeb.store.vo.StoreOrderInfoVo;
|
||||
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
@@ -35,7 +38,6 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
@@ -189,7 +191,6 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = {RuntimeException.class, Error.class, CrmebException.class})
|
||||
public boolean create(StoreProductReplyAddRequest request) {
|
||||
try{
|
||||
StoreProductReply storeProductReply = new StoreProductReply();
|
||||
@@ -372,8 +373,8 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
//全部商品都已评价
|
||||
storeOrder.setStatus(Constants.ORDER_STATUS_INT_COMPLETE);
|
||||
storeOrderService.updateById(storeOrder);
|
||||
redisUtil.lPush(Constants.ORDER_TASK_REDIS_KEY_AFTER_COMPLETE_BY_USER, storeOrder.getId());
|
||||
}
|
||||
redisUtil.lPush(Constants.ORDER_TASK_REDIS_KEY_AFTER_COMPLETE_BY_USER, storeOrder.getId());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -425,8 +426,8 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
*/
|
||||
private Integer getReplyCountByEntity(StoreProductReply request, boolean isAll) {
|
||||
LambdaQueryWrapper<StoreProductReply> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(StoreProductReply::getOid, request.getOid())
|
||||
.eq(StoreProductReply::getUnique, request.getUnique());
|
||||
lambdaQueryWrapper.eq(StoreProductReply::getOid, request.getOid());
|
||||
// .eq(StoreProductReply::getUnique, request.getUnique());
|
||||
if(null != request.getUid()){
|
||||
lambdaQueryWrapper.eq(StoreProductReply::getUid, request.getUid());
|
||||
}
|
||||
|
||||
@@ -1,11 +1,10 @@
|
||||
package com.zbkj.crmeb.store.service.impl;
|
||||
|
||||
import com.common.PageParamRequest;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zbkj.crmeb.store.dao.StoreProductRuleDao;
|
||||
import com.zbkj.crmeb.store.model.StoreProductRule;
|
||||
import com.zbkj.crmeb.store.request.StoreProductRuleRequest;
|
||||
@@ -85,7 +84,7 @@ public class StoreProductRuleServiceImpl extends ServiceImpl<StoreProductRuleDao
|
||||
if(StringUtils.isBlank(ruleName)){
|
||||
return new ArrayList<>();
|
||||
}
|
||||
lambdaQueryWrapper.eq(StoreProductRule::getRuleName, ruleName);
|
||||
lambdaQueryWrapper.eq(StoreProductRule::getRuleName, ruleName);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -82,9 +82,6 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
@Autowired
|
||||
private StoreProductAttrValueService storeProductAttrValueService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductCateService storeProductCateService;
|
||||
|
||||
@Autowired
|
||||
private SystemConfigService systemConfigService;
|
||||
|
||||
@@ -247,11 +244,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
if(attrs.size() > 0){
|
||||
storeProductResponse.setAttr(attrs);
|
||||
}
|
||||
// StoreProductAttrResult spResult = attrResultService.getByProductId(product.getId());
|
||||
// if(null != spResult){
|
||||
// if(StringUtils.isNotBlank(spResult.getResult())){
|
||||
List<StoreProductAttrValueResponse> storeProductAttrValueResponse = new ArrayList<>();
|
||||
// List<StoreProductAttrValue> storeProductAttrValues = storeProductAttrValueService.getListByProductId(product.getId());
|
||||
|
||||
StoreProductAttrValue storeProductAttrValuePram = new StoreProductAttrValue();
|
||||
storeProductAttrValuePram.setProductId(product.getId()).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
@@ -263,22 +256,16 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
return e;
|
||||
}).collect(Collectors.toList());
|
||||
storeProductResponse.setAttrValue(storeProductAttrValueResponse);
|
||||
// }
|
||||
// 处理富文本
|
||||
StoreProductDescription sd = storeProductDescriptionService.getOne(
|
||||
new LambdaQueryWrapper<StoreProductDescription>()
|
||||
.eq(StoreProductDescription::getProductId, product.getId())
|
||||
.eq(StoreProductDescription::getType, Constants.PRODUCT_TYPE_NORMAL));
|
||||
if(null != sd){
|
||||
storeProductResponse.setContent(null == sd.getDescription()?"":sd.getDescription());
|
||||
}
|
||||
// }
|
||||
// 处理富文本
|
||||
StoreProductDescription sd = storeProductDescriptionService.getOne(
|
||||
new LambdaQueryWrapper<StoreProductDescription>()
|
||||
.eq(StoreProductDescription::getProductId, product.getId())
|
||||
.eq(StoreProductDescription::getType, Constants.PRODUCT_TYPE_NORMAL));
|
||||
if(null != sd){
|
||||
storeProductResponse.setContent(null == sd.getDescription()?"":sd.getDescription());
|
||||
}
|
||||
// 处理分类中文
|
||||
List<Category> cg = categoryService.getByIds(CrmebUtil.stringToArray(product.getCateId()));
|
||||
// StringBuilder sb = new StringBuilder();
|
||||
// for (Category category : cg) {
|
||||
// sb.append(sb.length() == 0 ? category.getName(): category.getName()+",");
|
||||
// }
|
||||
if (CollUtil.isEmpty(cg)) {
|
||||
storeProductResponse.setCateValues("");
|
||||
} else {
|
||||
@@ -344,9 +331,6 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
//轮播图
|
||||
storeProduct.setSliderImage(systemAttachmentService.clearPrefix(storeProduct.getSliderImage()));
|
||||
|
||||
// 获取 attrValue 字符串 解析后对应attrValue表中的数据
|
||||
// List<StoreProductAttrValueRequest> storeProductAttrValuesRequest = getStoreProductAttrValueRequests(storeProductRequest);
|
||||
|
||||
//计算价格
|
||||
productUtils.calcPriceForAttrValues(storeProductRequest, storeProduct);
|
||||
|
||||
@@ -463,8 +447,6 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
//轮播图
|
||||
storeProduct.setSliderImage(systemAttachmentService.clearPrefix(storeProduct.getSliderImage()));
|
||||
|
||||
// List<StoreProductAttrValueRequest> storeProductAttrValuesRequest = getStoreProductAttrValueRequests(storeProductRequest);
|
||||
|
||||
productUtils.calcPriceForAttrValues(storeProductRequest, storeProduct);
|
||||
int saveCount = dao.updateById(storeProduct);
|
||||
// 对attr表做全量更新,删除原有数据保存现有数据
|
||||
@@ -529,21 +511,6 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
if(!saveOrUpdateResult) throw new CrmebException("新增属性详情失败");
|
||||
}
|
||||
|
||||
// 处理分类辅助表
|
||||
// if(null != storeProductRequest.getCateIds()){
|
||||
// for (int i = 0; i < storeProductRequest.getCateIds().size(); i++) {
|
||||
// Integer cateid = storeProductRequest.getCateIds().get(i);
|
||||
// StoreProductCate storeProductCate =
|
||||
// new StoreProductCate(storeProduct.getId(),cateid, DateUtil.getNowTime());
|
||||
// LambdaUpdateWrapper<StoreProductCate> luw = new LambdaUpdateWrapper<>();
|
||||
// luw.set(StoreProductCate::getProductId, storeProductCate.getProductId());
|
||||
// luw.set(StoreProductCate::getCateId, storeProductCate.getCateId());
|
||||
// luw.set(StoreProductCate::getAddTime, storeProductCate.getAddTime());
|
||||
// boolean updateResult = storeProductCateService.update(luw);
|
||||
// if(!updateResult) throw new CrmebException("编辑产品分类辅助失败");
|
||||
// }
|
||||
// }
|
||||
|
||||
// 处理富文本
|
||||
StoreProductDescription spd = new StoreProductDescription(
|
||||
storeProduct.getId(),
|
||||
@@ -569,18 +536,12 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
if(null == storeProduct) throw new CrmebException("未找到对应商品信息");
|
||||
StoreProductResponse storeProductResponse = new StoreProductResponse();
|
||||
BeanUtils.copyProperties(storeProduct, storeProductResponse);
|
||||
// if(storeProduct.getSpecType()){
|
||||
// storeProductResponse.setAttr(attrService.getByProductId(storeProduct.getId()));
|
||||
StoreProductAttr spaPram = new StoreProductAttr();
|
||||
spaPram.setProductId(storeProduct.getId()).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
storeProductResponse.setAttr(attrService.getByEntity(spaPram));
|
||||
|
||||
// 设置商品所参与的活动
|
||||
storeProductResponse.setActivityH5(productUtils.getProductCurrentActivity(storeProduct));
|
||||
// }else{
|
||||
// storeProductResponse.setAttr(new ArrayList<>());
|
||||
// }
|
||||
// List<StoreProductAttrValue> storeProductAttrValues = storeProductAttrValueService.getListByProductId(storeProduct.getId());
|
||||
StoreProductAttrValue spavPram = new StoreProductAttrValue();
|
||||
spavPram.setProductId(id).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
List<StoreProductAttrValue> storeProductAttrValues = storeProductAttrValueService.getByEntity(spavPram);
|
||||
@@ -589,7 +550,6 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
|
||||
if(storeProduct.getSpecType()){
|
||||
// 后端多属性用于编辑
|
||||
// StoreProductAttrResult attrResult = storeProductAttrResultService.getByProductId(storeProduct.getId());
|
||||
StoreProductAttrResult sparPram = new StoreProductAttrResult();
|
||||
sparPram.setProductId(storeProduct.getId()).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
List<StoreProductAttrResult> attrResults = storeProductAttrResultService.getByEntity(sparPram);
|
||||
@@ -689,23 +649,8 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
lambdaQueryWrapper.eq(StoreProduct::getIsDel, false)
|
||||
.eq(StoreProduct::getMerId, false)
|
||||
.gt(StoreProduct::getStock, 0)
|
||||
.eq(StoreProduct::getIsShow, true)
|
||||
.orderByDesc(StoreProduct::getSort);
|
||||
if(!StringUtils.isBlank(request.getPriceOrder())){
|
||||
if(request.getPriceOrder().equals(Constants.SORT_DESC)){
|
||||
lambdaQueryWrapper.orderByDesc(StoreProduct::getPrice);
|
||||
}else{
|
||||
lambdaQueryWrapper.orderByAsc(StoreProduct::getPrice);
|
||||
}
|
||||
}
|
||||
.eq(StoreProduct::getIsShow, true);
|
||||
|
||||
if(!StringUtils.isBlank(request.getSalesOrder())){
|
||||
if(request.getSalesOrder().equals(Constants.SORT_DESC)){
|
||||
lambdaQueryWrapper.orderByDesc(StoreProduct::getSales);
|
||||
}else{
|
||||
lambdaQueryWrapper.orderByAsc(StoreProduct::getSales);
|
||||
}
|
||||
}
|
||||
if(null != request.getCateId() && request.getCateId().size() > 0 ){
|
||||
lambdaQueryWrapper.apply(CrmebUtil.getFindInSetSql("cate_id", (ArrayList<Integer>) request.getCateId()));
|
||||
}
|
||||
@@ -722,6 +667,22 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
}
|
||||
}
|
||||
|
||||
if(!StringUtils.isBlank(request.getPriceOrder())){
|
||||
if(request.getPriceOrder().equals(Constants.SORT_DESC)){
|
||||
lambdaQueryWrapper.orderByDesc(StoreProduct::getPrice);
|
||||
}else{
|
||||
lambdaQueryWrapper.orderByAsc(StoreProduct::getPrice);
|
||||
}
|
||||
}
|
||||
|
||||
if(!StringUtils.isBlank(request.getSalesOrder())){
|
||||
if(request.getSalesOrder().equals(Constants.SORT_DESC)){
|
||||
lambdaQueryWrapper.orderByDesc(StoreProduct::getSales);
|
||||
}else{
|
||||
lambdaQueryWrapper.orderByAsc(StoreProduct::getSales);
|
||||
}
|
||||
}
|
||||
lambdaQueryWrapper.orderByDesc(StoreProduct::getSort);
|
||||
lambdaQueryWrapper.orderByDesc(StoreProduct::getId);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.zbkj.crmeb.front.vo.OrderAgainVo;
|
||||
import com.zbkj.crmeb.marketing.model.StoreCouponUser;
|
||||
import com.zbkj.crmeb.marketing.request.StoreCouponUserSearchRequest;
|
||||
import com.zbkj.crmeb.marketing.response.StoreCouponUserResponse;
|
||||
import com.zbkj.crmeb.marketing.service.StoreCouponService;
|
||||
import com.zbkj.crmeb.marketing.service.StoreCouponUserService;
|
||||
import com.zbkj.crmeb.seckill.model.StoreSeckill;
|
||||
import com.zbkj.crmeb.seckill.model.StoreSeckillManger;
|
||||
@@ -46,7 +45,6 @@ import com.zbkj.crmeb.seckill.service.StoreSeckillService;
|
||||
import com.zbkj.crmeb.store.model.*;
|
||||
import com.zbkj.crmeb.store.request.StoreOrderSearchRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreCartResponse;
|
||||
import com.zbkj.crmeb.store.response.StoreProductCartProductInfoResponse;
|
||||
import com.zbkj.crmeb.store.service.*;
|
||||
import com.zbkj.crmeb.store.vo.StoreOrderInfoVo;
|
||||
import com.zbkj.crmeb.system.model.SystemStore;
|
||||
@@ -57,7 +55,6 @@ import com.zbkj.crmeb.system.service.SystemStoreService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.model.UserAddress;
|
||||
import com.zbkj.crmeb.user.service.UserAddressService;
|
||||
import com.zbkj.crmeb.user.service.UserBillService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import com.zbkj.crmeb.wechat.service.impl.WechatSendMessageForMinService;
|
||||
import com.zbkj.crmeb.wechat.vo.WechatSendMessageForDistrbution;
|
||||
@@ -68,7 +65,6 @@ import org.apache.commons.lang3.StringEscapeUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
@@ -96,9 +92,6 @@ public class OrderUtils {
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private UserBillService userBillService;
|
||||
|
||||
@Autowired
|
||||
private StoreOrderStatusService storeOrderStatusService;
|
||||
|
||||
@@ -111,9 +104,6 @@ public class OrderUtils {
|
||||
@Autowired
|
||||
private StoreCouponUserService storeCouponUserService;
|
||||
|
||||
@Autowired
|
||||
private StoreCouponService storeCouponService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductService storeProductService;
|
||||
|
||||
@@ -135,9 +125,6 @@ public class OrderUtils {
|
||||
@Autowired
|
||||
private ShippingTemplatesFreeService shippingTemplatesFreeService;
|
||||
|
||||
@Autowired
|
||||
private StoreCartService storeCartService;
|
||||
|
||||
@Autowired
|
||||
private SystemGroupDataService systemGroupDataService;
|
||||
|
||||
@@ -211,18 +198,7 @@ public class OrderUtils {
|
||||
// 拼团秒杀砍价逻辑处理
|
||||
String tempTime = null;
|
||||
Date timeSpace = null;
|
||||
// if(storeOrder.getPinkId() > 0 || storeOrder.getCombinationId() > 0){
|
||||
// tempTime = configValues.get(4).length() > 0 ? configValues.get(4) : configValues.get(1);
|
||||
// timeSpace = DateUtil.addSecond(storeOrder.getCreateTime(),Integer.parseInt(tempTime) * 3600);
|
||||
// }else if(storeOrder.getSeckillId() > 0){
|
||||
// tempTime = configValues.get(3).length() > 0 ? configValues.get(3) : configValues.get(1);
|
||||
// timeSpace = DateUtil.addSecond(storeOrder.getCreateTime(), Integer.parseInt(tempTime) * 3600);
|
||||
// }else if(storeOrder.getBargainId() > 0){
|
||||
// tempTime = configValues.get(2).length() > 0 ? configValues.get(2) : configValues.get(1);
|
||||
// timeSpace = DateUtil.addSecond(storeOrder.getCreateTime(), Integer.parseInt(tempTime) * 3600);
|
||||
// }else{ // 非 营销活动购买处理
|
||||
timeSpace = DateUtil.addSecond(storeOrder.getCreateTime(),Double.valueOf(configValues.get(0).toString()).intValue() * 3600);
|
||||
// }
|
||||
timeSpace = DateUtil.addSecond(storeOrder.getCreateTime(),Double.valueOf(configValues.get(0).toString()).intValue() * 3600);
|
||||
status.setMsg("请在" + DateUtil.dateToStr(timeSpace, Constants.DATE_FORMAT) +"前完成支付");
|
||||
}else if(storeOrder.getRefundStatus() == 1){
|
||||
status = new OrderAgainItemVo(-1,"申请退款中","商家审核中,请耐心等待");
|
||||
@@ -337,6 +313,8 @@ public class OrderUtils {
|
||||
BigDecimal payPostage;
|
||||
if(request.getPayType().equals("offline") && systemConfigService.getValueByKey("offline_postage").equals("1")){
|
||||
payPostage = BigDecimal.ZERO;
|
||||
} else if (request.getShippingType().equals(2)) {// 到店自取,不计算运费
|
||||
payPostage = BigDecimal.ZERO;
|
||||
}else{
|
||||
UserAddress ua = new UserAddress();
|
||||
ua.setUid(currentUser.getUid());
|
||||
@@ -344,6 +322,7 @@ public class OrderUtils {
|
||||
UserAddress currentUserAddress = userAddressService.getUserAddress(ua);
|
||||
currentOrderPriceGroup = getOrderPriceGroup(cor.getCartInfo(), currentUserAddress);
|
||||
payPostage = currentOrderPriceGroup.getStorePostage();
|
||||
payPrice = payPrice.add(payPostage);
|
||||
}
|
||||
|
||||
// 检测优惠券
|
||||
@@ -365,23 +344,6 @@ public class OrderUtils {
|
||||
couponPrice = storeCouponUser.getMoney();
|
||||
}
|
||||
|
||||
|
||||
// 发快递还是门店自提
|
||||
String storeSelfMention = systemConfigService.getValueByKey("store_self_mention");
|
||||
int shippingType = 0;
|
||||
|
||||
if(Boolean.valueOf(storeSelfMention)) shippingType = 1;
|
||||
if(shippingType == 1){ // 是否包邮
|
||||
if(StringUtils.isNotBlank(cor.getOther().get("offlinePostage").toString())
|
||||
&& request.getPayType().equals(Constants.PAY_TYPE_OFFLINE)){
|
||||
payPostage = BigDecimal.ZERO;
|
||||
}
|
||||
payPrice = payPrice.add(payPostage);
|
||||
}else if(shippingType == 2){ // 门店自提没有邮费
|
||||
cor.getPriceGroup().setStorePostage(BigDecimal.ZERO);
|
||||
payPostage = BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
// 积分
|
||||
if(null != request.getUseIntegral() && currentUser.getIntegral() > 0){
|
||||
deductionPrice = new BigDecimal(currentUser.getIntegral()).multiply(BigDecimal.valueOf(Double.valueOf(cor.getOther().get("integralRatio").toString())));
|
||||
@@ -425,298 +387,6 @@ public class OrderUtils {
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
* @param request 订单创建参数
|
||||
* @param cor 缓存的购物车,价钱等信息集合
|
||||
* @param isChannel 购买渠道
|
||||
* @param orderId 订单id
|
||||
* @return 订单信息
|
||||
*/
|
||||
@Transactional(rollbackFor = {RuntimeException.class, Error.class, CrmebException.class})
|
||||
public StoreOrder createOrder(OrderCreateRequest request,ConfirmOrderResponse cor, Integer isChannel,Integer orderId, String orderKey){
|
||||
// UserAddress currentUserAddress = new UserAddress();
|
||||
// List<Integer> cartIds = new ArrayList<>();
|
||||
// Integer totalNum = 0;
|
||||
// Integer gainIntegral = 0;
|
||||
//
|
||||
// if(request.getShippingType() == 1){ // 是否包邮
|
||||
// if(request.getAddressId() <= 0) throw new CrmebException("请选择收货地址");
|
||||
// UserAddress userAddress = new UserAddress();
|
||||
// userAddress.setId(request.getAddressId());
|
||||
// userAddress.setIsDel(false);
|
||||
// currentUserAddress = userAddressService.getUserAddress(userAddress);
|
||||
// if(null == currentUserAddress){
|
||||
// throw new CrmebException("收货地址有误");
|
||||
// }
|
||||
// }else if(request.getShippingType() == 2){ // 到店自提
|
||||
// if(StringUtils.isBlank(request.getRealName()) || StringUtils.isBlank(request.getPhone()))
|
||||
// throw new CrmebException("请填写姓名和电话");
|
||||
//
|
||||
// currentUserAddress.setRealName(request.getRealName());
|
||||
// currentUserAddress.setPhone(request.getPhone());
|
||||
// }
|
||||
// for (StoreCartResponse cartResponse : cor.getCartInfo()) {
|
||||
// cartIds.add(cartResponse.getSeckillId());
|
||||
// totalNum += cartResponse.getCartNum();
|
||||
//
|
||||
// Integer cartInfoGainIntegral =
|
||||
// (cartResponse.getProductInfo().getGiveIntegral() != null && cartResponse.getProductInfo().getGiveIntegral() > 0 )?
|
||||
// cartResponse.getProductInfo().getGiveIntegral() * cartResponse.getCartNum()
|
||||
// : 0;
|
||||
// gainIntegral = gainIntegral + cartInfoGainIntegral;
|
||||
// }
|
||||
// // todo 检测营销产品状态
|
||||
// // 发快递还是门店自提
|
||||
// String storeSelfMention = systemConfigService.getValueByKey("store_self_mention");
|
||||
// if(!Boolean.valueOf(storeSelfMention)) request.setShippingType(1);
|
||||
//
|
||||
// StoreOrder storeOrder = new StoreOrder();
|
||||
// storeOrder.setUid(cor.getUserInfo().getUid());
|
||||
// storeOrder.setOrderId(CrmebUtil.getOrderNo(Constants.PAY_TYPE_WE_CHAT));
|
||||
//
|
||||
// // 后置选择收货地址信息
|
||||
// if(null == cor.getAddressInfo() && request.getAddressId() > 0){
|
||||
// UserAddress selectUserAddress = userAddressService.getById(request.getAddressId());
|
||||
// cor.setAddressInfo(selectUserAddress);
|
||||
// }
|
||||
//
|
||||
// storeOrder.setRealName(currentUserAddress.getRealName());
|
||||
// storeOrder.setUserPhone(currentUserAddress.getPhone());
|
||||
// storeOrder.setUserAddress(cor.getAddressInfo().getProvince()
|
||||
// + cor.getAddressInfo().getCity()
|
||||
// + cor.getAddressInfo().getDistrict()
|
||||
// + cor.getAddressInfo().getDetail());
|
||||
//// storeOrder.setCarId(cartIds);
|
||||
// storeOrder.setTotalNum(totalNum);
|
||||
// BigDecimal mapTotalPrice = cor.getPriceGroup().getTotalPrice();
|
||||
// BigDecimal mapStorePostage = cor.getPriceGroup().getStorePostage();
|
||||
// BigDecimal mapCouponPrice = cor.getPriceGroup().getCouponPrice();
|
||||
// BigDecimal mapPayPrice = cor.getPriceGroup().getPayPrice();
|
||||
// BigDecimal mapPayPostage = cor.getPriceGroup().getPayPostage();
|
||||
// BigDecimal mapDeductionPrice = cor.getPriceGroup().getDeductionPrice();
|
||||
// Integer mapUsedIntegral = cor.getPriceGroup().getUsedIntegral();
|
||||
// BigDecimal mapCostPrice = cor.getPriceGroup().getCostPrice();
|
||||
//
|
||||
// int couponId = null == cor.getUsableCoupon() ? 0: cor.getUsableCoupon().getId();
|
||||
// storeOrder.setTotalPrice(mapTotalPrice);
|
||||
// storeOrder.setTotalPostage(mapStorePostage);
|
||||
// storeOrder.setCouponId(couponId);
|
||||
// storeOrder.setCouponPrice(mapCouponPrice);
|
||||
// storeOrder.setPayPrice(mapPayPrice);
|
||||
// storeOrder.setPayPostage(mapPayPostage);
|
||||
// storeOrder.setDeductionPrice(mapDeductionPrice);
|
||||
//// storeOrder.setPaid(false);
|
||||
// storeOrder.setPayType(request.getPayType());
|
||||
// storeOrder.setUseIntegral(mapUsedIntegral);
|
||||
// storeOrder.setGainIntegral(gainIntegral);
|
||||
// storeOrder.setMark(StringEscapeUtils.escapeHtml4(request.getMark()));
|
||||
// storeOrder.setCombinationId(request.getCombinationId());
|
||||
// storeOrder.setPinkId(request.getPinkId());
|
||||
// storeOrder.setSeckillId(request.getSeckillId());
|
||||
// storeOrder.setBargainId(request.getBargainId());
|
||||
// storeOrder.setCost(mapCostPrice);
|
||||
// storeOrder.setIsChannel(isChannel);
|
||||
// storeOrder.setCreateTime(DateUtil.nowDateTime());
|
||||
// storeOrder.setUnique(orderKey);
|
||||
// storeOrder.setShippingType(request.getShippingType());
|
||||
// storeOrder.setPinkId(request.getPinkId());
|
||||
//
|
||||
// // 如果是自提
|
||||
// if(request.getShippingType() == 2){
|
||||
// storeOrder.setVerifyCode(CrmebUtil.randomCount(1111111111,999999999)+"");
|
||||
// SystemStore systemStore = new SystemStore();
|
||||
// systemStore.setId(request.getStoreId());
|
||||
// systemStore.setIsShow(true);
|
||||
// systemStore.setIsDel(false);
|
||||
// SystemStore existSystemStore = systemStoreService.getByCondition(systemStore);
|
||||
// if(null == existSystemStore) throw new CrmebException("暂无门店无法选择门店自提");
|
||||
// storeOrder.setStoreId(existSystemStore.getId());
|
||||
// }
|
||||
// boolean createdResult = storeOrderService.create(storeOrder);
|
||||
// if(!createdResult) throw new CrmebException("订单生成失败");
|
||||
//
|
||||
// // 积分抵扣
|
||||
// boolean disIntegle = true;
|
||||
// User currentUser = userService.getInfo();
|
||||
// if(request.getUseIntegral() && currentUser.getIntegral() > 0){
|
||||
// BigDecimal deductionPrice = BigDecimal.ZERO;
|
||||
// if(null != cor.getPriceGroup().getUsedIntegral()){
|
||||
// deductionPrice = BigDecimal.valueOf(cor.getPriceGroup().getUsedIntegral(),2);
|
||||
// if(cor.getPriceGroup().getUsedIntegral() > 0){
|
||||
// currentUser.setIntegral(0);
|
||||
// disIntegle = userService.updateBase(currentUser);
|
||||
// }else{
|
||||
// if(currentUser.getIntegral() < deductionPrice.intValue()){
|
||||
// currentUser.setIntegral(currentUser.getIntegral() - deductionPrice.intValue());
|
||||
// disIntegle = userService.updateBase(currentUser);
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// UserBill userBill = new UserBill();
|
||||
// userBill.setTitle("积分抵扣");
|
||||
// userBill.setUid(currentUser.getUid());
|
||||
// userBill.setCategory("integral");
|
||||
// userBill.setType("deduction");
|
||||
// userBill.setNumber(deductionPrice);
|
||||
// userBill.setLinkId(orderId+"");
|
||||
// userBill.setBalance(new BigDecimal(currentUser.getIntegral()));
|
||||
//
|
||||
// userBill.setMark("购买商品使用"+userBill.getNumber()+"积分抵扣"+deductionPrice+"元");
|
||||
// boolean userBillSaveResult = userBillService.save(userBill);
|
||||
// disIntegle = disIntegle && userBillSaveResult;
|
||||
// }
|
||||
// if(!disIntegle) throw new CrmebException("使用积分抵扣失败");
|
||||
//
|
||||
// Integer secKillId = null;
|
||||
// List<StoreOrderInfo> storeOrderInfos = new ArrayList<>();
|
||||
// boolean deCountResult = true;
|
||||
// for (StoreCartResponse cartResponse : cor.getCartInfo()) {
|
||||
// StoreOrderInfo soInfo = new StoreOrderInfo();
|
||||
// // 秒杀商品扣减库存
|
||||
// if(null != cartResponse.getSeckillId() && cartResponse.getSeckillId() > 0){
|
||||
// secKillId = cartResponse.getSeckillId();
|
||||
// // 秒杀商品本身库存扣减
|
||||
// deCountResult = storeSeckillService.decProductStock(
|
||||
// cartResponse.getSeckillId(),
|
||||
// cartResponse.getCartNum(),
|
||||
// Integer.parseInt(cartResponse.getProductAttrUnique()), Constants.PRODUCT_TYPE_SECKILL);
|
||||
// // 商品本身扣减库存 更新商品本身库存步骤 1=根据秒杀uniuqeId 获取对应sku 2=根据商品ID获取商品sku信息后 对比相等的sku 更新其对应数量
|
||||
// // 秒杀对应商品库存扣减
|
||||
// StoreProductAttrValue currentSeckillAttrValue = storeProductAttrValueService.getById(cartResponse.getProductAttrUnique());
|
||||
// List<StoreProductAttrValue> currentSeckillAttrValues = storeProductAttrValueService.getListByProductId(cartResponse.getProductId());
|
||||
// List<StoreProductAttrValue> existAttrValues = currentSeckillAttrValues.stream().filter(e ->
|
||||
// e.getSuk().equals(currentSeckillAttrValue.getSuk()) && e.getType().equals(Constants.PRODUCT_TYPE_NORMAL))
|
||||
// .collect(Collectors.toList());
|
||||
// if(existAttrValues.size() != 1) throw new CrmebException("未找到扣减库存的商品");
|
||||
// deCountResult = storeProductService.decProductStock(
|
||||
// existAttrValues.get(0).getProductId(),
|
||||
// cartResponse.getCartNum(),
|
||||
// existAttrValues.get(0).getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
//
|
||||
// }else if (ObjectUtil.isNotNull(cartResponse.getBargainId()) && cartResponse.getBargainId() > 0) {
|
||||
// // 砍价扣减库存
|
||||
// Integer bargainId = cartResponse.getBargainId();
|
||||
// // 砍价商品扣减库存
|
||||
// deCountResult = storeBargainService.decProductStock(
|
||||
// cartResponse.getBargainId(),
|
||||
// cartResponse.getCartNum(),
|
||||
// Integer.parseInt(cartResponse.getProductAttrUnique()), Constants.PRODUCT_TYPE_BARGAIN);
|
||||
// // 商品本身扣减库存 更新商品本身库存步骤 1=根据秒杀uniuqeId 获取对应sku 2=根据商品ID获取商品sku信息后 对比相等的sku 更新其对应数量
|
||||
// // 砍价对应商品库存扣减
|
||||
// StoreProductAttrValue currentSeckillAttrValue = storeProductAttrValueService.getById(cartResponse.getProductAttrUnique());
|
||||
// List<StoreProductAttrValue> currentBargainAttrValues = storeProductAttrValueService.getListByProductId(cartResponse.getProductId());
|
||||
// List<StoreProductAttrValue> existAttrValues = currentBargainAttrValues.stream().filter(e ->
|
||||
// e.getSuk().equals(currentSeckillAttrValue.getSuk()) && e.getType().equals(Constants.PRODUCT_TYPE_NORMAL))
|
||||
// .collect(Collectors.toList());
|
||||
// if(existAttrValues.size() != 1) throw new CrmebException("未找到扣减库存的商品");
|
||||
// deCountResult = storeProductService.decProductStock(
|
||||
// existAttrValues.get(0).getProductId(),
|
||||
// cartResponse.getCartNum(),
|
||||
// existAttrValues.get(0).getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
//
|
||||
// // 砍价商品购买成功,改变用户状态
|
||||
// StoreBargainUser storeBargainUser = storeBargainUserService.getByBargainIdAndUid(cartResponse.getBargainId(), cor.getUserInfo().getUid());
|
||||
// storeBargainUser.setStatus(3);
|
||||
// storeBargainUserService.updateById(storeBargainUser);
|
||||
// }else if (ObjectUtil.isNotNull(cartResponse.getCombinationId()) && cartResponse.getCombinationId() > 0) {
|
||||
// // 判断拼团团长是否存在
|
||||
// StorePink headPink = null;
|
||||
// if (ObjectUtil.isNotNull(cartResponse.getPinkId()) && cartResponse.getPinkId() > 0) {
|
||||
// headPink = storePinkService.getById(cartResponse.getPinkId());
|
||||
// if (ObjectUtil.isNull(headPink) || headPink.getIsRefund().equals(true) || headPink.getStatus() == 3) {
|
||||
// throw new CrmebException("找不到对应的拼团团队信息");
|
||||
// }
|
||||
// }
|
||||
// // 拼团扣减库存
|
||||
// // 拼团商品本身库存扣减
|
||||
// deCountResult = storeCombinationService.decProductStock(
|
||||
// cartResponse.getCombinationId(),
|
||||
// cartResponse.getCartNum(),
|
||||
// Integer.parseInt(cartResponse.getProductAttrUnique()), Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
// // 商品本身扣减库存 更新商品本身库存步骤 1=根据拼团uniuqeId 获取对应sku 2=根据商品ID获取商品sku信息后 对比相等的sku 更新其对应数量
|
||||
// // 拼团对应商品库存扣减
|
||||
// StoreProductAttrValue currentCombinationAttrValue = storeProductAttrValueService.getById(cartResponse.getProductAttrUnique());
|
||||
// List<StoreProductAttrValue> currentCombinationAttrValues = storeProductAttrValueService.getListByProductId(cartResponse.getProductId());
|
||||
// List<StoreProductAttrValue> existAttrValues = currentCombinationAttrValues.stream().filter(e ->
|
||||
// e.getSuk().equals(currentCombinationAttrValue.getSuk()) && e.getType().equals(Constants.PRODUCT_TYPE_NORMAL))
|
||||
// .collect(Collectors.toList());
|
||||
// if(existAttrValues.size() != 1) throw new CrmebException("未找到扣减库存的商品");
|
||||
// deCountResult = storeProductService.decProductStock(
|
||||
// existAttrValues.get(0).getProductId(),
|
||||
// cartResponse.getCartNum(),
|
||||
// existAttrValues.get(0).getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
// // 生成拼团表数据
|
||||
// StoreCombination storeCombination = storeCombinationService.getById(cartResponse.getCombinationId());
|
||||
// StorePink storePink = new StorePink();
|
||||
// storePink.setUid(cor.getUserInfo().getUid());
|
||||
// storePink.setAvatar(cor.getUserInfo().getAvatar());
|
||||
// storePink.setNickname(cor.getUserInfo().getNickname());
|
||||
// storePink.setOrderId(storeOrder.getOrderId());
|
||||
// storePink.setOrderIdKey(storeOrder.getId());
|
||||
// storePink.setTotalNum(storeOrder.getTotalNum());
|
||||
// storePink.setTotalPrice(storeOrder.getTotalPrice());
|
||||
// storePink.setCid(cartResponse.getCombinationId());
|
||||
// storePink.setPid(cartResponse.getProductId());
|
||||
// storePink.setPeople(storeCombination.getPeople());
|
||||
// storePink.setPrice(storeCombination.getPrice());
|
||||
// Integer effectiveTime = storeCombination.getEffectiveTime();// 有效小时数
|
||||
// DateTime dateTime = cn.hutool.core.date.DateUtil.date();
|
||||
// storePink.setAddTime(dateTime.getTime());
|
||||
// if (ObjectUtil.isNotNull(cartResponse.getPinkId()) && cartResponse.getPinkId() > 0) {
|
||||
// storePink.setStopTime(headPink.getStopTime());
|
||||
// } else {
|
||||
// DateTime hourTime = cn.hutool.core.date.DateUtil.offsetHour(dateTime, effectiveTime);
|
||||
// long stopTime = hourTime.getTime();
|
||||
// if (stopTime > storeCombination.getStopTime()) {
|
||||
// stopTime = storeCombination.getStopTime();
|
||||
// }
|
||||
// storePink.setStopTime(stopTime);
|
||||
// }
|
||||
// storePink.setKId(Optional.ofNullable(cartResponse.getPinkId()).orElse(0));
|
||||
// storePink.setIsTpl(false);
|
||||
// storePink.setIsRefund(false);
|
||||
// storePink.setStatus(1);
|
||||
// storePinkService.save(storePink);
|
||||
//
|
||||
// // 如果是开团,需要更新订单数据
|
||||
// if (storePink.getKId() == 0) {
|
||||
// storeOrder.setPinkId(storePink.getId());
|
||||
// storeOrderService.updateById(storeOrder);
|
||||
// }
|
||||
// }else {
|
||||
// // 普通购买扣减库存
|
||||
// deCountResult = storeProductService.decProductStock(
|
||||
// cartResponse.getProductId(),
|
||||
// cartResponse.getCartNum(),
|
||||
// Integer.parseInt(cartResponse.getProductAttrUnique()), Constants.PRODUCT_TYPE_NORMAL);
|
||||
// }
|
||||
// soInfo.setOrderId(storeOrder.getId());
|
||||
// soInfo.setProductId(cartResponse.getProductId());
|
||||
// soInfo.setInfo(JSON.toJSON(cartResponse).toString());
|
||||
// soInfo.setUnique(cartResponse.getProductAttrUnique());
|
||||
// storeOrderInfos.add(soInfo);
|
||||
//
|
||||
// }
|
||||
// // 保存购物车商品详情
|
||||
// boolean saveBatchOrderInfosResult = storeOrderInfoService.saveOrderInfos(storeOrderInfos);
|
||||
// if(!saveBatchOrderInfosResult && !deCountResult){
|
||||
// throw new CrmebException("订单生成失败");
|
||||
// }
|
||||
//
|
||||
// // 删除缓存订单
|
||||
// cacheDeleteOrderInfo(currentUser.getUid(), orderKey);
|
||||
// // 检查缺省的默认地址设置
|
||||
// UserAddress defaultAddress = userAddressService.getDefault();
|
||||
// if(null != defaultAddress){
|
||||
// userAddressService.def(cor.getAddressInfo().getId());
|
||||
// }
|
||||
// storeOrderStatusService.createLog(storeOrder.getId(),
|
||||
// Constants.ORDER_STATUS_CACHE_CREATE_ORDER,"订单生成");
|
||||
// return storeOrder;
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 创建订单
|
||||
* @param request 订单创建参数
|
||||
@@ -982,8 +652,6 @@ public class OrderUtils {
|
||||
// 生成订单日志
|
||||
storeOrderStatusService.createLog(storeOrder.getId(), Constants.ORDER_STATUS_CACHE_CREATE_ORDER, "订单生成");
|
||||
|
||||
// 扣减库存
|
||||
// deductionsStock(cartInfoList, storeOrder, user);
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
if (!execute) {
|
||||
@@ -1120,10 +788,10 @@ public class OrderUtils {
|
||||
// 主商品sku
|
||||
StoreProductAttrValue productAttrValue = storeProductAttrValueService.getByProductIdAndSkuAndType(productId, combinationAttrValue.getSuk(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
if (ObjectUtil.isNull(productAttrValue)) {
|
||||
throw new CrmebException("砍价主商品规格不存在");
|
||||
throw new CrmebException("拼团主商品规格不存在");
|
||||
}
|
||||
if (productAttrValue.getStock() <= 0 || cartNum > productAttrValue.getStock()) {
|
||||
throw new CrmebException("砍价主商品规格库存不足");
|
||||
throw new CrmebException("拼团主商品规格库存不足");
|
||||
}
|
||||
|
||||
MyRecord record = new MyRecord();
|
||||
@@ -1170,48 +838,6 @@ public class OrderUtils {
|
||||
return recordList;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 扣减库存
|
||||
*/
|
||||
private Boolean deductionsStock(List<StoreCartResponse> cartInfoList, StoreOrder storeOrder, User user) {
|
||||
// 活动商品处理,只会有一条数据
|
||||
if (cartInfoList.size() == 1) {
|
||||
StoreCartResponse cartResponse = cartInfoList.get(0);
|
||||
Integer num = cartResponse.getCartNum();
|
||||
Integer attrValueId = Integer.parseInt(cartResponse.getProductAttrUnique());
|
||||
Integer productId = cartResponse.getProductId();
|
||||
// 秒杀商品扣减库存
|
||||
if (ObjectUtil.isNotNull(cartResponse.getSeckillId()) && cartResponse.getSeckillId() > 0) {
|
||||
Integer seckillId = cartResponse.getSeckillId();
|
||||
return storeSeckillService.decProductStock(seckillId, num, attrValueId, productId);
|
||||
}
|
||||
// 砍价扣减库存
|
||||
if (ObjectUtil.isNotNull(cartResponse.getBargainId()) && cartResponse.getBargainId() > 0) {
|
||||
// 砍价扣减库存
|
||||
Integer bargainId = cartResponse.getBargainId();
|
||||
return storeBargainService.decProductStock(bargainId, num, attrValueId, productId, user.getUid());
|
||||
}
|
||||
// 拼团商品扣减库存
|
||||
if (ObjectUtil.isNotNull(cartResponse.getCombinationId()) && cartResponse.getCombinationId() > 0) {
|
||||
Integer combinationId = cartResponse.getCombinationId();
|
||||
Integer pinkId = cartResponse.getPinkId();
|
||||
return storeCombinationService.decProductStock(storeOrder, num, attrValueId, productId, user);
|
||||
}
|
||||
}
|
||||
// 处理普通商品
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
for (StoreCartResponse cartResponse : cartInfoList) {
|
||||
storeProductService.decProductStock(
|
||||
cartResponse.getProductId(),
|
||||
cartResponse.getCartNum(),
|
||||
Integer.parseInt(cartResponse.getProductAttrUnique()), Constants.PRODUCT_TYPE_NORMAL);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
return execute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取可用优惠券
|
||||
* @param storeCartResponse 购物车参数
|
||||
@@ -1322,43 +948,115 @@ public class OrderUtils {
|
||||
vipPrice = vipPrice.add(cartResponse.getVipTruePrice().multiply(BigDecimal.valueOf(cartResponse.getCartNum())));
|
||||
}
|
||||
// 判断是否满额包邮 type=1按件数 2按重量 3按体积
|
||||
Integer storeFreePostageString = Integer.valueOf(systemConfigService.getValueByKey("store_free_postage"));
|
||||
if(storeFreePostageString <= 0){ // 包邮
|
||||
// 全场满额包邮开关
|
||||
String postageSwitchString = systemConfigService.getValueByKey("store_free_postage_switch");
|
||||
// 全场满额包邮金额
|
||||
String storeFreePostageString = systemConfigService.getValueByKey("store_free_postage");
|
||||
if (postageSwitchString.equals("true") && (storeFreePostageString.equals("0") || totalPrice.compareTo(new BigDecimal(storeFreePostageString)) >= 0)) {
|
||||
storePostage = BigDecimal.ZERO;
|
||||
storeFreePostage = BigDecimal.ZERO;
|
||||
}else{
|
||||
if(null != userAddress && userAddress.getCityId() > 0){// 有用户地址的情况下
|
||||
int cityId = userAddress.getCityId();
|
||||
List<StoreProductCartProductInfoResponse> spcpInfo =
|
||||
storeCartResponse.stream().map(StoreCartResponse::getProductInfo).collect(Collectors.toList());
|
||||
List<Integer> tempIds = spcpInfo.stream().map(StoreProductCartProductInfoResponse::getTempId).distinct().collect(Collectors.toList());
|
||||
// 查询运费模版
|
||||
List<ShippingTemplates> shippingTemplates = shippingTemplatesService.getListInIds(tempIds);
|
||||
|
||||
// 包邮
|
||||
List<ShippingTemplatesFree> shippingTempFree = shippingTemplatesFreeService.getListByTempIds(tempIds);
|
||||
|
||||
// 指定区域包邮费用
|
||||
List<ShippingTemplatesRegion> shippingTemplateRegions = shippingTemplatesRegionService.listByIds(tempIds);
|
||||
BigDecimal postPrice;
|
||||
if(!shippingTemplates.get(0).getAppoint() && shippingTemplateRegions.size() > 0){
|
||||
postPrice = shippingTemplateRegions.get(0).getFirstPrice();
|
||||
}else if(shippingTemplates.get(0).getAppoint()){ // 正常配送和运费
|
||||
//todo 首重等计算
|
||||
List<ShippingTemplatesRegion> shippingTemplateRegionsHasCity = shippingTemplatesRegionService.getListInIdsAndCityId(tempIds, cityId);
|
||||
postPrice = shippingTemplateRegionsHasCity.size() > 0 ?
|
||||
shippingTemplateRegionsHasCity.get(0).getFirstPrice() : shippingTemplateRegions.get(0).getFirstPrice();
|
||||
}else{
|
||||
postPrice = shippingTempFree.get(0).getPrice();
|
||||
}
|
||||
storePostage = postPrice;
|
||||
}else{
|
||||
} else{
|
||||
if (ObjectUtil.isNull(userAddress) || userAddress.getCityId() <= 0) {
|
||||
// 用户地址不存在,默认运费为0元
|
||||
storePostage = BigDecimal.ZERO;
|
||||
} else {
|
||||
// 有用户地址的情况下
|
||||
// 运费根据商品计算
|
||||
Map<Integer, MyRecord> proMap = CollUtil.newHashMap();
|
||||
storeCartResponse.stream().forEach(e -> {
|
||||
Integer proId = e.getProductInfo().getId();
|
||||
if (proMap.containsKey(proId)) {
|
||||
MyRecord record = proMap.get(proId);
|
||||
record.set("totalPrice", record.getBigDecimal("totalPrice").add(e.getTruePrice().multiply(BigDecimal.valueOf(e.getCartNum()))));
|
||||
record.set("totalNum", record.getInt("totalNum") + e.getCartNum());
|
||||
BigDecimal weight = e.getProductInfo().getAttrInfo().getWeight().multiply(BigDecimal.valueOf(e.getCartNum()));
|
||||
record.set("weight", record.getBigDecimal("weight").add(weight));
|
||||
BigDecimal volume = e.getProductInfo().getAttrInfo().getVolume().multiply(BigDecimal.valueOf(e.getCartNum()));
|
||||
record.set("volume", record.getBigDecimal("volume").add(volume));
|
||||
} else {
|
||||
MyRecord record = new MyRecord();
|
||||
record.set("totalPrice", e.getTruePrice().multiply(BigDecimal.valueOf(e.getCartNum())));
|
||||
record.set("totalNum", e.getCartNum());
|
||||
record.set("tempId", e.getProductInfo().getTempId());
|
||||
record.set("proId", proId);
|
||||
BigDecimal weight = e.getProductInfo().getAttrInfo().getWeight().multiply(BigDecimal.valueOf(e.getCartNum()));
|
||||
record.set("weight", weight);
|
||||
BigDecimal volume = e.getProductInfo().getAttrInfo().getVolume().multiply(BigDecimal.valueOf(e.getCartNum()));
|
||||
record.set("volume", volume);
|
||||
|
||||
proMap.put(proId, record);
|
||||
}
|
||||
});
|
||||
|
||||
// 指定包邮(单品运费模板)> 指定区域配送(单品运费模板)
|
||||
int cityId = userAddress.getCityId();
|
||||
|
||||
for (Map.Entry<Integer, MyRecord> m : proMap.entrySet()) {
|
||||
MyRecord value = m.getValue();
|
||||
Integer tempId = value.getInt("tempId");
|
||||
ShippingTemplates shippingTemplate = shippingTemplatesService.getById(tempId);
|
||||
if (shippingTemplate.getAppoint()) {// 指定包邮
|
||||
// 判断是否在指定包邮区域内
|
||||
// 必须满足件数 + 金额 才能包邮
|
||||
ShippingTemplatesFree shippingTemplatesFree = shippingTemplatesFreeService.getByTempIdAndCityId(tempId, cityId);
|
||||
if (ObjectUtil.isNotNull(shippingTemplatesFree)) { // 在包邮区域内
|
||||
BigDecimal freeNum = shippingTemplatesFree.getNumber();
|
||||
BigDecimal multiply = value.getBigDecimal("totalPrice");
|
||||
if (new BigDecimal(value.getInt("totalNum")).compareTo(freeNum) >= 0 && multiply.compareTo(shippingTemplatesFree.getPrice()) >= 0) {
|
||||
// 满足件数 + 金额 = 包邮
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 不满足指定包邮条件,走指定区域配送
|
||||
ShippingTemplatesRegion shippingTemplatesRegion = shippingTemplatesRegionService.getByTempIdAndCityId(tempId, cityId);
|
||||
if (ObjectUtil.isNull(shippingTemplatesRegion)) {
|
||||
throw new CrmebException("计算运费时,未找到全国运费配置");
|
||||
}
|
||||
|
||||
// 判断计费方式:件数、重量、体积
|
||||
switch (shippingTemplate.getType()) {
|
||||
case 1: // 件数
|
||||
// 判断件数是否超过首件
|
||||
Integer num = value.getInt("totalNum");
|
||||
if (num <= shippingTemplatesRegion.getFirst().intValue()) {
|
||||
storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
||||
} else {// 超过首件的需要计算续件
|
||||
int renewalNum = num - shippingTemplatesRegion.getFirst().intValue();
|
||||
// 剩余件数/续件 = 需要计算的续件费用的次数
|
||||
BigDecimal divide = new BigDecimal(renewalNum).divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
||||
BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
||||
storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
||||
}
|
||||
break;
|
||||
case 2: // 重量
|
||||
BigDecimal weight = value.getBigDecimal("weight");
|
||||
if (weight.compareTo(shippingTemplatesRegion.getFirst()) <= 0) {
|
||||
storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
||||
} else {// 超过首件的需要计算续件
|
||||
BigDecimal renewalNum = weight.subtract(shippingTemplatesRegion.getFirst());
|
||||
// 剩余件数/续件 = 需要计算的续件费用的次数
|
||||
BigDecimal divide = renewalNum.divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
||||
BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
||||
storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
||||
}
|
||||
break;
|
||||
case 3: // 体积
|
||||
BigDecimal volume = value.getBigDecimal("volume");
|
||||
if (volume.compareTo(shippingTemplatesRegion.getFirst()) <= 0) {
|
||||
storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice());
|
||||
} else {// 超过首件的需要计算续件
|
||||
BigDecimal renewalNum = volume.subtract(shippingTemplatesRegion.getFirst());
|
||||
// 剩余件数/续件 = 需要计算的续件费用的次数
|
||||
BigDecimal divide = renewalNum.divide(shippingTemplatesRegion.getRenewal(), 0, BigDecimal.ROUND_UP);
|
||||
BigDecimal renewalPrice = shippingTemplatesRegion.getRenewalPrice().multiply(divide);
|
||||
storePostage = storePostage.add(shippingTemplatesRegion.getFirstPrice()).add(renewalPrice);
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
// 判断价格是否超出满额包邮价格
|
||||
// if(storeFreePostage.compareTo(totalPrice) <= -1) storePostage = BigDecimal.ZERO;
|
||||
}
|
||||
// storePostage = BigDecimal.TEN;
|
||||
// storeFreePostage = BigDecimal.ONE;
|
||||
priceGroupResponse.setStorePostage(storePostage);
|
||||
priceGroupResponse.setStoreFreePostage(storeFreePostage);
|
||||
priceGroupResponse.setTotalPrice(totalPrice);
|
||||
@@ -1443,11 +1141,6 @@ public class OrderUtils {
|
||||
*/
|
||||
public void checkDeleteStatus(String orderStatus) {
|
||||
//退款状态,持可以添加
|
||||
|
||||
// String [] deleteStatusList = {
|
||||
// Constants.ORDER_STATUS_UNPAID,
|
||||
// Constants.ORDER_STATUS_REFUNDED
|
||||
// };
|
||||
String [] deleteStatusList = {
|
||||
Constants.ORDER_STATUS_COMPLETE
|
||||
};
|
||||
@@ -1457,26 +1150,6 @@ public class OrderUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// /**
|
||||
// * 缓存再次下单数据 todo 再次下单缓存key待统一优化
|
||||
// * @param cacheKey key
|
||||
// * @param orderAgainCache 再次下单数据
|
||||
// */
|
||||
// public void setCacheOrderAgain(String cacheKey, List<StoreCartResponse> orderAgainCache){
|
||||
// String d = JSONObject.toJSONString(orderAgainCache);
|
||||
// redisUtil.set(cacheKey+"", d, Constants.ORDER_CASH_CONFIRM, TimeUnit.MINUTES);
|
||||
// }
|
||||
|
||||
// /**
|
||||
// * 获取再次下单缓存数据 todo 再次下单缓存key待统一优化
|
||||
// * @param cacheKey key
|
||||
// */
|
||||
// public List<StoreCartResponse> getCacheOrderAgain(String cacheKey){
|
||||
// if(!redisUtil.exists(cacheKey)) return null;
|
||||
// return JSONObject.parseArray(redisUtil.get(cacheKey).toString(),StoreCartResponse.class);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 订单数据缓存进redis订单通用
|
||||
* @param user 订单缓存key
|
||||
|
||||
@@ -14,7 +14,9 @@ import com.zbkj.crmeb.combination.request.StoreCombinationRequest;
|
||||
import com.zbkj.crmeb.combination.service.StoreCombinationService;
|
||||
import com.zbkj.crmeb.front.response.ProductActivityItemResponse;
|
||||
import com.zbkj.crmeb.seckill.model.StoreSeckill;
|
||||
import com.zbkj.crmeb.seckill.model.StoreSeckillManger;
|
||||
import com.zbkj.crmeb.seckill.request.StoreSeckillRequest;
|
||||
import com.zbkj.crmeb.seckill.service.StoreSeckillMangerService;
|
||||
import com.zbkj.crmeb.seckill.service.StoreSeckillService;
|
||||
import com.zbkj.crmeb.store.model.StoreProduct;
|
||||
import com.zbkj.crmeb.store.model.StoreProductAttr;
|
||||
@@ -66,6 +68,9 @@ public class ProductUtils {
|
||||
@Autowired
|
||||
private StoreSeckillService storeSeckillService;
|
||||
|
||||
@Autowired
|
||||
private StoreSeckillMangerService storeSeckillMangerService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainService storeBargainService;
|
||||
|
||||
@@ -349,35 +354,6 @@ public class ProductUtils {
|
||||
spattr.setAttrValues(attrValues.toString());
|
||||
productRequest.setSpecType(false);
|
||||
productRequest.setAttr(spaAttes);
|
||||
// if(null == data.optJSONArray("passSubList")){
|
||||
// return productRequest;
|
||||
// }
|
||||
// JSONArray props = data.getJSONArray("passSubList");
|
||||
// if (null == props){
|
||||
// return productRequest;
|
||||
// }
|
||||
// if (props.length() > 0) {
|
||||
// List<StoreProductAttr> spaAttes = new ArrayList<>();
|
||||
// for (int i = 0; i < props.length(); i++) {
|
||||
// JSONObject pItem = props.getJSONObject(i);
|
||||
// Iterator it = pItem.keys();
|
||||
// while (it.hasNext()){
|
||||
// String key = (String)it.next();
|
||||
// JSONArray skuItems = pItem.getJSONArray(key);
|
||||
// List<String> attrValues = new ArrayList<>();
|
||||
// StoreProductAttr spattr = new StoreProductAttr();
|
||||
// for (int j = 0; j < skuItems.length(); j++) {
|
||||
// JSONObject skuItem = skuItems.getJSONObject(j);
|
||||
// if(null != skuItem.optString("characterValueDisplayName"))
|
||||
// attrValues.add(skuItem.getString("characterValueDisplayName"));
|
||||
// }
|
||||
// spattr.setAttrName(key);
|
||||
// spattr.setAttrValues(attrValues.toString());
|
||||
// spaAttes.add(spattr);
|
||||
// }
|
||||
// productRequest.setAttr(spaAttes);
|
||||
// }
|
||||
// }
|
||||
return productRequest;
|
||||
}
|
||||
|
||||
@@ -441,33 +417,6 @@ public class ProductUtils {
|
||||
return sb.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据url访问99api后返回对应的平台的产品json数据 带有body参数,暂时无用
|
||||
* @param url
|
||||
* @param body
|
||||
* @return
|
||||
* @throws IOException
|
||||
* @throws JSONException
|
||||
*/
|
||||
public JSONObject postRequestFromUrl(String url, String body) throws IOException, JSONException {
|
||||
URL realUrl = new URL(url);
|
||||
URLConnection conn = realUrl.openConnection();
|
||||
conn.setDoOutput(true);
|
||||
conn.setDoInput(true);
|
||||
PrintWriter out = new PrintWriter(conn.getOutputStream());
|
||||
out.print(body);
|
||||
out.flush();
|
||||
InputStream instream = conn.getInputStream();
|
||||
try {
|
||||
BufferedReader rd = new BufferedReader(new InputStreamReader(instream, Charset.forName("UTF-8")));
|
||||
String jsonText = readAll(rd);
|
||||
JSONObject json = new JSONObject(jsonText);
|
||||
return json;
|
||||
} finally {
|
||||
instream.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据url访问99api后返回对应的平台的产品json数据
|
||||
* @param url
|
||||
@@ -575,17 +524,19 @@ public class ProductUtils {
|
||||
|
||||
List<Integer> activitys = CrmebUtil.stringToArrayInt(activity);
|
||||
for (Integer code : activitys) {
|
||||
if(code == 0){
|
||||
|
||||
}
|
||||
if(code == 1){ // 查找秒杀信息
|
||||
List<StoreSeckill> currentSecKills = storeSeckillService.getCurrentSecKillByProductId(productId);
|
||||
if(null != currentSecKills && currentSecKills.size() > 0){
|
||||
ProductActivityItemResponse seckillResponse = new ProductActivityItemResponse();
|
||||
seckillResponse.setId(currentSecKills.get(0).getId());
|
||||
seckillResponse.setTime(DateUtil.getSecondTimestamp(currentSecKills.get(0).getStopTime()));
|
||||
seckillResponse.setType(Constants.PRODUCT_TYPE_SECKILL+"");
|
||||
result.put(code,seckillResponse);
|
||||
// 查询当前秒杀活动时间段配置信息
|
||||
StoreSeckillManger secKillManager = storeSeckillMangerService.getById(currentSecKills.get(0).getTimeId());
|
||||
// 将当前时间段转化成时间戳
|
||||
int secKillEndSecondTimestamp =
|
||||
DateUtil.getSecondTimestamp(DateUtil.nowDateTime("yyyy-MM-dd " + secKillManager.getEndTime() + ":00:00"));
|
||||
ProductActivityItemResponse secKillResponse = new ProductActivityItemResponse();
|
||||
secKillResponse.setId(currentSecKills.get(0).getId());
|
||||
secKillResponse.setTime(secKillEndSecondTimestamp);
|
||||
secKillResponse.setType(Constants.PRODUCT_TYPE_SECKILL+"");
|
||||
result.put(code,secKillResponse);
|
||||
}
|
||||
}
|
||||
if(code == 2){ // 查找砍价信息
|
||||
@@ -677,24 +628,6 @@ public class ProductUtils {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 解析json字符串 返回对应对象的数据
|
||||
* @param storeProductRequest
|
||||
* @return
|
||||
*/
|
||||
// private List<StoreProductAttrValueRequest> getStoreProductAttrValueRequests(StoreProductRequest storeProductRequest) {
|
||||
// List<StoreProductAttrValueRequest> storeProductAttrValuesRequest = new ArrayList<>();
|
||||
// com.alibaba.fastjson.JSONArray attrJSONArray = com.alibaba.fastjson.JSONArray.parseArray(storeProductRequest.getAttrValue());
|
||||
// for (int i = 0; i < attrJSONArray.size(); i++) {
|
||||
// com.alibaba.fastjson.JSONObject jsonObject = attrJSONArray.getJSONObject(i);
|
||||
// StoreProductAttrValueRequest attrValueRequest =
|
||||
// com.alibaba.fastjson.JSONObject.parseObject(String.valueOf(jsonObject), StoreProductAttrValueRequest.class);
|
||||
// storeProductAttrValuesRequest.add(attrValueRequest);
|
||||
// }
|
||||
// return storeProductAttrValuesRequest;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 产品保存和更新时设置attr和attrValues属性
|
||||
* @param storeProductRequest 产品属性
|
||||
@@ -706,29 +639,6 @@ public class ProductUtils {
|
||||
attrValues.put("attrValue", storeProductRequest.getAttrValue());
|
||||
return attrValues;
|
||||
}
|
||||
// public static void main(String[] args) throws IOException, JSONException {
|
||||
// // 请求示例 url 默认请求参数已经做URL编码
|
||||
// // 淘宝API
|
||||
// String tbUrl = "https://api03.6bqb.com/taobao/detail?apikey=A5E94A9B7EBEBE9BB305680C0EE23885&itemid=16793826526";
|
||||
// // 京东
|
||||
// String jdUrl = "https://api03.6bqb.com/jd/detail?apikey=A5E94A9B7EBEBE9BB305680C0EE23885&itemid=10000017776";
|
||||
// // 苏宁
|
||||
// String snUrl = "https://api03.6bqb.com/suning/detail?apikey=A5E94A9B7EBEBE9BB305680C0EE23885&itemid=10750373914&shopid=0070088010";
|
||||
// // 拼多多
|
||||
// String pddUrl = "https://api03.6bqb.com/pdd/detail?apikey=A5E94A9B7EBEBE9BB305680C0EE23885&itemid=5914165983";
|
||||
// CopyProduct cp = new CopyProduct();
|
||||
//// JSONObject tbJson = cp.getRequestFromUrl(tbUrl);
|
||||
//// System.out.println("淘宝产品"+tbJson.toString());
|
||||
//// JSONObject jdJson = cp.getRequestFromUrl(jdUrl);
|
||||
//// System.out.println("京东产品"+jdJson.toString());
|
||||
//// JSONObject snJson = cp.getRequestFromUrl(snUrl);
|
||||
//// System.out.println("苏宁产品"+snJson.toString());
|
||||
// JSONObject pddJson = cp.getRequestFromUrl(pddUrl);
|
||||
//
|
||||
// System.out.println("拼多多产品"+pddJson.toString());
|
||||
//
|
||||
// cp.getTaobaoProductInfo("",0);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 一号通复制商品转公共商品参数
|
||||
@@ -780,4 +690,4 @@ public class ProductUtils {
|
||||
return productRequest;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -66,7 +66,7 @@ public class SystemUserLevelRequest implements Serializable {
|
||||
private String icon;
|
||||
|
||||
@ApiModelProperty(value = "会员卡背景")
|
||||
@NotBlank(message = "会员卡背景不能为空")
|
||||
// @NotBlank(message = "会员卡背景不能为空")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "是否显示 1=显示,0=隐藏")
|
||||
|
||||
@@ -60,10 +60,6 @@ public interface SystemAdminService extends IService<SystemAdmin> {
|
||||
|
||||
SystemAdmin getInfo();
|
||||
|
||||
SystemAdminResponse weChatAuthorizeLogin(String code, String ip) throws Exception;
|
||||
|
||||
Boolean unBind();
|
||||
|
||||
void bind(String wxCode, Integer adminId);
|
||||
|
||||
Boolean updateStatus(Integer id, Boolean status);
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.zbkj.crmeb.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.system.model.SystemAttachment;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.upload.vo.FileResultVo;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -1,10 +1,5 @@
|
||||
package com.zbkj.crmeb.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.system.model.SystemCity;
|
||||
import com.zbkj.crmeb.system.request.SystemCityRequest;
|
||||
import com.zbkj.crmeb.system.request.SystemCitySearchRequest;
|
||||
|
||||
/**
|
||||
* SystemCityAsyncService 接口
|
||||
* +----------------------------------------------------------------------
|
||||
@@ -17,8 +12,9 @@ import com.zbkj.crmeb.system.request.SystemCitySearchRequest;
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public interface SystemCityAsyncService{
|
||||
public interface SystemCityAsyncService {
|
||||
|
||||
void async(Integer id);
|
||||
|
||||
void setListTree();
|
||||
}
|
||||
|
||||
@@ -29,8 +29,6 @@ public interface SystemCityService extends IService<SystemCity> {
|
||||
|
||||
Object getListTree();
|
||||
|
||||
String getStringNameInId(String cityIdList);
|
||||
|
||||
List<Integer> getCityIdList();
|
||||
|
||||
SystemCity getCityByCityId(Integer cityId);
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
package com.zbkj.crmeb.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.express.vo.ExpressSheetVo;
|
||||
import com.zbkj.crmeb.system.model.SystemConfig;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.system.request.SystemFormCheckRequest;
|
||||
|
||||
import java.util.HashMap;
|
||||
@@ -43,11 +43,6 @@ public interface SystemConfigService extends IService<SystemConfig> {
|
||||
|
||||
boolean checkName(String name);
|
||||
|
||||
/**
|
||||
* 获取系统电子面单信息
|
||||
*/
|
||||
ExpressSheetVo getExpressSheet();
|
||||
|
||||
/**
|
||||
* 获取面单默认配置信息
|
||||
* @return
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.zbkj.crmeb.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.system.model.SystemFormTemp;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.system.request.SystemFormCheckRequest;
|
||||
import com.zbkj.crmeb.system.request.SystemFormTempSearchRequest;
|
||||
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
package com.zbkj.crmeb.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.front.request.StoreNearRequest;
|
||||
import com.zbkj.crmeb.front.response.StoreNearResponse;
|
||||
import com.zbkj.crmeb.system.model.SystemStore;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.system.request.SystemStoreRequest;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
package com.zbkj.crmeb.system.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.system.model.SystemUserLevel;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.zbkj.crmeb.system.request.SystemUserLevelRequest;
|
||||
import com.zbkj.crmeb.system.request.SystemUserLevelSearchRequest;
|
||||
|
||||
@@ -24,8 +24,6 @@ public interface SystemUserLevelService extends IService<SystemUserLevel> {
|
||||
|
||||
List<SystemUserLevel> getList(SystemUserLevelSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
List<SystemUserLevel> getGradeListByLevelId(Integer levelId);
|
||||
|
||||
boolean create(SystemUserLevelRequest request);
|
||||
|
||||
boolean update(Integer id, SystemUserLevelRequest request);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user