紧急修复了一些bug
This commit is contained in:
@@ -2,8 +2,9 @@ package com.common;
|
||||
|
||||
import com.constants.Constants;
|
||||
import com.utils.RedisUtil;
|
||||
import com.utils.RequestUtil;
|
||||
import com.utils.ThreadLocalUtil;
|
||||
import com.zbkj.crmeb.authorization.model.TokenModel;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -23,7 +24,7 @@ public class CheckFrontToken {
|
||||
@Autowired
|
||||
protected RedisUtil redisUtil;
|
||||
|
||||
public Boolean check(String token){
|
||||
public Boolean check(String token, HttpServletRequest request){
|
||||
|
||||
try {
|
||||
boolean exists = redisUtil.exists(Constants.USER_TOKEN_REDIS_KEY_PREFIX + token);
|
||||
@@ -35,13 +36,29 @@ public class CheckFrontToken {
|
||||
ThreadLocalUtil.set(hashedMap);
|
||||
|
||||
redisUtil.set(Constants.USER_TOKEN_REDIS_KEY_PREFIX +token, value, Constants.TOKEN_EXPRESS_MINUTES, TimeUnit.MINUTES);
|
||||
}else{
|
||||
//判断路由,部分路由不管用户是否登录/token过期都可以访问
|
||||
exists = checkRouter(RequestUtil.getUri(request));
|
||||
}
|
||||
|
||||
|
||||
return exists;
|
||||
}catch (Exception e){
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
//路由在此处,则返回true,无论用户是否登录都可以访问
|
||||
public boolean checkRouter(String uri) {
|
||||
String[] routerList = {
|
||||
"api/front/product/detail",
|
||||
"api/front/coupons",
|
||||
"api/front/index"
|
||||
};
|
||||
|
||||
return ArrayUtils.contains(routerList, uri);
|
||||
}
|
||||
|
||||
public String getTokenFormRequest(HttpServletRequest request){
|
||||
return request.getHeader(Constants.HEADER_AUTHORIZATION_KEY);
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ package com.constants;
|
||||
* @since 2020/4/1415:46
|
||||
*/
|
||||
public class Constants {
|
||||
public static final long TOKEN_EXPRESS_MINUTES = (60 * 24);
|
||||
public static final long TOKEN_EXPRESS_MINUTES = (60 * 1); //1小时
|
||||
|
||||
public static final int NUM_ZERO = 0;
|
||||
public static final int NUM_ONE = 1;
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.interceptor;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.common.CheckFrontToken;
|
||||
import com.common.CommonResult;
|
||||
import com.utils.RequestUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.servlet.HandlerInterceptor;
|
||||
import org.springframework.web.servlet.ModelAndView;
|
||||
@@ -22,11 +23,17 @@ public class FrontTokenInterceptor implements HandlerInterceptor {
|
||||
String token = checkFrontToken.getTokenFormRequest(request);
|
||||
|
||||
if(token == null || token.isEmpty()){
|
||||
//判断路由,部分路由不管用户是否登录都可以访问
|
||||
boolean result = checkFrontToken.checkRouter(RequestUtil.getUri(request));
|
||||
if(result){
|
||||
return true;
|
||||
}
|
||||
|
||||
response.getWriter().write(JSONObject.toJSONString(CommonResult.unauthorized()));
|
||||
return false;
|
||||
}
|
||||
|
||||
Boolean result = checkFrontToken.check(token);
|
||||
Boolean result = checkFrontToken.check(token, request);
|
||||
if(!result){
|
||||
response.getWriter().write(JSONObject.toJSONString(CommonResult.unauthorized()));
|
||||
return false;
|
||||
|
||||
@@ -16,6 +16,7 @@ import java.math.BigInteger;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.Key;
|
||||
import java.security.Security;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.*;
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
@@ -739,4 +740,15 @@ public class CrmebUtil {
|
||||
String result = CrmebUtil.mapToStringUrl(map) + "&key=" + signKey;
|
||||
return DigestUtils.md5Hex(result).toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查是否可以转换int
|
||||
* @param str
|
||||
* @return
|
||||
*/
|
||||
public static boolean isString2Num(String str){
|
||||
Pattern pattern = Pattern.compile("^[0-9]*$");
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
return matcher.matches();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,10 +17,7 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
|
||||
/**
|
||||
@@ -62,7 +59,7 @@ public class ArticleController {
|
||||
*/
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@Validated ArticleRequest articleRequest){
|
||||
public CommonResult<String> save(@RequestBody @Validated ArticleRequest articleRequest){
|
||||
Article article = new Article();
|
||||
BeanUtils.copyProperties(articleRequest, article);
|
||||
article.setImageInput(systemAttachmentService.clearPrefix(article.getImageInput()));
|
||||
@@ -124,7 +121,7 @@ public class ArticleController {
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<String> update(@RequestParam Integer id, @Validated ArticleRequest articleRequest){
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated ArticleRequest articleRequest){
|
||||
Article article = new Article();
|
||||
BeanUtils.copyProperties(articleRequest, article);
|
||||
article.setId(id);
|
||||
|
||||
@@ -99,6 +99,7 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleDao, Article> impleme
|
||||
BeanUtils.copyProperties(article, articleVo);
|
||||
if(!StringUtils.isBlank(article.getImageInput()) ){
|
||||
articleVo.setImageInput(CrmebUtil.jsonToListString(article.getImageInput()));
|
||||
articleVo.setImageInputs(article.getImageInput());
|
||||
}
|
||||
articleVoArrayList.add(articleVo);
|
||||
}
|
||||
|
||||
@@ -46,9 +46,12 @@ public class ArticleVo implements Serializable {
|
||||
@ApiModelProperty(value = "文章作者")
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty(value = "文章图片")
|
||||
@ApiModelProperty(value = "文章图片 前端用")
|
||||
private List<String> imageInput = new ArrayList<>();
|
||||
|
||||
@ApiModelProperty(value = "文章图片 后端用")
|
||||
private String imageInputs;
|
||||
|
||||
@ApiModelProperty(value = "文章简介")
|
||||
private String synopsis;
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@ import com.exception.CrmebException;
|
||||
import com.utils.RedisUtil;
|
||||
import com.utils.ThreadLocalUtil;
|
||||
import com.zbkj.crmeb.authorization.model.TokenModel;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
@@ -81,7 +82,10 @@ public class TokenManagerImpl implements TokenManager {
|
||||
*/
|
||||
@Override
|
||||
public Object getLocalInfo(String key) {
|
||||
return ThreadLocalUtil.get(key);
|
||||
if(StringUtils.isNotBlank(key)){
|
||||
return ThreadLocalUtil.get(key);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -91,15 +91,15 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
excludePathPatterns("/api/front/share").
|
||||
excludePathPatterns("/api/front/article/**").
|
||||
excludePathPatterns("/api/front/city/**").
|
||||
excludePathPatterns("/api/front/product/**").
|
||||
excludePathPatterns("/api/front/product/hot").
|
||||
excludePathPatterns("/api/front/products/**").
|
||||
excludePathPatterns("/api/front/reply/**").
|
||||
excludePathPatterns("/api/front/user/service/**").
|
||||
excludePathPatterns("/api/front/coupons").
|
||||
excludePathPatterns("/api/front/logistics").
|
||||
excludePathPatterns("/api/front/groom/list/**").
|
||||
excludePathPatterns("/api/front/index").
|
||||
excludePathPatterns("/api/front/category").
|
||||
// excludePathPatterns("/api/front/cart/count").
|
||||
excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
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;
|
||||
@@ -30,5 +28,5 @@ public class ShippingTemplatesSearchRequest implements Serializable {
|
||||
|
||||
|
||||
@ApiModelProperty(value = "模板名称")
|
||||
private String name;
|
||||
private String keywords;
|
||||
}
|
||||
|
||||
@@ -51,8 +51,8 @@ public class ShippingTemplatesServiceImpl extends ServiceImpl<ShippingTemplatesD
|
||||
public List<ShippingTemplates> getList(ShippingTemplatesSearchRequest request, PageParamRequest pageParamRequest) {
|
||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<ShippingTemplates> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if(!StringUtils.isBlank(request.getName())){
|
||||
lambdaQueryWrapper.eq(ShippingTemplates::getName, request.getName());
|
||||
if(!StringUtils.isBlank(request.getKeywords())){
|
||||
lambdaQueryWrapper.like(ShippingTemplates::getName, request.getKeywords());
|
||||
}
|
||||
lambdaQueryWrapper.orderByDesc(ShippingTemplates::getSort).orderByDesc(ShippingTemplates::getId);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
|
||||
@@ -97,7 +97,7 @@ public class UserController {
|
||||
@ApiOperation(value = "当前登录用户信息")
|
||||
@RequestMapping(value = "/userinfo", method = RequestMethod.GET)
|
||||
public CommonResult<User> getInfo(){
|
||||
return CommonResult.success(userService.getInfo());
|
||||
return CommonResult.success(userService.getUserPromoter());
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -36,5 +36,7 @@ public class LoginRequest implements Serializable {
|
||||
@Pattern(regexp = RegularConstants.PASSWORD, message = "密码格式错误,密码必须以字母开头,长度在6~18之间,只能包含字符、数字和下划线")
|
||||
private String password;
|
||||
|
||||
|
||||
}
|
||||
@ApiModelProperty(value = "推广人id")
|
||||
@JsonProperty(value = "spread_spid")
|
||||
private Integer spreadPid = 0;
|
||||
}
|
||||
@@ -133,4 +133,16 @@ public class UserCenterResponse implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "订单状态数量")
|
||||
private UserCenterOrderStatusNumResponse orderStatusNum;
|
||||
|
||||
@ApiModelProperty(value = "用户优惠券数量")
|
||||
private Integer couponCount;
|
||||
|
||||
@ApiModelProperty(value = "是否会员")
|
||||
private boolean vip;
|
||||
|
||||
@ApiModelProperty(value = "会员图标")
|
||||
private String vipIcon;
|
||||
|
||||
@ApiModelProperty(value = "会员名称")
|
||||
private String vipName;
|
||||
}
|
||||
|
||||
@@ -154,14 +154,10 @@ public class IndexServiceImpl implements IndexService {
|
||||
|
||||
indexInfoResponse.setLogoUrl(systemConfigService.getValueByKey(Constants.CONFIG_KEY_SITE_LOGO));
|
||||
|
||||
Integer userId = userService.getUserId();
|
||||
|
||||
if(userId > 0){
|
||||
User user = userService.getById(userId);
|
||||
User user = userService.getInfo();
|
||||
if(null != user){
|
||||
indexInfoResponse.setSubscribe(user.getSubscribe());
|
||||
|
||||
}
|
||||
|
||||
return indexInfoResponse;
|
||||
}
|
||||
|
||||
|
||||
@@ -488,8 +488,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
StoreOrder storeOrderPram = new StoreOrder();
|
||||
// storeOrderPram.setStatus(status);
|
||||
storeOrderPram.setUid(currentUser.getUid());
|
||||
storeOrderPram.setIsDel(false);
|
||||
storeOrderPram.setIsSystemDel(false);
|
||||
// storeOrderPram.setIsDel(false);
|
||||
// storeOrderPram.setIsSystemDel(false);
|
||||
storeOrderPram.setStatus(status);
|
||||
|
||||
List<StoreOrder> orderList = storeOrderService.getUserOrderList(storeOrderPram, pageRequest);
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zbkj.crmeb.front.service.impl;
|
||||
import com.common.CommonPage;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.utils.CrmebUtil;
|
||||
import com.zbkj.crmeb.category.model.Category;
|
||||
@@ -143,49 +144,55 @@ public class ProductServiceImpl implements ProductService {
|
||||
@Override
|
||||
public ProductDetailResponse getDetail(Integer id) {
|
||||
ProductDetailResponse productDetailResponse = new ProductDetailResponse();
|
||||
StoreProductResponse productResponse = storeProductService.getByProductId(id);
|
||||
StoreProductStoreInfoResponse storeInfo = new StoreProductStoreInfoResponse();
|
||||
try {
|
||||
StoreProductResponse productResponse = storeProductService.getByProductId(id);
|
||||
StoreProductStoreInfoResponse storeInfo = new StoreProductStoreInfoResponse();
|
||||
|
||||
BeanUtils.copyProperties(productResponse,storeInfo);
|
||||
BeanUtils.copyProperties(productResponse,storeInfo);
|
||||
|
||||
// 设置点赞和收藏
|
||||
User current = userService.getInfo();
|
||||
if(null != current){
|
||||
storeInfo.setUserLike(storeProductRelationService.getLikeOrCollectByUser(current.getUid(),id,true).size() > 0);
|
||||
storeInfo.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(current.getUid(),id,false).size() > 0);
|
||||
}
|
||||
productDetailResponse.setStoreInfo(storeInfo);
|
||||
// 设置点赞和收藏
|
||||
User user = userService.getInfo();
|
||||
if(null != user){
|
||||
if(null != user.getUid()){
|
||||
storeInfo.setUserLike(storeProductRelationService.getLikeOrCollectByUser(user.getUid(),id,true).size() > 0);
|
||||
storeInfo.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(),id,false).size() > 0);
|
||||
user = userService.updateForPromoter(user);
|
||||
productDetailResponse.setPriceName(getPacketPriceRange(productResponse,user.getIsPromoter()));
|
||||
}
|
||||
}
|
||||
storeInfo.setUserLike(false);
|
||||
storeInfo.setUserCollect(false);
|
||||
productDetailResponse.setPriceName("0");
|
||||
productDetailResponse.setStoreInfo(storeInfo);
|
||||
|
||||
// 根据制式设置attr属性
|
||||
setSkuAttr(id, productDetailResponse, productResponse);
|
||||
// 根据制式设置sku属性
|
||||
HashMap<String,Object> skuMap = new HashMap<>();
|
||||
for (StoreProductAttrValueResponse attrValue : productResponse.getAttrValue()) {
|
||||
skuMap.put(attrValue.getSuk(),attrValue);
|
||||
}
|
||||
// 根据制式设置attr属性
|
||||
setSkuAttr(id, productDetailResponse, productResponse);
|
||||
// 根据制式设置sku属性
|
||||
HashMap<String,Object> skuMap = new HashMap<>();
|
||||
for (StoreProductAttrValueResponse attrValue : productResponse.getAttrValue()) {
|
||||
skuMap.put(attrValue.getSuk(),attrValue);
|
||||
}
|
||||
// for (HashMap<String, Object> attrValue : productResponse.getAttrValues()) {
|
||||
// System.out.println("attrValue:"+attrValue);
|
||||
// skuMap.putAll(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); // todo 暂放 设置优品推荐中的拼团砍价秒杀属性
|
||||
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); // todo 暂放 设置优品推荐中的拼团砍价秒杀属性
|
||||
// sPRecommendResponse.setCheckCoupon(storeCouponService.getListByUser(product.getId()).size() > 0);
|
||||
storeProductRecommendResponses.add(sPRecommendResponse);
|
||||
}
|
||||
productDetailResponse.setGoodList(storeProductRecommendResponses);
|
||||
storeProductRecommendResponses.add(sPRecommendResponse);
|
||||
}
|
||||
productDetailResponse.setGoodList(storeProductRecommendResponses);
|
||||
|
||||
|
||||
// 当前商品的佣金区间
|
||||
if(null != current){
|
||||
current = userService.updateForPromoter(current);
|
||||
productDetailResponse.setPriceName(getPacketPriceRange(productResponse,current.getIsPromoter()));
|
||||
}catch (Exception e){
|
||||
throw new CrmebException(e.getMessage());
|
||||
}
|
||||
|
||||
return productDetailResponse;
|
||||
}
|
||||
|
||||
|
||||
@@ -181,6 +181,7 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
storeCouponUser.setMinPrice(storeCoupon.getMinPrice());
|
||||
storeCouponUser.setStartTime(storeCoupon.getUseStartTime());
|
||||
storeCouponUser.setEndTime(storeCoupon.getUseEndTime());
|
||||
storeCouponUser.setUseType(storeCoupon.getUseType());
|
||||
storeCouponUserList.add(storeCouponUser);
|
||||
}
|
||||
|
||||
@@ -332,6 +333,7 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
storeCouponUser.setType(type);
|
||||
storeCouponUser.setStartTime(storeCoupon.getUseStartTime());
|
||||
storeCouponUser.setEndTime(storeCoupon.getUseEndTime());
|
||||
storeCouponUser.setUseType(storeCoupon.getUseType());
|
||||
storeCouponUserList.add(storeCouponUser);
|
||||
}
|
||||
|
||||
@@ -428,7 +430,7 @@ public class StoreCouponUserServiceImpl extends ServiceImpl<StoreCouponUserDao,
|
||||
request.setUid(userId);
|
||||
PageInfo<StoreCouponUserResponse> list = getList(request, pageParamRequest);
|
||||
|
||||
if(list.getList().size() < 1){
|
||||
if(null == list.getList() || list.getList().size() < 1){
|
||||
return null;
|
||||
}
|
||||
Date date = DateUtil.nowDateTime();
|
||||
|
||||
@@ -82,7 +82,8 @@ public class StoreProductController {
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<String> delete(@RequestBody @PathVariable Integer id){
|
||||
if(storeProductService.removeById(id)){
|
||||
if(storeProductService.deleteProduct(id)){
|
||||
// if(storeProductService.removeById(id)){
|
||||
storeCartService.productStatusNotEnable(id);
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
|
||||
@@ -139,6 +139,7 @@ public class StoreProductReplyController {
|
||||
lup.eq(StoreProductReply::getId, id);
|
||||
lup.set(StoreProductReply::getMerchantReplyContent, request.getMerchantReplyContent());
|
||||
lup.set(StoreProductReply::getMerchantReplyTime, DateUtil.getNowTime());
|
||||
lup.set(StoreProductReply::getIsReply, true);
|
||||
storeProductReplyService.update(lup);
|
||||
}
|
||||
return CommonResult.success();
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zbkj.crmeb.store.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableLogic;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -105,6 +107,7 @@ public class StoreProduct implements Serializable {
|
||||
@ApiModelProperty(value = "是否包邮")
|
||||
private Boolean isPostage;
|
||||
|
||||
// @TableLogic
|
||||
@ApiModelProperty(value = "是否删除")
|
||||
private Boolean isDel;
|
||||
|
||||
|
||||
@@ -30,7 +30,7 @@ public class StoreOrderSearchRequest {
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "创建时间区间")
|
||||
private String timeRage;
|
||||
private String dateLimit;
|
||||
|
||||
@ApiModelProperty(value = "订单状态(all 总数; 未支付 unPaid; 未发货 notShipped;待收货 spike;待评价 bargain;已完成 complete;待核销 toBeWrittenOff;退款中:refunding;已退款:refunded;已删除:deleted")
|
||||
private String status;
|
||||
|
||||
@@ -12,6 +12,7 @@ import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.LinkedHashMap;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -91,7 +92,7 @@ public class StoreProductAttrValueRequest implements Serializable {
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "attrValue字段,前端传递后用作sku字段")
|
||||
private HashMap<String,String> attrValue;
|
||||
private LinkedHashMap<String,String> attrValue;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -35,6 +35,9 @@ public class StoreProductReplySearchRequest implements Serializable {
|
||||
@ApiModelProperty(value = "商品id, 多个逗号分割")
|
||||
private String productId;
|
||||
|
||||
@ApiModelProperty(value = "商品名称, 关键字,产品编号")
|
||||
private String productSearch;
|
||||
|
||||
@ApiModelProperty(value = "0未删除1已删除")
|
||||
private Boolean isDel;
|
||||
|
||||
|
||||
@@ -114,4 +114,11 @@ public interface StoreProductService extends IService<StoreProduct> {
|
||||
boolean decProductStock(Integer productId, Integer num, Integer attrValueId, Integer type);
|
||||
|
||||
List<Integer> getSecondaryCategoryByProductId(String productId);
|
||||
|
||||
/**
|
||||
* 删除商品
|
||||
* @param productId 商品id
|
||||
* @return 删除结果
|
||||
*/
|
||||
boolean deleteProduct(Integer productId);
|
||||
}
|
||||
|
||||
@@ -24,6 +24,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @Classname RetailShopServiceImpl
|
||||
@@ -59,7 +60,8 @@ public class RetailShopServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
@Override
|
||||
public PageInfo<RetailShopUserResponse> getList(String keywords, String dateLimit, PageParamRequest pageRequest) {
|
||||
Page<User> pageUserPage = PageHelper.startPage(pageRequest.getPage(), pageRequest.getLimit());
|
||||
User currentUser = userService.getInfo();
|
||||
|
||||
// User currentUser = userService.getUserByEntity();
|
||||
UserSearchRequest userSearchRequest = new UserSearchRequest();
|
||||
userSearchRequest.setStatus(true);
|
||||
userSearchRequest.setIsPromoter(true);
|
||||
@@ -80,8 +82,12 @@ public class RetailShopServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
|
||||
for (RetailShopUserResponse rShopUser:retailShopUserResponses) {
|
||||
// 推广用户数量
|
||||
List<Integer> userIds = new ArrayList<>();
|
||||
userIds.add(currentUser.getUid());
|
||||
// List<Integer> userIds = new ArrayList<>();
|
||||
List<Integer> userIds = userResponses.getList().stream().map(e -> {
|
||||
return e.getUid();
|
||||
}).collect(Collectors.toList());
|
||||
// userIds.add(currentUser.getUid());
|
||||
// rShopUser.setSpreadPeopleCount(userService.getSpreadPeopleIdList(userIds).size());
|
||||
rShopUser.setSpreadPeopleCount(userService.getSpreadPeopleIdList(userIds).size());
|
||||
// 获取提现数据
|
||||
rShopUser.setUserExtractResponse(userExtractService.getUserExtractByUserId(rShopUser.getUid()));
|
||||
|
||||
@@ -231,9 +231,9 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
if(null != storeOrder.getPaid()){
|
||||
lqw.eq(StoreOrder::getPaid, storeOrder.getPaid());
|
||||
}
|
||||
if(null != storeOrder.getStatus()){
|
||||
lqw.eq(StoreOrder::getStatus, storeOrder.getStatus());
|
||||
}
|
||||
// if(null != storeOrder.getStatus()){
|
||||
// lqw.eq(StoreOrder::getStatus, storeOrder.getStatus());
|
||||
// }
|
||||
if(null != storeOrder.getStoreId()){
|
||||
lqw.eq(StoreOrder::getStoreId, storeOrder.getStoreId());
|
||||
}
|
||||
@@ -450,7 +450,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
userBill.setMark("余额支付" + storeOrder.getPayPrice() + "元购买商品");
|
||||
boolean saveUserBillResult = userBillService.save(userBill);
|
||||
boolean paySuccessResult = paySuccess(storeOrder,currentUser,formId);
|
||||
// orderPayService.success(storeOrder.getOrderId(),currentUser.getUid(),storeOrder.getPayType());
|
||||
return updateUserResult && saveUserBillResult && paySuccessResult;
|
||||
// return updateUserResult;
|
||||
}
|
||||
@@ -821,7 +820,6 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
return true;
|
||||
}catch (Exception e){
|
||||
//发货失败!
|
||||
e.printStackTrace();
|
||||
throw new CrmebException(e.getMessage());
|
||||
}
|
||||
}
|
||||
@@ -1270,8 +1268,8 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
* @since 2020-06-12
|
||||
*/
|
||||
private void getRequestTimeWhere(QueryWrapper<StoreOrder> queryWrapper, StoreOrderSearchRequest request) {
|
||||
if(StringUtils.isNotBlank(request.getTimeRage())){
|
||||
dateLimitUtilVo dateLimitUtilVo = DateUtil.getDateLimit(request.getTimeRage());
|
||||
if(StringUtils.isNotBlank(request.getDateLimit())){
|
||||
dateLimitUtilVo dateLimitUtilVo = DateUtil.getDateLimit(request.getDateLimit());
|
||||
queryWrapper.between("create_time",dateLimitUtilVo.getStartTime(),dateLimitUtilVo.getEndTime());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.utils.CrmebUtil;
|
||||
import com.utils.DateUtil;
|
||||
import com.utils.RedisUtil;
|
||||
import com.utils.vo.dateLimitUtilVo;
|
||||
import com.zbkj.crmeb.front.request.IndexStoreProductSearchRequest;
|
||||
import com.zbkj.crmeb.store.dao.StoreProductReplyDao;
|
||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.store.model.StoreProduct;
|
||||
@@ -24,6 +25,7 @@ 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.vo.StoreOrderInfoVo;
|
||||
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
@@ -37,6 +39,7 @@ import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author Mr.Zhang
|
||||
@@ -63,7 +66,7 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
private UserService userService;
|
||||
|
||||
@Autowired
|
||||
private StoreOrderStatusService storeOrderStatusService;
|
||||
private SystemAttachmentService systemAttachmentService;
|
||||
|
||||
@Autowired
|
||||
private RedisUtil redisUtil;
|
||||
@@ -95,6 +98,13 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
if(!StringUtils.isBlank(request.getProductId())){
|
||||
lambdaQueryWrapper.in(StoreProductReply::getProductId, CrmebUtil.stringToArray(request.getProductId()));
|
||||
}
|
||||
if(null != request.getProductSearch()){
|
||||
IndexStoreProductSearchRequest storeProductPram = new IndexStoreProductSearchRequest();
|
||||
storeProductPram.setKeywords(request.getProductSearch());
|
||||
List<StoreProduct> storeProducts = storeProductService.getList(storeProductPram, new PageParamRequest());
|
||||
List<Integer> productIds = storeProducts.stream().map(StoreProduct::getId).collect(Collectors.toList());
|
||||
lambdaQueryWrapper.in(StoreProductReply::getProductId, productIds);
|
||||
}
|
||||
if(!StringUtils.isBlank(request.getUid())){
|
||||
lambdaQueryWrapper.in(StoreProductReply::getUid, CrmebUtil.stringToArray(request.getUid()));
|
||||
}
|
||||
@@ -131,7 +141,7 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
dateLimitUtilVo dateLimit = DateUtil.getDateLimit(request.getDateLimit());
|
||||
Date ds = DateUtil.strToDate(dateLimit.getStartTime(), Constants.DATE_FORMAT_DATE);
|
||||
Date de = DateUtil.strToDate(dateLimit.getEndTime(), Constants.DATE_FORMAT_DATE);
|
||||
lambdaQueryWrapper.between(StoreProductReply::getCreateTime,
|
||||
lambdaQueryWrapper.between(StoreProductReply::getMerchantReplyTime,
|
||||
DateUtil.getSecondTimestamp(ds),
|
||||
DateUtil.getSecondTimestamp(de));
|
||||
}
|
||||
@@ -144,7 +154,6 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
StoreProduct storeProduct = storeProductService.getById(productReply.getProductId());
|
||||
productReplyResponse.setStoreProduct(storeProduct);
|
||||
productReplyResponse.setPics(CrmebUtil.stringToArrayStr(productReply.getPics()));
|
||||
|
||||
dataResList.add(productReplyResponse);
|
||||
}
|
||||
return CommonPage.copyPageInfo(pageStoreReply, dataResList);
|
||||
@@ -187,13 +196,11 @@ public class StoreProductReplyServiceImpl extends ServiceImpl<StoreProductReplyD
|
||||
User user = userService.getInfo();
|
||||
storeProductReply.setAvatar(user.getAvatar());
|
||||
storeProductReply.setNickname(user.getNickname());
|
||||
// String picValue = null;
|
||||
// if(null == request.getPics()) picValue = "[]";
|
||||
// else if(request.getPics().size() > 0 ){
|
||||
// picValue = request.getPics().toString();
|
||||
// }else{
|
||||
// picValue = "[]";
|
||||
// }
|
||||
if(StringUtils.isNotBlank(request.getPics())){
|
||||
String pics = request.getPics().replace("[\"","").replace("\"]","")
|
||||
.replace("\"","");
|
||||
storeProductReply.setPics(systemAttachmentService.clearPrefix(ArrayUtils.toString(pics)));
|
||||
}
|
||||
// storeProductReply.setPics( ArrayUtils.toString(request.getPics()));
|
||||
boolean result = save(storeProductReply);
|
||||
|
||||
|
||||
@@ -292,7 +292,8 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
if (!attrAddResult) throw new CrmebException("新增属性名失败");
|
||||
StoreProductAttrValue singleAttrValue = new StoreProductAttrValue();
|
||||
singleAttrValue.setProductId(storeProduct.getId()).setStock(storeProduct.getStock()).setSuk("默认")
|
||||
.setSales(storeProduct.getSales()).setPrice(storeProduct.getPrice()).setImage(storeProduct.getImage())
|
||||
.setSales(storeProduct.getSales()).setPrice(storeProduct.getPrice())
|
||||
.setImage(systemAttachmentService.clearPrefix(storeProduct.getImage()))
|
||||
.setCost(storeProduct.getCost()).setBarCode(storeProduct.getBarCode()).setOtPrice(storeProduct.getOtPrice());
|
||||
boolean saveOrUpdateResult = storeProductAttrValueService.save(singleAttrValue);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("新增属性详情失败");
|
||||
@@ -326,7 +327,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
StoreProductAttrResult attrResult = new StoreProductAttrResult(
|
||||
0,
|
||||
storeProduct.getId(),
|
||||
JSON.toJSONString(storeProductRequest.getAttrValue()),
|
||||
systemAttachmentService.clearPrefix(JSON.toJSONString(storeProductRequest.getAttrValue())),
|
||||
DateUtil.getNowTime(),Constants.PRODUCT_TYPE_NORMAL);
|
||||
storeProductAttrResultService.save(attrResult);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("新增属性详情失败");
|
||||
@@ -403,7 +404,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
StoreProductAttrResult attrResult = new StoreProductAttrResult(
|
||||
0,
|
||||
storeProduct.getId(),
|
||||
JSON.toJSONString(storeProductRequest.getAttrValue()),
|
||||
systemAttachmentService.clearPrefix(JSON.toJSONString(storeProductRequest.getAttrValue())),
|
||||
DateUtil.getNowTime(),Constants.PRODUCT_TYPE_NORMAL);
|
||||
storeProductAttrResultService.save(attrResult);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("编辑属性详情失败");
|
||||
@@ -420,6 +421,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
BeanUtils.copyProperties(attrValueRequest,singleAttrValue);
|
||||
singleAttrValue.setProductId(storeProduct.getId());
|
||||
singleAttrValue.setSuk("默认");
|
||||
singleAttrValue.setImage(systemAttachmentService.clearPrefix(singleAttrValue.getImage()));
|
||||
boolean saveOrUpdateResult = storeProductAttrValueService.save(singleAttrValue);
|
||||
if(!saveOrUpdateResult) throw new CrmebException("新增属性详情失败");
|
||||
}
|
||||
@@ -463,11 +465,11 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
if(null == storeProduct) throw new CrmebException("未找到对应商品信息");
|
||||
StoreProductResponse storeProductResponse = new StoreProductResponse();
|
||||
BeanUtils.copyProperties(storeProduct, storeProductResponse);
|
||||
if(storeProduct.getSpecType()){
|
||||
// if(storeProduct.getSpecType()){
|
||||
storeProductResponse.setAttr(attrService.getByProductId(storeProduct.getId()));
|
||||
}else{
|
||||
storeProductResponse.setAttr(new ArrayList<>());
|
||||
}
|
||||
// }else{
|
||||
// storeProductResponse.setAttr(new ArrayList<>());
|
||||
// }
|
||||
List<StoreProductAttrValue> storeProductAttrValues = storeProductAttrValueService.getListByProductId(storeProduct.getId());
|
||||
// 根据attrValue生成前端所需的数据
|
||||
List<HashMap<String, Object>> attrValues = new ArrayList<>();
|
||||
@@ -591,7 +593,15 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(request.getKeywords())){
|
||||
lambdaQueryWrapper.like(StoreProduct::getStoreName, request.getKeywords());
|
||||
if(CrmebUtil.isString2Num(request.getKeywords())){
|
||||
Integer productId = Integer.valueOf(request.getKeywords());
|
||||
lambdaQueryWrapper.like(StoreProduct::getId, productId);
|
||||
}else{
|
||||
lambdaQueryWrapper
|
||||
.like(StoreProduct::getStoreName, request.getKeywords())
|
||||
.or().like(StoreProduct::getStoreInfo, request.getKeywords())
|
||||
.or().like(StoreProduct::getBarCode, request.getKeywords());
|
||||
}
|
||||
}
|
||||
|
||||
lambdaQueryWrapper.orderByDesc(StoreProduct::getId);
|
||||
@@ -641,7 +651,7 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
break;
|
||||
case 5:
|
||||
//回收站
|
||||
lambdaQueryWrapper.eq(StoreProduct::getIsDel, true);
|
||||
lambdaQueryWrapper.or().eq(StoreProduct::getIsDel, true);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@@ -1225,6 +1235,19 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param productId 商品id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteProduct(Integer productId) {
|
||||
LambdaUpdateWrapper<StoreProduct> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.eq(StoreProduct::getId, productId);
|
||||
lambdaUpdateWrapper.set(StoreProduct::getIsDel, true);
|
||||
return update(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////自定义方法
|
||||
|
||||
|
||||
|
||||
@@ -347,12 +347,12 @@ public class OrderUtils {
|
||||
ComputeOrderResponse result = new ComputeOrderResponse();
|
||||
// 组装返回数据
|
||||
result.setTotalPrice(cor.getPriceGroup().getTotalPrice());
|
||||
result.setPayPrice(payPrice);
|
||||
result.setPayPostage(payPostage);
|
||||
result.setCouponPrice(couponPrice);
|
||||
result.setDeductionPrice(deductionPrice);
|
||||
result.setUsedIntegral(usedIntegral);
|
||||
result.setSurplusIntegral(surPlusIntegral);
|
||||
result.setPayPrice(payPrice.setScale(2, BigDecimal.ROUND_CEILING));
|
||||
result.setPayPostage(payPostage.setScale(2, BigDecimal.ROUND_CEILING));
|
||||
result.setCouponPrice(couponPrice.setScale(2, BigDecimal.ROUND_CEILING));
|
||||
result.setDeductionPrice(deductionPrice.setScale(2, BigDecimal.ROUND_CEILING));
|
||||
result.setUsedIntegral(usedIntegral.setScale(2, BigDecimal.ROUND_CEILING));
|
||||
result.setSurplusIntegral(surPlusIntegral.setScale(2, BigDecimal.ROUND_CEILING));
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zbkj.crmeb.system.request;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -22,4 +22,6 @@ public interface SystemUserLevelService extends IService<SystemUserLevel> {
|
||||
boolean create(SystemUserLevelRequest request);
|
||||
|
||||
boolean update(Integer id, SystemUserLevelRequest request);
|
||||
}
|
||||
|
||||
SystemUserLevel getByLevelId(Integer levelId);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.zbkj.crmeb.system.request.SystemAdminAddRequest;
|
||||
import com.zbkj.crmeb.system.request.SystemAdminRequest;
|
||||
import com.zbkj.crmeb.system.response.SystemAdminResponse;
|
||||
import com.zbkj.crmeb.system.service.SystemAdminService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -44,7 +45,41 @@ public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminDao, SystemAd
|
||||
LambdaQueryWrapper<SystemAdmin> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
SystemAdmin systemAdmin = new SystemAdmin();
|
||||
BeanUtils.copyProperties(request,systemAdmin);
|
||||
lambdaQueryWrapper.setEntity(systemAdmin);
|
||||
// lambdaQueryWrapper.setEntity(systemAdmin);
|
||||
if(StringUtils.isNotBlank(systemAdmin.getAccount())){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getAccount, systemAdmin.getAccount());
|
||||
}
|
||||
if(null != systemAdmin.getAddTime()){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getAddTime, systemAdmin.getAddTime());
|
||||
}
|
||||
if(null != systemAdmin.getId()){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getId, systemAdmin.getId());
|
||||
}
|
||||
if(null != systemAdmin.getIsDel()){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getIsDel, systemAdmin.getIsDel());
|
||||
}
|
||||
if(StringUtils.isNotBlank(systemAdmin.getLastIp())){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getLastIp, systemAdmin.getLastIp());
|
||||
}
|
||||
if(null != systemAdmin.getLastTime()){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getLastTime, systemAdmin.getLastTime());
|
||||
}
|
||||
if(null != systemAdmin.getLevel()){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getLevel, systemAdmin.getLevel());
|
||||
}
|
||||
if(null != systemAdmin.getLoginCount()){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getLoginCount, systemAdmin.getLoginCount());
|
||||
}
|
||||
if(StringUtils.isNotBlank(systemAdmin.getRealName())){
|
||||
lambdaQueryWrapper.like(SystemAdmin::getRealName, systemAdmin.getRealName());
|
||||
lambdaQueryWrapper.or().like(SystemAdmin::getAccount, systemAdmin.getRealName());
|
||||
}
|
||||
if(StringUtils.isNotBlank(systemAdmin.getRoles())){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getRoles, systemAdmin.getRoles());
|
||||
}
|
||||
if(null != systemAdmin.getStatus()){
|
||||
lambdaQueryWrapper.eq(SystemAdmin::getStatus, systemAdmin.getStatus());
|
||||
}
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -73,6 +73,9 @@ public class SystemRoleServiceImpl extends ServiceImpl<SystemRoleDao, SystemRole
|
||||
@Override
|
||||
public Boolean checkAuth(String uri) {
|
||||
List<Integer> categoryIdList = getRoleListInRoleId();
|
||||
if(categoryIdList.size() < 1){
|
||||
return false;
|
||||
}
|
||||
|
||||
//查询分类,根据in id和 路由
|
||||
return categoryService.checkAuth(categoryIdList, uri);
|
||||
@@ -92,7 +95,7 @@ public class SystemRoleServiceImpl extends ServiceImpl<SystemRoleDao, SystemRole
|
||||
private List<Integer> getRoleListInRoleId(){
|
||||
//获取当前用户的所有权限
|
||||
SystemAdmin systemAdmin = systemAdminService.getInfo();
|
||||
if(StringUtils.isBlank(systemAdmin.getRoles())){
|
||||
if(null == systemAdmin || StringUtils.isBlank(systemAdmin.getRoles())){
|
||||
throw new CrmebException("没有权限访问!");
|
||||
}
|
||||
|
||||
|
||||
@@ -125,5 +125,13 @@ public class SystemUserLevelServiceImpl extends ServiceImpl<SystemUserLevelDao,
|
||||
systemUserLevel.setIcon(systemAttachmentService.clearPrefix(systemUserLevel.getIcon()));
|
||||
}
|
||||
|
||||
@Override
|
||||
public SystemUserLevel getByLevelId(Integer levelId) {
|
||||
LambdaQueryWrapper<SystemUserLevel> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(SystemUserLevel::getIsShow, 1);
|
||||
lambdaQueryWrapper.eq(SystemUserLevel::getIsDel, 0);
|
||||
lambdaQueryWrapper.eq(SystemUserLevel::getId, levelId);
|
||||
return dao.selectOne(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -10,12 +10,9 @@ import com.qiniu.storage.Configuration;
|
||||
import com.qiniu.storage.Region;
|
||||
import com.qiniu.storage.UploadManager;
|
||||
import com.qiniu.util.Auth;
|
||||
import com.utils.CrmebUtil;
|
||||
import com.utils.RequestUtil;
|
||||
import com.zbkj.crmeb.system.model.SystemAttachment;
|
||||
import com.zbkj.crmeb.system.service.SystemConfigService;
|
||||
import com.zbkj.crmeb.upload.service.AsyncService;
|
||||
|
||||
import com.zbkj.crmeb.upload.service.CosService;
|
||||
import com.zbkj.crmeb.upload.service.OssService;
|
||||
import com.zbkj.crmeb.upload.service.QiNiuService;
|
||||
@@ -219,7 +216,7 @@ public class AsyncServiceImpl implements AsyncService {
|
||||
String uploadType = systemConfigService.getValueByKeyException("uploadType");
|
||||
//获取配置信息
|
||||
int type = Integer.parseInt(uploadType);
|
||||
String pre = null;
|
||||
String pre = "local";
|
||||
switch (type){
|
||||
case 2:
|
||||
pre = "qn";
|
||||
@@ -231,15 +228,10 @@ public class AsyncServiceImpl implements AsyncService {
|
||||
pre = "tx";
|
||||
break;
|
||||
default:
|
||||
|
||||
break;
|
||||
}
|
||||
if(type == 1){
|
||||
leftBase = RequestUtil.getDomain();;
|
||||
}else{
|
||||
leftBase = systemConfigService.getValueByKeyException(pre+"UploadUrl");
|
||||
}
|
||||
return leftBase;
|
||||
|
||||
return systemConfigService.getValueByKeyException(pre+"UploadUrl");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,7 +72,7 @@ public class CosServiceImpl implements CosService {
|
||||
//更新数据库
|
||||
systemAttachmentService.updateCloudType(id, 4);
|
||||
//删除
|
||||
file.delete();
|
||||
// file.delete();
|
||||
} catch (Exception e) {
|
||||
throw new CrmebException(e.getMessage());
|
||||
}
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zbkj.crmeb.upload.service.impl;
|
||||
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.aliyun.oss.OSSClientBuilder;
|
||||
import com.aliyun.oss.model.PutObjectRequest;
|
||||
import com.aliyun.oss.model.PutObjectResult;
|
||||
import com.exception.CrmebException;
|
||||
@@ -65,7 +64,7 @@ public class OssServiceImpl implements OssService {
|
||||
//更新数据库
|
||||
systemAttachmentService.updateCloudType(id, 3);
|
||||
//删除
|
||||
file.delete();
|
||||
// file.delete();
|
||||
} catch (Exception e){
|
||||
throw new CrmebException(e.getMessage());
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zbkj.crmeb.upload.service.impl;
|
||||
|
||||
import com.aliyun.oss.OSS;
|
||||
import com.exception.CrmebException;
|
||||
import com.qiniu.common.QiniuException;
|
||||
import com.qiniu.http.Response;
|
||||
@@ -56,7 +55,7 @@ public class QiNiuServiceImpl implements QiNiuService {
|
||||
//更新数据库
|
||||
systemAttachmentService.updateCloudType(id, 2);
|
||||
//删除
|
||||
file.delete();
|
||||
// file.delete();
|
||||
} catch (QiniuException ex) {
|
||||
//TODO
|
||||
throw new CrmebException(ex.getMessage());
|
||||
|
||||
@@ -3,22 +3,20 @@ package com.zbkj.crmeb.user.controller;
|
||||
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.store.service.StoreOrderService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.request.UserOperateFundsRequest;
|
||||
import com.zbkj.crmeb.user.request.UserOperateIntegralMoneyRequest;
|
||||
import com.zbkj.crmeb.user.request.UserRequest;
|
||||
import com.zbkj.crmeb.user.request.UserSearchRequest;
|
||||
import com.zbkj.crmeb.user.response.TopDetail;
|
||||
import com.zbkj.crmeb.user.response.UserResponse;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import io.swagger.annotations.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
@@ -43,7 +43,7 @@ public class RegisterThirdUserRequest implements Serializable {
|
||||
@ApiModelProperty(value = "用户头像", required = true)
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "推广人id", required = true)
|
||||
@ApiModelProperty(value = "推广人id")
|
||||
@JsonProperty(value = "spread_spid")
|
||||
private Integer spreadPid;
|
||||
private Integer spreadPid = 0;
|
||||
}
|
||||
|
||||
@@ -7,9 +7,7 @@ import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
import org.hibernate.validator.constraints.Range;
|
||||
|
||||
import javax.validation.constraints.DecimalMin;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
@@ -41,8 +39,6 @@ public class UserOperateIntegralMoneyRequest implements Serializable {
|
||||
private int integralType;
|
||||
|
||||
@ApiModelProperty(value = "积分")
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01", message = "请输入正确的金额")
|
||||
private BigDecimal integralValue;
|
||||
|
||||
@ApiModelProperty(value = "余额类型, 1 = 增加, 2 = 减少")
|
||||
@@ -51,8 +47,6 @@ public class UserOperateIntegralMoneyRequest implements Serializable {
|
||||
private int moneyType;
|
||||
|
||||
@ApiModelProperty(value = "余额")
|
||||
@NotNull
|
||||
@DecimalMin(value = "0.01", message = "请输入正确的金额")
|
||||
private BigDecimal moneyValue;
|
||||
|
||||
}
|
||||
|
||||
@@ -1,7 +1,5 @@
|
||||
package com.zbkj.crmeb.user.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;
|
||||
@@ -9,11 +7,9 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -47,7 +43,7 @@ public class UserSearchRequest implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "用户登陆类型,h5 = h5, wechat = wechat,routine = routine", allowableValues = "range[h5,wechat,routine]")
|
||||
@NotBlank(message = "请选择用户登录类型")
|
||||
private String loginType;
|
||||
private String userType;
|
||||
|
||||
@ApiModelProperty(value = "状态是否正常, 0 = 禁止, 1 = 正常")
|
||||
private Boolean status = null;
|
||||
|
||||
@@ -72,8 +72,12 @@ public interface UserService extends IService<User> {
|
||||
|
||||
User getInfo();
|
||||
|
||||
User getUserPromoter();
|
||||
|
||||
User getInfoException();
|
||||
|
||||
User getInfoEmpty();
|
||||
|
||||
Object getInfoByCondition(Integer userId,Integer type,PageParamRequest pageParamRequest);
|
||||
|
||||
Integer getUserIdException();
|
||||
@@ -128,4 +132,6 @@ public interface UserService extends IService<User> {
|
||||
List<User> getTopSpreadPeopleListByDate(String type, PageParamRequest pageParamRequest);
|
||||
|
||||
Integer getCountByPayCount(int minPayCount, int maxPayCount);
|
||||
|
||||
List<User> getUserByEntity(User user);
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ import com.zbkj.crmeb.front.request.UserBindingRequest;
|
||||
import com.zbkj.crmeb.front.response.*;
|
||||
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.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.store.request.RetailShopStairUserRequest;
|
||||
@@ -38,6 +39,7 @@ import com.zbkj.crmeb.system.service.SystemUserLevelService;
|
||||
import com.zbkj.crmeb.user.dao.UserDao;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.model.UserBill;
|
||||
import com.zbkj.crmeb.user.model.UserLevel;
|
||||
import com.zbkj.crmeb.user.model.UserSign;
|
||||
import com.zbkj.crmeb.user.request.UserOperateFundsRequest;
|
||||
import com.zbkj.crmeb.user.request.UserOperateIntegralMoneyRequest;
|
||||
@@ -105,6 +107,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
@Autowired
|
||||
private StoreCouponUserService storeCouponUserService;
|
||||
|
||||
@Autowired
|
||||
private StoreCouponService storeCouponService;
|
||||
|
||||
/**
|
||||
* 分页显示用户表
|
||||
* @param request 搜索条件
|
||||
@@ -134,8 +139,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
lambdaQueryWrapper.in(User::getLevel, CrmebUtil.stringToArray(request.getLevel()));
|
||||
}
|
||||
|
||||
if(request.getLoginType() != null){
|
||||
lambdaQueryWrapper.eq(User::getLoginType, request.getLoginType());
|
||||
if(StringUtils.isNotBlank(request.getUserType())){
|
||||
lambdaQueryWrapper.eq(User::getUserType, request.getUserType());
|
||||
}
|
||||
|
||||
if(request.getStatus() != null){
|
||||
@@ -231,6 +236,14 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
*/
|
||||
@Override
|
||||
public boolean updateIntegralMoney(UserOperateIntegralMoneyRequest request) {
|
||||
if(null == request.getMoneyValue() || null == request.getIntegralValue()){
|
||||
throw new CrmebException("至少输入一个金额");
|
||||
}
|
||||
|
||||
if(request.getMoneyValue().compareTo(BigDecimal.ZERO) < 1 && request.getIntegralValue().compareTo(BigDecimal.ZERO) < 1){
|
||||
throw new CrmebException("最小值为0.01");
|
||||
}
|
||||
|
||||
UserOperateFundsRequest userOperateFundsRequest = new UserOperateFundsRequest();
|
||||
if(request.getMoneyType() == 1){
|
||||
userOperateFundsRequest.setFoundsType(Constants.USER_BILL_TYPE_SYSTEM_ADD);
|
||||
@@ -254,7 +267,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
//需要处理
|
||||
userOperateFundsRequest.setFoundsCategory(Constants.USER_BILL_CATEGORY_MONEY);
|
||||
userOperateFundsRequest.setUid(request.getUid());
|
||||
userOperateFundsRequest.setValue(request.getIntegralValue());
|
||||
userOperateFundsRequest.setValue(request.getMoneyValue());
|
||||
updateFounds(userOperateFundsRequest, true);
|
||||
}
|
||||
|
||||
@@ -446,6 +459,10 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
LoginResponse loginResponse = new LoginResponse();
|
||||
loginResponse.setToken(token(user));
|
||||
user.setPwd(null);
|
||||
|
||||
//TODO 看分销类型
|
||||
|
||||
|
||||
loginResponse.setUser(user);
|
||||
|
||||
return loginResponse;
|
||||
@@ -494,7 +511,22 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
if(getUserId() == 0){
|
||||
return null;
|
||||
}
|
||||
User user = getById(getUserId());
|
||||
return getById(getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取个人资料
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
* @return User
|
||||
*/
|
||||
@Override
|
||||
public User getUserPromoter() {
|
||||
User user = getInfo();
|
||||
if(null == user){
|
||||
return null;
|
||||
}
|
||||
|
||||
if(!user.getStatus()){
|
||||
user.setIsPromoter(false);
|
||||
return user;
|
||||
@@ -514,7 +546,6 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
}
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取个人资料
|
||||
* @author Mr.Zhang
|
||||
@@ -534,6 +565,19 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
return user;
|
||||
}
|
||||
|
||||
@Override
|
||||
public User getInfoEmpty() {
|
||||
User user = getInfo();
|
||||
if(user == null){
|
||||
user = new User();
|
||||
}
|
||||
|
||||
// if(!user.getStatus()){
|
||||
// throw new CrmebException("用户已经被禁用!");
|
||||
// }
|
||||
return user;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前用户id
|
||||
* @author Mr.Zhang
|
||||
@@ -629,6 +673,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
//查询手机号信息
|
||||
User bindUser = getInfoException();
|
||||
bindUser.setAccount(request.getPhone());
|
||||
bindUser.setPhone(request.getPhone());
|
||||
|
||||
return updateById(bindUser);
|
||||
}
|
||||
@@ -643,6 +688,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
public UserCenterResponse getUserCenter() {
|
||||
UserCenterResponse userCenterResponse = new UserCenterResponse();
|
||||
BeanUtils.copyProperties(getInfo(), userCenterResponse);
|
||||
User currentUser = getInfo();
|
||||
UserCenterOrderStatusNumResponse userCenterOrderStatusNumResponse = new UserCenterOrderStatusNumResponse();
|
||||
userCenterOrderStatusNumResponse.setNoBuy(0);
|
||||
userCenterOrderStatusNumResponse.setNoPink(0);
|
||||
@@ -651,6 +697,25 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
userCenterOrderStatusNumResponse.setNoReply(0);
|
||||
userCenterOrderStatusNumResponse.setNoTake(0);
|
||||
userCenterResponse.setOrderStatusNum(userCenterOrderStatusNumResponse);
|
||||
PageParamRequest pageParamRequest = new PageParamRequest();
|
||||
pageParamRequest.setPage(1); pageParamRequest.setLimit(999);
|
||||
List<StoreCouponUserResponse> storeCoupons = storeCouponUserService.getListFront(getUserIdException(), pageParamRequest);
|
||||
userCenterResponse.setCouponCount(null != storeCoupons ? storeCoupons.size():0);
|
||||
userCenterResponse.setLevel(currentUser.getLevel());
|
||||
|
||||
// 判断是否开启会员功能
|
||||
Integer memberFuncStatus = Integer.valueOf(systemConfigService.getValueByKey("member_func_status"));
|
||||
if(memberFuncStatus == 0){
|
||||
userCenterResponse.setVip(false);
|
||||
}else{
|
||||
userCenterResponse.setVip(userCenterResponse.getLevel() > 0);
|
||||
UserLevel userLevel = userLevelService.getUserLevelByUserId(currentUser.getUid());
|
||||
if(null != userLevel){
|
||||
SystemUserLevel systemUserLevel = systemUserLevelService.getByLevelId(userLevel.getLevelId());
|
||||
userCenterResponse.setVipIcon(systemUserLevel.getIcon());
|
||||
userCenterResponse.setVipName(systemUserLevel.getName());
|
||||
}
|
||||
}
|
||||
return userCenterResponse;
|
||||
}
|
||||
|
||||
@@ -1322,4 +1387,11 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
lambdaQueryWrapper.between(User::getPayCount, minPayCount, maxPayCount);
|
||||
return userDao.selectCount(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<User> getUserByEntity(User user) {
|
||||
LambdaUpdateWrapper<User> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
|
||||
lambdaUpdateWrapper.setEntity(user);
|
||||
return userDao.selectList(lambdaUpdateWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ public class UserSignServiceImpl extends ServiceImpl<UserSignDao, UserSign> impl
|
||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<UserSign> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserSign::getType, 1);
|
||||
lambdaQueryWrapper.eq(UserSign::getUid, userService.getUserIdException());
|
||||
lambdaQueryWrapper.orderByDesc(UserSign::getId);
|
||||
List<UserSign> userSignList = dao.selectList(lambdaQueryWrapper);
|
||||
|
||||
@@ -178,6 +179,7 @@ public class UserSignServiceImpl extends ServiceImpl<UserSignDao, UserSign> impl
|
||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<UserSign> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(UserSign::getType, 1);
|
||||
lambdaQueryWrapper.eq(UserSign::getUid, userService.getUserIdException());
|
||||
lambdaQueryWrapper.orderByDesc(UserSign::getCreateDay);
|
||||
List<UserSign> userSignList = dao.selectList(lambdaQueryWrapper);
|
||||
|
||||
@@ -316,7 +318,7 @@ public class UserSignServiceImpl extends ServiceImpl<UserSignDao, UserSign> impl
|
||||
//获取签到数据
|
||||
List<SystemGroupDataSignConfigVo> config = config();
|
||||
for (SystemGroupDataSignConfigVo systemSignConfigVo : config) {
|
||||
if(user.getSignNum() + 1 >= systemSignConfigVo.getDay()){
|
||||
if(user.getSignNum() + 1 <= systemSignConfigVo.getDay()){
|
||||
return systemSignConfigVo;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,6 +120,10 @@ public class TemplateMessageServiceImpl extends ServiceImpl<TemplateMessageDao,
|
||||
}
|
||||
UserToken UserToken = userTokenService.getTokenByUserId(userId, openIdType);
|
||||
|
||||
if(null == UserToken || StringUtils.isBlank(UserToken.getToken())){
|
||||
return;
|
||||
}
|
||||
|
||||
templateMessageVo.setTouser(UserToken.getToken());
|
||||
|
||||
redisUtil.lPush(redisKey, JSONObject.toJSONString(templateMessageVo));
|
||||
|
||||
@@ -115,7 +115,10 @@ public class WeChatMessageServiceImpl implements WeChatMessageService {
|
||||
* @return String
|
||||
*/
|
||||
private String setXml() {
|
||||
String type = wechatReply.getType().toLowerCase();
|
||||
if(StringUtils.isBlank(getWechatReply().getType())){
|
||||
return "";
|
||||
}
|
||||
String type = getWechatReply().getType().toLowerCase();
|
||||
MessageReplyDataVo messageReplyDataVo = JSONObject.toJavaObject(JSONObject.parseObject(wechatReply.getData()), MessageReplyDataVo.class);
|
||||
|
||||
switch (type){
|
||||
|
||||
Reference in New Issue
Block a user