1、修复了部分bug
2、优化了数据库sql文件 3、优化了部分文件
This commit is contained in:
@@ -177,6 +177,9 @@ public class Constants {
|
||||
public static final String CONFIG_KEY_ADMIN_LOGIN_LOGO = "login_logo"; //登录页LOGO
|
||||
public static final String CONFIG_KEY_ADMIN_LOGIN_BACKGROUND_IMAGE = "admin_login_bg_pic"; //登录页背景图
|
||||
|
||||
//分销
|
||||
public static final String CONFIG_KEY_DISTRIBUTION_TYPE = "brokerageBindind";
|
||||
|
||||
|
||||
//config配置的formId
|
||||
public static final int CONFIG_FORM_ID_INDEX = 69; //首页配置
|
||||
@@ -254,9 +257,14 @@ public class Constants {
|
||||
public static final int INDEX_HOT_BANNER = 2; //热门榜单推荐Banner图片
|
||||
public static final int INDEX_NEW_BANNER = 3; //首页首发新品推荐Banner图片
|
||||
public static final int INDEX_BENEFIT_BANNER = 4; //首页促销单品推荐Banner图片
|
||||
|
||||
public static final int INDEX_LIMIT_DEFAULT = 3; //首页默认list分页条数
|
||||
|
||||
public static final String INDEX_BAST_LIMIT = "bastNumber"; //精品推荐个数
|
||||
public static final String INDEX_FIRST_LIMIT = "firstNumber"; //首发新品个数
|
||||
public static final String INDEX_SALES_LIMIT = "promotionNumber"; //促销单品个数
|
||||
public static final String INDEX_HOT_LIMIT = "hotNumber"; //热门推荐个数
|
||||
|
||||
|
||||
//用户资金
|
||||
public static final String USER_BILL_CATEGORY_MONEY = "now_money"; //用户余额
|
||||
public static final String USER_BILL_CATEGORY_INTEGRAL = "integral"; //积分
|
||||
@@ -275,9 +283,11 @@ public class Constants {
|
||||
public static final String USER_BILL_TYPE_PAY_PRODUCT_INTEGRAL_BACK = "pay_product_integral_back"; //商品退积分
|
||||
public static final String USER_BILL_TYPE_PAY_PRODUCT_REFUND = "pay_product_refund"; //商品退款
|
||||
public static final String USER_BILL_TYPE_RECHARGE = "recharge"; //佣金转入
|
||||
public static final String USER_BILL_TYPE_PAY_RECHARGE = "pay_recharge"; //充值
|
||||
public static final String USER_BILL_TYPE_SHARE = "share"; //用户分享记录
|
||||
public static final String USER_BILL_TYPE_SIGN = "sign"; //签到
|
||||
public static final String USER_BILL_TYPE_ORDER = "order"; //订单
|
||||
public static final String USER_BILL_TYPE_PAY_ORDER = "pay_order"; //订单支付
|
||||
public static final String USER_BILL_TYPE_SYSTEM_ADD = "system_add"; //系统增加
|
||||
public static final String USER_BILL_TYPE_SYSTEM_SUB = "system_sub"; //系统减少
|
||||
|
||||
|
||||
@@ -750,4 +750,16 @@ public class CrmebUtil {
|
||||
Matcher matcher = pattern.matcher(str);
|
||||
return matcher.matches();
|
||||
}
|
||||
|
||||
//数组去重
|
||||
public static List<Integer> arrayUnique(Integer[] arr){
|
||||
List<Integer> list = new ArrayList<>();
|
||||
for (Integer integer : arr) {
|
||||
if (!list.contains(integer)) {
|
||||
list.add(integer);
|
||||
}
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,17 +1,14 @@
|
||||
package com.zbkj.crmeb.article.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 org.hibernate.validator.constraints.Length;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.io.Serializable;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
@@ -35,10 +32,12 @@ public class ArticleRequest implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "文章标题", required = true)
|
||||
@NotBlank(message = "请填写文章标题")
|
||||
@Length(max = 200, message = "文章标题最多200个字符")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "文章作者", required = true)
|
||||
@NotBlank(message = "请填写文章标题")
|
||||
@NotBlank(message = "请填写文章作者")
|
||||
@Length(max = 50, message = "文章作者最多50个字符")
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty(value = "文章图片", required = true)
|
||||
@@ -46,15 +45,18 @@ public class ArticleRequest implements Serializable {
|
||||
private String imageInput;
|
||||
|
||||
@ApiModelProperty(value = "文章简介", required = true)
|
||||
@Length(max = 200, message = "文章简介最多200个字符")
|
||||
@NotBlank(message = "请填写文章简介")
|
||||
private String synopsis;
|
||||
|
||||
@ApiModelProperty(value = "文章分享标题", required = true)
|
||||
@NotBlank(message = "请填写文章分享标题")
|
||||
@Length(max = 200, message = "文章分享标题最多200个字符")
|
||||
private String shareTitle;
|
||||
|
||||
@ApiModelProperty(value = "文章分享简介", required = true)
|
||||
@NotBlank(message = "请填写文章分享简介")
|
||||
@Length(max = 200, message = "文章分享简介最多200个字符")
|
||||
private String shareSynopsis;
|
||||
|
||||
@ApiModelProperty(value = "排序", example = "0", required = true)
|
||||
|
||||
@@ -64,6 +64,12 @@ import java.util.List;
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
public CommonResult<String> save(@Validated CategoryRequest categoryRequest){
|
||||
Category category = new Category();
|
||||
|
||||
//检测标题是否存在
|
||||
if(categoryService.checkName(categoryRequest.getName(), category.getType()) > 0){
|
||||
throw new CrmebException("此分类已存在");
|
||||
}
|
||||
|
||||
BeanUtils.copyProperties(categoryRequest, category);
|
||||
category.setPath(categoryService.getPathByPId(category.getPid()));
|
||||
category.setExtra(systemAttachmentService.clearPrefix(category.getExtra()));
|
||||
|
||||
@@ -36,4 +36,6 @@ public interface CategoryService extends IService<Category> {
|
||||
boolean update(CategoryRequest request, Integer id);
|
||||
|
||||
List<Category> getChildVoListByPid(Integer pid);
|
||||
|
||||
int checkName(String name, Integer type);
|
||||
}
|
||||
|
||||
@@ -341,5 +341,21 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, Category> impl
|
||||
objectQueryWrapper.like("path", "/"+pid+"/");
|
||||
return dao.selectList(objectQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测分类码是否存在
|
||||
* @param name String 分类名
|
||||
* @param type int 类型
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-16
|
||||
* @return int
|
||||
*/
|
||||
@Override
|
||||
public int checkName(String name, Integer type) {
|
||||
LambdaQueryWrapper<Category> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.eq(Category::getName, name)
|
||||
.eq(Category::getType, type);
|
||||
return dao.selectCount(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.utils.CrmebUtil;
|
||||
@@ -9,7 +8,6 @@ import com.zbkj.crmeb.front.response.ConfirmOrderResponse;
|
||||
import com.zbkj.crmeb.front.service.OrderService;
|
||||
import com.zbkj.crmeb.front.vo.OrderAgainVo;
|
||||
import com.zbkj.crmeb.store.request.StoreProductReplyAddRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreOrderListResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
@@ -21,8 +19,6 @@ import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* @Classname StoreOrderController
|
||||
@@ -205,7 +201,6 @@ public class StoreOrderController {
|
||||
@ApiOperation(value = "退款订单验证")
|
||||
@RequestMapping(value = "/refund/verify", method = RequestMethod.POST)
|
||||
public CommonResult<Object> refundVerify(@RequestBody @Validated OrderRefundVerifyRequest request){
|
||||
|
||||
return CommonResult.success(orderService.refundVerify(request));
|
||||
}
|
||||
|
||||
|
||||
@@ -3,8 +3,8 @@ package com.zbkj.crmeb.front.controller;
|
||||
import com.common.CommonResult;
|
||||
import com.zbkj.crmeb.front.response.LoginResponse;
|
||||
import com.zbkj.crmeb.front.service.UserCenterService;
|
||||
import com.zbkj.crmeb.user.request.RegisterThirdUserRequest;
|
||||
import com.zbkj.crmeb.wechat.model.TemplateMessage;
|
||||
import com.zbkj.crmeb.wechat.response.RegisterThirdUserRequest;
|
||||
import com.zbkj.crmeb.wechat.service.TemplateMessageService;
|
||||
import com.zbkj.crmeb.wechat.service.WeChatService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -55,8 +55,9 @@ public class WeChatController {
|
||||
*/
|
||||
@ApiOperation(value = "微信登录公共号授权登录")
|
||||
@RequestMapping(value = "/authorize/login", method = RequestMethod.GET)
|
||||
public CommonResult<LoginResponse> login(@RequestParam String code){
|
||||
return CommonResult.success(userCenterService.weChatAuthorizeLogin(code));
|
||||
public CommonResult<LoginResponse> login(@RequestParam(value = "spread_spid", defaultValue = "0", required = false) Integer spreadUid,
|
||||
@RequestParam(value = "code") String code){
|
||||
return CommonResult.success(userCenterService.weChatAuthorizeLogin(code, spreadUid));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -44,7 +44,8 @@ public class RegisterRequest implements Serializable {
|
||||
private String validateCode;
|
||||
|
||||
@ApiModelProperty(value = "推广人id")
|
||||
private Integer spread;
|
||||
@JsonProperty(value = "spread_spid")
|
||||
private Integer spread = 0;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -10,7 +10,7 @@ import com.zbkj.crmeb.front.response.*;
|
||||
import com.zbkj.crmeb.system.model.SystemUserLevel;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.model.UserBill;
|
||||
import com.zbkj.crmeb.wechat.response.RegisterThirdUserRequest;
|
||||
import com.zbkj.crmeb.user.request.RegisterThirdUserRequest;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -48,7 +48,7 @@ public interface UserCenterService extends IService<User> {
|
||||
|
||||
UserRechargePaymentResponse recharge(UserRechargeRequest request);
|
||||
|
||||
LoginResponse weChatAuthorizeLogin(String code);
|
||||
LoginResponse weChatAuthorizeLogin(String code, Integer spreadUid);
|
||||
|
||||
String getLogo();
|
||||
|
||||
|
||||
@@ -54,28 +54,41 @@ public class IndexServiceImpl implements IndexService {
|
||||
|
||||
IndexProductBannerResponse indexProductBannerResponse = new IndexProductBannerResponse();
|
||||
IndexStoreProductSearchRequest request = new IndexStoreProductSearchRequest();
|
||||
int gid = 0;
|
||||
int gid;
|
||||
String key;
|
||||
switch (type){
|
||||
case Constants.INDEX_RECOMMEND_BANNER: //精品推荐
|
||||
gid = Constants.GROUP_DATA_ID_INDEX_RECOMMEND_BANNER;
|
||||
key = Constants.INDEX_BAST_LIMIT;
|
||||
request.setIsBest(true);
|
||||
break;
|
||||
case Constants.INDEX_HOT_BANNER: //热门榜单
|
||||
gid = Constants.GROUP_DATA_ID_INDEX_HOT_BANNER;
|
||||
key = Constants.INDEX_HOT_LIMIT;
|
||||
request.setIsHot(true);
|
||||
break;
|
||||
case Constants.INDEX_NEW_BANNER: //首发新品
|
||||
gid = Constants.GROUP_DATA_ID_INDEX_NEW_BANNER;
|
||||
key = Constants.INDEX_FIRST_LIMIT;
|
||||
request.setIsNew(true);
|
||||
break;
|
||||
case Constants.INDEX_BENEFIT_BANNER: //促销单品
|
||||
gid = Constants.GROUP_DATA_ID_INDEX_BENEFIT_BANNER;
|
||||
key = Constants.INDEX_SALES_LIMIT;
|
||||
request.setIsBenefit(true);
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(key)){
|
||||
String num = systemConfigService.getValueByKey(Constants.INDEX_BAST_LIMIT);
|
||||
if(pageParamRequest.getLimit() == 0){
|
||||
//首页limit传0,则读取默认数据, 否则后台设置的首页配置不起作用
|
||||
pageParamRequest.setLimit(Integer.parseInt(num));
|
||||
}
|
||||
}
|
||||
|
||||
indexProductBannerResponse.setBanner(systemGroupDataService.getListMapByGid(gid));
|
||||
indexProductBannerResponse.setList(productService.getIndexProduct(request, pageParamRequest).getList());
|
||||
return indexProductBannerResponse;
|
||||
|
||||
@@ -37,7 +37,6 @@ import com.zbkj.crmeb.user.model.UserAddress;
|
||||
import com.zbkj.crmeb.user.service.UserAddressService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.openxmlformats.schemas.spreadsheetml.x2006.main.STPageOrder;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -139,7 +138,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
// other
|
||||
HashMap<String, Object> otherMap = new HashMap<>();
|
||||
otherMap.put("offlinePostage",systemConfigService.getValueByKey("offline_postage"));
|
||||
otherMap.put("integralRatio",systemConfigService.getValueByKey("integralRatio"));
|
||||
otherMap.put("integralRatio",systemConfigService.getValueByKey("integral_ratio"));
|
||||
|
||||
// 获取有效优惠券
|
||||
List<StoreCouponUserResponse> canUseUseCouponList = orderUtils.getCanUseCouponList(storeCartResponse);
|
||||
@@ -358,8 +357,8 @@ public class OrderServiceImpl implements OrderService {
|
||||
existStoreOrder.setRefundReasonTime(DateUtil.nowDateTime());
|
||||
existStoreOrder.setRefundReasonWap(request.getText());
|
||||
existStoreOrder.setRefundReasonWapExplain(request.getRefund_reason_wap_explain());
|
||||
existStoreOrder.setRefundReasonWapImg(request.getRefund_reason_wap_img());
|
||||
boolean updateOrderResult = storeOrderService.updateByEntity(existStoreOrder);
|
||||
existStoreOrder.setRefundReasonWapImg(systemAttachmentService.clearPrefix(request.getRefund_reason_wap_img()));
|
||||
boolean updateOrderResult = storeOrderService.updateById(existStoreOrder);
|
||||
if(!updateOrderResult) throw new CrmebException("申请退款失败");
|
||||
|
||||
HashMap<String, Object> smsInfo = new HashMap<>();
|
||||
@@ -455,21 +454,21 @@ public class OrderServiceImpl implements OrderService {
|
||||
}
|
||||
// todo 营销活动 二期
|
||||
// if(existStoreOrder.getPinkId()>0)
|
||||
if(request.getFrom().equals(Constants.PAY_TYPE_WE_CHAT)){
|
||||
if(existStoreOrder.getIsChannel() == 1 || existStoreOrder.getIsChannel() == 2){
|
||||
existStoreOrder.setOrderId(CrmebUtil.randomCount(100,999)+existStoreOrder.getOrderId());
|
||||
}
|
||||
}
|
||||
if(request.getFrom().equals(Constants.PAY_TYPE_WE_CHAT_FROM_H5)){
|
||||
if(existStoreOrder.getIsChannel() == 0 || existStoreOrder.getIsChannel() == 1){
|
||||
existStoreOrder.setOrderId(CrmebUtil.randomCount(100,999)+existStoreOrder.getOrderId());
|
||||
}
|
||||
}
|
||||
if(request.getFrom().equals(Constants.PAY_TYPE_WE_CHAT_FROM_PROGRAM)){
|
||||
if(existStoreOrder.getIsChannel() == 0 || existStoreOrder.getIsChannel() == 2){
|
||||
existStoreOrder.setOrderId(CrmebUtil.randomCount(100,999)+existStoreOrder.getOrderId());
|
||||
}
|
||||
}
|
||||
// if(request.getFrom().equals(Constants.PAY_TYPE_WE_CHAT)){
|
||||
// if(existStoreOrder.getIsChannel() == 1 || existStoreOrder.getIsChannel() == 2){
|
||||
// existStoreOrder.setOrderId(CrmebUtil.randomCount(100,999)+existStoreOrder.getOrderId());
|
||||
// }
|
||||
// }
|
||||
// if(request.getFrom().equals(Constants.PAY_TYPE_WE_CHAT_FROM_H5)){
|
||||
// if(existStoreOrder.getIsChannel() == 0 || existStoreOrder.getIsChannel() == 1){
|
||||
// existStoreOrder.setOrderId(CrmebUtil.randomCount(100,999)+existStoreOrder.getOrderId());
|
||||
// }
|
||||
// }
|
||||
// if(request.getFrom().equals(Constants.PAY_TYPE_WE_CHAT_FROM_PROGRAM)){
|
||||
// if(existStoreOrder.getIsChannel() == 0 || existStoreOrder.getIsChannel() == 2){
|
||||
// existStoreOrder.setOrderId(CrmebUtil.randomCount(100,999)+existStoreOrder.getOrderId());
|
||||
// }
|
||||
// }
|
||||
// 支付
|
||||
if (doPayOrder(request, ip, resultMap, existStoreOrder)) return resultMap;
|
||||
throw new CrmebException("支付方式错误");
|
||||
@@ -616,12 +615,10 @@ public class OrderServiceImpl implements OrderService {
|
||||
*/
|
||||
@Override
|
||||
public List<String> getRefundReason(){
|
||||
List<String> result = new ArrayList<>();
|
||||
String reasonString = systemConfigService.getValueByKey("stor_reason");
|
||||
reasonString = CrmebUtil.UnicodeToCN(reasonString);
|
||||
reasonString = reasonString.replace("rn", "n");
|
||||
result.addAll(Arrays.asList(reasonString.split("n")));
|
||||
return result;
|
||||
return Arrays.asList(reasonString.split("\\n"));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -744,7 +741,7 @@ public class OrderServiceImpl implements OrderService {
|
||||
StoreOrder existOrder = storeOrderService.getByEntityOne(storeOrderPram);
|
||||
if(null == existOrder) throw new CrmebException("未找到订单信息");
|
||||
existOrder.setPayType(payType);
|
||||
return storeOrderService.updateByEntity(existOrder);
|
||||
return storeOrderService.updateById(existOrder);
|
||||
}
|
||||
|
||||
///////////////////////////////////////////////////////////////////// 自定义方法
|
||||
|
||||
@@ -31,12 +31,12 @@ 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.UserToken;
|
||||
import com.zbkj.crmeb.user.request.RegisterThirdUserRequest;
|
||||
import com.zbkj.crmeb.user.request.UserOperateFundsRequest;
|
||||
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.user.service.UserTokenService;
|
||||
import com.zbkj.crmeb.wechat.response.RegisterThirdUserRequest;
|
||||
import com.zbkj.crmeb.wechat.response.WeChatAuthorizeLoginGetOpenIdResponse;
|
||||
import com.zbkj.crmeb.wechat.response.WeChatAuthorizeLoginUserInfoResponse;
|
||||
import com.zbkj.crmeb.wechat.response.WeChatProgramAuthorizeLoginGetOpenIdResponse;
|
||||
@@ -434,7 +434,7 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = {RuntimeException.class, Error.class, CrmebException.class})
|
||||
public LoginResponse weChatAuthorizeLogin(String code) {
|
||||
public LoginResponse weChatAuthorizeLogin(String code, Integer spreadUid) {
|
||||
try{
|
||||
WeChatAuthorizeLoginGetOpenIdResponse response = weChatService.authorizeLogin(code);
|
||||
User user = publicLogin(response.getOpenId(), response.getAccessToken());
|
||||
@@ -442,6 +442,8 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
LoginResponse loginResponse = new LoginResponse();
|
||||
loginResponse.setToken(userService.token(user));
|
||||
user.setPwd(null);
|
||||
//绑定推广关系
|
||||
userService.bindSpread(user, spreadUid);
|
||||
loginResponse.setUser(user);
|
||||
|
||||
return loginResponse;
|
||||
@@ -482,6 +484,7 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
|
||||
//TODO 是否需要强制注册用户,1 强制注册,2 需要返回数据给前端,让其输入手机号和验证码
|
||||
User user = userService.registerByThird(registerThirdUserRequest, Constants.USER_LOGIN_TYPE_PUBLIC);
|
||||
|
||||
userTokenService.bind(openId, Constants.THIRD_LOGIN_TOKEN_TYPE_PUBLIC, user.getUid());
|
||||
if(StringUtils.isNotBlank(unionId)) {
|
||||
//有就绑定
|
||||
@@ -526,6 +529,8 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
LoginResponse loginResponse = new LoginResponse();
|
||||
loginResponse.setToken(userService.token(user));
|
||||
user.setPwd(null);
|
||||
//绑定推广关系
|
||||
userService.bindSpread(user, request.getSpreadPid());
|
||||
loginResponse.setUser(user);
|
||||
|
||||
return loginResponse;
|
||||
@@ -705,6 +710,7 @@ public class UserCenterServiceImpl extends ServiceImpl<UserDao, User> implements
|
||||
|
||||
//TODO 是否需要强制注册用户,1 强制注册,2 需要返回数据给前端,让其输入手机号和验证码
|
||||
User user = userService.registerByThird(request, Constants.USER_LOGIN_TYPE_PROGRAM);
|
||||
|
||||
userTokenService.bind(openId, Constants.THIRD_LOGIN_TOKEN_TYPE_PROGRAM, user.getUid());
|
||||
if(StringUtils.isNotBlank(unionId)) {
|
||||
//有就绑定
|
||||
|
||||
@@ -218,6 +218,17 @@ public class OrderPayServiceImpl extends PayService implements OrderPayService {
|
||||
|
||||
// 更新用户下单数量
|
||||
updateUserPayCount();
|
||||
|
||||
//增加经验、积分
|
||||
updateFounds();
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新用户积分经验
|
||||
*/
|
||||
private void updateFounds() {
|
||||
userService.consumeAfterUpdateUserFounds(getOrder().getUid(), getOrder().getPayPrice(), Constants.USER_BILL_TYPE_PAY_ORDER);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -167,6 +167,9 @@ public class RechargePayServiceImpl extends PayService implements RechargePaySer
|
||||
getUserRecharge().setPayTime(DateUtil.nowDateTime());
|
||||
userRechargeService.updateById(getUserRecharge());
|
||||
|
||||
//增加经验、积分
|
||||
userService.consumeAfterUpdateUserFounds(getUserRecharge().getUid(), getUserRecharge().getPrice(), Constants.USER_BILL_TYPE_PAY_RECHARGE);
|
||||
|
||||
//下发模板通知
|
||||
pushTempMessage();
|
||||
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.zbkj.crmeb.store.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.store.model.StoreProductCoupon;
|
||||
import com.zbkj.crmeb.store.request.StoreProductCouponSearchRequest;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -13,9 +11,6 @@ import java.util.List;
|
||||
* @date 2020-08-07
|
||||
*/
|
||||
public interface StoreProductCouponService extends IService<StoreProductCoupon> {
|
||||
|
||||
List<StoreProductCoupon> getList(StoreProductCouponSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 根据产品id删除 优惠券关联信息
|
||||
* @param productId 产品id
|
||||
|
||||
@@ -1157,7 +1157,7 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
storeOrderUpdate.setPaid(true);
|
||||
storeOrderUpdate.setPayType(storeOrder.getPayType());
|
||||
storeOrderUpdate.setPayTime(new Date());
|
||||
boolean orderUpdate2PayResult = updateByEntity(storeOrderUpdate);
|
||||
boolean orderUpdate2PayResult = updateById(storeOrderUpdate);
|
||||
StoreOrderStatus storeOrderStatus = new StoreOrderStatus();
|
||||
storeOrderStatus.setOid(storeOrderUpdate.getId());
|
||||
storeOrderStatus.setChangeType(Constants.ORDER_LOG_PAY_SUCCESS);
|
||||
@@ -1166,13 +1166,13 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
UserBill userBill = new UserBill();
|
||||
userBill.setTitle("购买商品");
|
||||
userBill.setUid(currentUser.getUid());
|
||||
userBill.setCategory("nowMoney");
|
||||
userBill.setCategory(Constants.USER_BILL_CATEGORY_MONEY);
|
||||
userBill.setType(Constants.USER_BILL_TYPE_PAY_MONEY);
|
||||
userBill.setNumber(storeOrder.getPayPrice());
|
||||
userBill.setLinkId(storeOrder.getId()+"");
|
||||
userBill.setBalance(currentUser.getNowMoney());
|
||||
userBill.setMark("支付" + storeOrder.getPayPrice() + "元购买商品");
|
||||
boolean saveUserbillResult = userBillService.save(userBill);
|
||||
userBillService.save(userBill);
|
||||
userService.userPayCountPlus(currentUser);
|
||||
return orderUpdate2PayResult;
|
||||
}
|
||||
|
||||
@@ -2,13 +2,9 @@ package com.zbkj.crmeb.store.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.zbkj.crmeb.store.dao.StoreProductCouponDao;
|
||||
import com.zbkj.crmeb.store.model.StoreProductCoupon;
|
||||
import com.zbkj.crmeb.store.request.StoreProductCouponSearchRequest;
|
||||
import com.zbkj.crmeb.store.service.StoreProductCouponService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
@@ -24,28 +20,6 @@ public class StoreProductCouponServiceImpl extends ServiceImpl<StoreProductCoupo
|
||||
|
||||
@Resource
|
||||
private StoreProductCouponDao dao;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param request 请求参数
|
||||
* @param pageParamRequest 分页类参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-08-07
|
||||
* @return List<StoreProductCoupon>
|
||||
*/
|
||||
@Override
|
||||
public List<StoreProductCoupon> getList(StoreProductCouponSearchRequest request, PageParamRequest pageParamRequest) {
|
||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
|
||||
//带 StoreProductCoupon 类的多条件查询
|
||||
LambdaQueryWrapper<StoreProductCoupon> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
StoreProductCoupon model = new StoreProductCoupon();
|
||||
BeanUtils.copyProperties(request, model);
|
||||
lambdaQueryWrapper.setEntity(model);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param productId 产品id
|
||||
|
||||
@@ -4,6 +4,7 @@ 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.utils.CrmebUtil;
|
||||
import com.zbkj.crmeb.front.request.UserCollectAllRequest;
|
||||
import com.zbkj.crmeb.front.request.UserCollectRequest;
|
||||
import com.zbkj.crmeb.store.dao.StoreProductRelationDao;
|
||||
@@ -20,6 +21,7 @@ import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
@@ -118,15 +120,18 @@ public class StoreProductRelationServiceImpl extends ServiceImpl<StoreProductRel
|
||||
*/
|
||||
@Override
|
||||
public boolean all(UserCollectAllRequest request) {
|
||||
if(request.getProductId().length < 1){
|
||||
Integer[] arr = request.getProductId();
|
||||
if(arr.length < 1){
|
||||
throw new CrmebException("请选择产品");
|
||||
}
|
||||
|
||||
List<Integer> list = CrmebUtil.arrayUnique(arr);
|
||||
|
||||
Integer uid = userService.getUserIdException();
|
||||
deleteAll(request); //先删除所有已存在的
|
||||
deleteAll(request, uid, "collect"); //先删除所有已存在的
|
||||
|
||||
ArrayList<StoreProductRelation> storeProductRelationList = new ArrayList<>();
|
||||
for (Integer productId: request.getProductId()) {
|
||||
for (Integer productId: list) {
|
||||
StoreProductRelation storeProductRelation = new StoreProductRelation();
|
||||
storeProductRelation.setUid(uid);
|
||||
storeProductRelation.setType("collect");
|
||||
@@ -158,10 +163,12 @@ public class StoreProductRelationServiceImpl extends ServiceImpl<StoreProductRel
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-06
|
||||
*/
|
||||
private void deleteAll(UserCollectAllRequest request) {
|
||||
private void deleteAll(UserCollectAllRequest request, Integer uid, String type) {
|
||||
LambdaQueryWrapper<StoreProductRelation> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.in(StoreProductRelation::getProductId, (Object) request.getProductId()).
|
||||
eq(StoreProductRelation::getCategory, request.getCategory());
|
||||
lambdaQueryWrapper.in(StoreProductRelation::getProductId, Arrays.asList(request.getProductId()))
|
||||
.eq(StoreProductRelation::getCategory, request.getCategory())
|
||||
.eq(StoreProductRelation::getUid, uid)
|
||||
.eq(StoreProductRelation::getType, type);
|
||||
dao.delete(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -185,13 +185,14 @@ public class StoreProductServiceImpl extends ServiceImpl<StoreProductDao, StoreP
|
||||
//关键字搜索
|
||||
if(!StringUtils.isBlank(request.getKeywords())){
|
||||
lambdaQueryWrapper.and(i -> i
|
||||
.or().eq(StoreProduct::getId, request.getKeywords())
|
||||
.or().like(StoreProduct::getStoreName, request.getKeywords())
|
||||
.or().like(StoreProduct::getStoreInfo, request.getKeywords())
|
||||
.or().like(StoreProduct::getKeyword, request.getKeywords())
|
||||
.or().like(StoreProduct::getBarCode, request.getKeywords()));
|
||||
}
|
||||
if(StringUtils.isNotBlank(request.getCateId())){
|
||||
lambdaQueryWrapper.eq(StoreProduct::getCateId, request.getCateId());
|
||||
lambdaQueryWrapper.apply(CrmebUtil.getFindInSetSql("cate_id", request.getCateId()));
|
||||
}
|
||||
lambdaQueryWrapper.orderByDesc(StoreProduct::getSort).orderByDesc(StoreProduct::getId);
|
||||
List<StoreProduct> storeProducts = dao.selectList(lambdaQueryWrapper);
|
||||
|
||||
@@ -254,6 +254,9 @@ public class OrderUtils {
|
||||
User currentUser = userService.getInfo();
|
||||
|
||||
Integer offliePayStatus = Integer.valueOf(systemConfigService.getValueByKey("offline_pay_status"));
|
||||
|
||||
PriceGroupResponse currentOrderPriceGroup = getOrderPriceGroup(cor.getCartInfo(), null);
|
||||
|
||||
List<String> exsitPayType = getPayType().stream().filter(e->{
|
||||
if(offliePayStatus == 2 && e == Constants.PAY_TYPE_OFFLINE){
|
||||
return false;
|
||||
@@ -276,7 +279,7 @@ public class OrderUtils {
|
||||
ua.setUid(currentUser.getUid());
|
||||
ua.setId(request.getAddressId());
|
||||
UserAddress currentUserAddress = userAddressService.getUserAddress(ua);
|
||||
PriceGroupResponse currentOrderPriceGroup = getOrderPriceGroup(cor.getCartInfo(), currentUserAddress);
|
||||
currentOrderPriceGroup = getOrderPriceGroup(cor.getCartInfo(), currentUserAddress);
|
||||
payPostage = currentOrderPriceGroup.getStorePostage();
|
||||
}
|
||||
|
||||
@@ -319,17 +322,22 @@ public class OrderUtils {
|
||||
// 积分
|
||||
if(null != request.getUseIntegral() && currentUser.getIntegral().compareTo(BigDecimal.ZERO) > 0){
|
||||
deductionPrice = currentUser.getIntegral().multiply(BigDecimal.valueOf(Double.valueOf(cor.getOther().get("integralRatio").toString())));
|
||||
if(deductionPrice.compareTo(payPrice) < 0){
|
||||
payPrice = payPrice.subtract(deductionPrice);
|
||||
usedIntegral = currentUser.getIntegral();
|
||||
}else{
|
||||
deductionPrice = payPrice;
|
||||
if(payPrice.compareTo(BigDecimal.ZERO) > 0 && usedIntegral.compareTo(BigDecimal.ZERO) > 0){
|
||||
usedIntegral = payPrice.divide(usedIntegral);
|
||||
surPlusIntegral = currentUser.getIntegral().subtract(usedIntegral);
|
||||
if(request.getUseIntegral()){
|
||||
if(deductionPrice.compareTo(payPrice) < 0){
|
||||
payPrice = payPrice.subtract(deductionPrice);
|
||||
usedIntegral = currentUser.getIntegral();
|
||||
}else{
|
||||
deductionPrice = payPrice;
|
||||
if(payPrice.compareTo(BigDecimal.ZERO) > 0 && usedIntegral.compareTo(BigDecimal.ZERO) > 0){
|
||||
usedIntegral = payPrice.divide(usedIntegral);
|
||||
surPlusIntegral = currentUser.getIntegral().subtract(usedIntegral);
|
||||
}
|
||||
payPrice = BigDecimal.ZERO;
|
||||
}
|
||||
payPrice = BigDecimal.ZERO;
|
||||
}else{
|
||||
payPrice = currentOrderPriceGroup.getPayPrice();
|
||||
}
|
||||
|
||||
}else{
|
||||
deductionPrice = BigDecimal.ZERO;
|
||||
usedIntegral = BigDecimal.ZERO;
|
||||
|
||||
@@ -1,65 +1,65 @@
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 等级任务设置
|
||||
* </p>
|
||||
*
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("eb_system_user_task")
|
||||
@ApiModel(value="SystemUserTask对象", description="等级任务设置")
|
||||
public class SystemUserTaskRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "任务名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "配置原名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private String taskType;
|
||||
|
||||
@ApiModelProperty(value = "限定数")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty(value = "等级id")
|
||||
private Integer levelId;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否显示")
|
||||
private Boolean isShow;
|
||||
|
||||
@ApiModelProperty(value = "是否务必达成任务,1务必达成,0=满足其一")
|
||||
private Boolean isMust;
|
||||
|
||||
@ApiModelProperty(value = "任务说明")
|
||||
private String illustrate;
|
||||
|
||||
@ApiModelProperty(value = "新增时间")
|
||||
private Integer addTime;
|
||||
|
||||
|
||||
}
|
||||
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 io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 等级任务设置
|
||||
* </p>
|
||||
*
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@TableName("eb_system_user_task")
|
||||
@ApiModel(value="SystemUserTask对象", description="等级任务设置")
|
||||
public class SystemUserTaskRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "任务名称")
|
||||
private String name;
|
||||
|
||||
@ApiModelProperty(value = "配置原名")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "任务类型")
|
||||
private String taskType;
|
||||
|
||||
@ApiModelProperty(value = "限定数")
|
||||
private Integer number;
|
||||
|
||||
@ApiModelProperty(value = "等级id")
|
||||
private Integer levelId;
|
||||
|
||||
@ApiModelProperty(value = "排序")
|
||||
private Integer sort;
|
||||
|
||||
@ApiModelProperty(value = "是否显示")
|
||||
private Boolean isShow;
|
||||
|
||||
@ApiModelProperty(value = "是否务必达成任务,1务必达成,0=满足其一")
|
||||
private Boolean isMust;
|
||||
|
||||
@ApiModelProperty(value = "任务说明")
|
||||
private String illustrate;
|
||||
|
||||
@ApiModelProperty(value = "新增时间")
|
||||
private Integer addTime;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zbkj.crmeb.system.request;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -11,12 +10,11 @@ import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* 微信用户表
|
||||
* 核销
|
||||
* </p>
|
||||
*
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-11
|
||||
*/
|
||||
* @since 2020-*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
|
||||
@@ -36,7 +36,9 @@ public interface SystemConfigService extends IService<SystemConfig> {
|
||||
|
||||
boolean updateOrSaveValueByName(String name, String value);
|
||||
|
||||
String getValueByKeyException(String uploadUrl);
|
||||
String getValueByKeyException(String key);
|
||||
|
||||
String getValueByKeyNotStatus(String key);
|
||||
|
||||
boolean saveForm(SystemFormCheckRequest systemFormCheckRequest);
|
||||
|
||||
|
||||
@@ -22,7 +22,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.web.bind.annotation.RequestBody;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
@@ -91,23 +90,21 @@ public class SystemAdminServiceImpl extends ServiceImpl<SystemAdminDao, SystemAd
|
||||
PageParamRequest pageRole = new PageParamRequest();
|
||||
pageRole.setLimit(999);
|
||||
List<SystemRole> roleList = systemRoleService.getList(new SystemRoleSearchRequest(), pageRole);
|
||||
// for (SystemRole systemRole : roleList) {
|
||||
for (SystemAdmin admin : systemAdmins) {
|
||||
SystemAdminResponse sar = new SystemAdminResponse();
|
||||
BeanUtils.copyProperties(admin, sar);
|
||||
if(StringUtils.isBlank(admin.getRoles())) break;
|
||||
List<Integer> roleIds = CrmebUtil.stringToArrayInt(admin.getRoles());
|
||||
List<String> roleNames = new ArrayList<>();
|
||||
for (Integer roleId : roleIds) {
|
||||
List<SystemRole> hasRoles = roleList.stream().filter(e -> e.getId() == roleId).collect(Collectors.toList());
|
||||
if(hasRoles.size()> 0){
|
||||
roleNames.add(hasRoles.stream().map(SystemRole::getRoleName).collect(Collectors.joining(",")));
|
||||
}
|
||||
for (SystemAdmin admin : systemAdmins) {
|
||||
SystemAdminResponse sar = new SystemAdminResponse();
|
||||
BeanUtils.copyProperties(admin, sar);
|
||||
if(StringUtils.isBlank(admin.getRoles())) continue;
|
||||
List<Integer> roleIds = CrmebUtil.stringToArrayInt(admin.getRoles());
|
||||
List<String> roleNames = new ArrayList<>();
|
||||
for (Integer roleId : roleIds) {
|
||||
List<SystemRole> hasRoles = roleList.stream().filter(e -> e.getId().equals(roleId)).collect(Collectors.toList());
|
||||
if(hasRoles.size()> 0){
|
||||
roleNames.add(hasRoles.stream().map(SystemRole::getRoleName).collect(Collectors.joining(",")));
|
||||
}
|
||||
sar.setRoleNames(StringUtils.join(roleNames,","));
|
||||
systemAdminResponses.add(sar);
|
||||
}
|
||||
// }
|
||||
sar.setRoleNames(StringUtils.join(roleNames,","));
|
||||
systemAdminResponses.add(sar);
|
||||
}
|
||||
return systemAdminResponses;
|
||||
}
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class SystemAttachmentServiceImpl extends ServiceImpl<SystemAttachmentDao
|
||||
*/
|
||||
@Override
|
||||
public void async() {
|
||||
String uploadType = systemConfigService.getValueByKeyException("upload_type");
|
||||
String uploadType = systemConfigService.getValueByKeyException("uploadType");
|
||||
if(Integer.parseInt(uploadType) <= 1){
|
||||
//本地存储
|
||||
return;
|
||||
|
||||
@@ -2,17 +2,16 @@ package com.zbkj.crmeb.system.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.zbkj.crmeb.system.model.SystemConfig;
|
||||
import com.zbkj.crmeb.system.dao.SystemConfigDao;
|
||||
import com.zbkj.crmeb.system.model.SystemConfig;
|
||||
import com.zbkj.crmeb.system.request.SystemFormCheckRequest;
|
||||
import com.zbkj.crmeb.system.request.SystemFormItemCheckRequest;
|
||||
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
||||
import com.zbkj.crmeb.system.service.SystemConfigService;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.zbkj.crmeb.system.service.SystemFormTempService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -130,12 +129,28 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
eq(SystemConfig::getName, name);
|
||||
|
||||
SystemConfig systemConfig = dao.selectOne(lambdaQueryWrapper);
|
||||
if(null == systemConfig){
|
||||
throw new CrmebException("没有找到"+ name +"数据");
|
||||
}
|
||||
|
||||
if(StringUtils.isBlank(systemConfig.getValue())){
|
||||
throw new CrmebException("配置项 " + systemConfig.getTitle() + " 没有配置, 请配置!");
|
||||
}
|
||||
return systemConfig.getValue();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getValueByKeyNotStatus(String key) {
|
||||
LambdaQueryWrapper<SystemConfig> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
lambdaQueryWrapper.select(SystemConfig::getValue).eq(SystemConfig::getName, key);
|
||||
|
||||
SystemConfig systemConfig = dao.selectOne(lambdaQueryWrapper);
|
||||
if(StringUtils.isBlank(systemConfig.getValue())){
|
||||
systemConfig.setValue(null);
|
||||
}
|
||||
return systemConfig.getValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 整体保存表单数据
|
||||
* @param systemFormCheckRequest SystemFormCheckRequest 数据保存
|
||||
@@ -151,11 +166,18 @@ public class SystemConfigServiceImpl extends ServiceImpl<SystemConfigDao, System
|
||||
//修改之前的数据
|
||||
updateStatusByFormId(systemFormCheckRequest.getId());
|
||||
List<SystemConfig> systemConfigList = new ArrayList<>();
|
||||
|
||||
//批量添加
|
||||
for (SystemFormItemCheckRequest systemFormItemCheckRequest : systemFormCheckRequest.getFields()) {
|
||||
SystemConfig systemConfig = new SystemConfig();
|
||||
systemConfig.setName(systemFormItemCheckRequest.getName());
|
||||
systemConfig.setValue(systemAttachmentService.clearPrefix(systemFormItemCheckRequest.getValue()));
|
||||
|
||||
String value = systemAttachmentService.clearPrefix(systemFormItemCheckRequest.getValue());
|
||||
if(StringUtils.isBlank(value)){
|
||||
//去掉图片域名之后没有数据则说明当前数据就是图片域名
|
||||
value = systemFormItemCheckRequest.getValue();
|
||||
}
|
||||
systemConfig.setValue(value);
|
||||
systemConfig.setFormId(systemFormCheckRequest.getId());
|
||||
systemConfig.setTitle(systemFormItemCheckRequest.getTitle());
|
||||
systemConfigList.add(systemConfig);
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.zbkj.crmeb.task;
|
||||
|
||||
import com.utils.DateUtil;
|
||||
import com.zbkj.crmeb.sms.model.SmsRecord;
|
||||
import com.zbkj.crmeb.sms.service.SmsRecordService;
|
||||
import com.zbkj.crmeb.sms.service.SmsService;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* @Classname AsyncSmsSendResult
|
||||
* @Description 发送短信
|
||||
* @Date 2020/8/18
|
||||
* @Created by stivepeim
|
||||
*/
|
||||
//@Component
|
||||
//@Configuration //读取配置
|
||||
//@EnableScheduling // 2.开启定时任务
|
||||
public class AsyncSmsSendResult {
|
||||
// //日志
|
||||
// private static final Logger logger = LoggerFactory.getLogger(AsyncSmsSendResult.class);
|
||||
//
|
||||
// @Autowired
|
||||
// private SmsRecordService smsRecordsService;
|
||||
//
|
||||
// @Scheduled(fixedDelay = 1000 * 10L) // todo 后面更改为 一分钟同步一次数据
|
||||
// public void init(){
|
||||
// logger.info("---AsyncSmsResult task------produce Data with fixed rate task: Execution Time - {}", DateUtil.nowDate());
|
||||
// try {
|
||||
// smsRecordsService.consumeSmsStatus();
|
||||
//
|
||||
// }catch (Exception e){
|
||||
// e.printStackTrace();
|
||||
// logger.error("AsyncSmsSend.task" + " | msg : " + e.getMessage());
|
||||
// }
|
||||
//
|
||||
// }
|
||||
}
|
||||
@@ -89,6 +89,7 @@ public class AsyncServiceImpl implements AsyncService {
|
||||
setConf(type);
|
||||
cos(systemAttachmentList);
|
||||
default:
|
||||
pre = "local";
|
||||
break;
|
||||
}
|
||||
}catch (Exception e){
|
||||
@@ -97,14 +98,13 @@ public class AsyncServiceImpl implements AsyncService {
|
||||
}
|
||||
|
||||
private void setConf(Integer uploadType) {
|
||||
|
||||
// if(uploadType > 1){
|
||||
cloudVo.setDomain(systemConfigService.getValueByKeyException(pre+"UploadUrl"));
|
||||
cloudVo.setDomain(systemConfigService.getValueByKeyException(pre+"UploadUrl"));
|
||||
if(uploadType > 1){
|
||||
cloudVo.setAccessKey(systemConfigService.getValueByKeyException(pre+"AccessKey"));
|
||||
cloudVo.setSecretKey(systemConfigService.getValueByKeyException(pre+"SecretKey"));
|
||||
cloudVo.setBucketName(systemConfigService.getValueByKeyException(pre+"StorageName"));
|
||||
cloudVo.setRegion(systemConfigService.getValueByKeyException(pre+"StorageRegion"));
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -231,7 +231,7 @@ public class AsyncServiceImpl implements AsyncService {
|
||||
break;
|
||||
}
|
||||
|
||||
return systemConfigService.getValueByKeyException(pre+"UploadUrl");
|
||||
return systemConfigService.getValueByKeyNotStatus(pre+"UploadUrl");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -72,6 +72,12 @@ public class User implements Serializable {
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
private int sex;
|
||||
|
||||
@ApiModelProperty(value = "国家")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "添加ip")
|
||||
private String addIp;
|
||||
|
||||
|
||||
@@ -65,7 +65,7 @@ public class UserBill implements Serializable {
|
||||
private String mark;
|
||||
|
||||
@ApiModelProperty(value = "0 = 带确定 1 = 有效 -1 = 无效")
|
||||
private int status;
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
private Date updateTime;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
package com.zbkj.crmeb.wechat.response;
|
||||
package com.zbkj.crmeb.user.request;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
|
||||
@@ -62,15 +62,9 @@ public class UserSearchRequest implements Serializable {
|
||||
@NotNull(message = "访问情况不能为空")
|
||||
private Integer accessType = 0;
|
||||
|
||||
@ApiModelProperty(value = "国家")
|
||||
@ApiModelProperty(value = "国家,中国CN,其他OTHER")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "省份")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "城市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
@ApiModelProperty(value = "性别,0未知,1男,2女,3保密")
|
||||
private String sex;
|
||||
}
|
||||
|
||||
@@ -52,6 +52,12 @@ public class UserResponse {
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "性别")
|
||||
private int sex;
|
||||
|
||||
@ApiModelProperty(value = "国家")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
|
||||
@@ -112,7 +118,7 @@ public class UserResponse {
|
||||
@ApiModelProperty(value = "用户登陆类型,h5,wechat,routine")
|
||||
private String loginType;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@ApiModelProperty(value = "更新时间")
|
||||
private Date updateTime;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
|
||||
@@ -14,12 +14,12 @@ import com.zbkj.crmeb.front.response.UserSpreadPeopleItemResponse;
|
||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.store.request.RetailShopStairUserRequest;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.request.RegisterThirdUserRequest;
|
||||
import com.zbkj.crmeb.user.request.UserOperateFundsRequest;
|
||||
import com.zbkj.crmeb.user.request.UserOperateIntegralMoneyRequest;
|
||||
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.wechat.response.RegisterThirdUserRequest;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
@@ -133,4 +133,8 @@ public interface UserService extends IService<User> {
|
||||
Integer getCountByPayCount(int minPayCount, int maxPayCount);
|
||||
|
||||
List<User> getUserByEntity(User user);
|
||||
|
||||
void consumeAfterUpdateUserFounds(Integer uid, BigDecimal price, String type);
|
||||
|
||||
void bindSpread(User user, Integer spreadPid);
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ 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.RegisterThirdUserRequest;
|
||||
import com.zbkj.crmeb.user.request.UserOperateFundsRequest;
|
||||
import com.zbkj.crmeb.user.request.UserOperateIntegralMoneyRequest;
|
||||
import com.zbkj.crmeb.user.request.UserSearchRequest;
|
||||
@@ -48,7 +49,6 @@ import com.zbkj.crmeb.user.response.TopDetail;
|
||||
import com.zbkj.crmeb.user.response.UserResponse;
|
||||
import com.zbkj.crmeb.user.service.*;
|
||||
import com.zbkj.crmeb.user.vo.UserOperateFundsVo;
|
||||
import com.zbkj.crmeb.wechat.response.RegisterThirdUserRequest;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -143,11 +143,18 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
lambdaQueryWrapper.eq(User::getUserType, request.getUserType());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(request.getSex())){
|
||||
lambdaQueryWrapper.eq(User::getSex, request.getSex());
|
||||
}
|
||||
|
||||
if(StringUtils.isNotBlank(request.getCountry())){
|
||||
lambdaQueryWrapper.eq(User::getCountry, request.getCountry());
|
||||
}
|
||||
|
||||
if(request.getStatus() != null){
|
||||
lambdaQueryWrapper.eq(User::getStatus, request.getStatus());
|
||||
}
|
||||
|
||||
|
||||
dateLimitUtilVo dateLimit = DateUtil.getDateLimit(request.getData());
|
||||
|
||||
if(!StringUtils.isBlank(dateLimit.getStartTime())){
|
||||
@@ -427,6 +434,10 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
//生成token
|
||||
LoginResponse loginResponse = new LoginResponse();
|
||||
loginResponse.setToken(token(user));
|
||||
|
||||
//绑定推广关系
|
||||
bindSpread(user, request.getSpread());
|
||||
|
||||
loginResponse.setUser(user);
|
||||
long time = Constants.TOKEN_EXPRESS_MINUTES * 60;
|
||||
|
||||
@@ -460,8 +471,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
loginResponse.setToken(token(user));
|
||||
user.setPwd(null);
|
||||
|
||||
//TODO 看分销类型
|
||||
|
||||
//绑定推广关系
|
||||
bindSpread(user, request.getSpreadPid());
|
||||
|
||||
loginResponse.setUser(user);
|
||||
|
||||
@@ -801,7 +812,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
tagIdValue = user.getTagId() + tagIdValue;
|
||||
}
|
||||
//清除已经删除或者去掉的id
|
||||
tagIdValue = userGroupService.clean(tagIdValue);
|
||||
tagIdValue = userTagService.clean(tagIdValue);
|
||||
if(StringUtils.isBlank(tagIdValue)){
|
||||
continue;
|
||||
}
|
||||
@@ -980,7 +991,7 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
break;
|
||||
}
|
||||
|
||||
return Constants.USER_BILL_OPERATE_LOG_TITLE.replace("{title}", request.getTitle()).replace("{$operate}", operate).replace("{$founds}", founds);
|
||||
return Constants.USER_BILL_OPERATE_LOG_TITLE.replace("{$title}", request.getTitle()).replace("{$operate}", operate).replace("{$founds}", founds);
|
||||
}
|
||||
|
||||
|
||||
@@ -1162,6 +1173,8 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
user.setNickname(thirdUserRequest.getNickName());
|
||||
user.setAvatar(thirdUserRequest.getAvatar());
|
||||
user.setSpreadUid(thirdUserRequest.getSpreadPid());
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
user.setSex(Integer.parseInt(thirdUserRequest.getSex()));
|
||||
user.setAddres(thirdUserRequest.getCountry() + "," + thirdUserRequest.getProvince() + "," + thirdUserRequest.getCity());
|
||||
save(user);
|
||||
return user;
|
||||
@@ -1394,4 +1407,64 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
lambdaUpdateWrapper.setEntity(user);
|
||||
return userDao.selectList(lambdaUpdateWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 消费金钱之后增加经验和积分
|
||||
* @param uid Integer 用户id
|
||||
* @param price BigDecimal 实际支付金额
|
||||
* @return void
|
||||
*/
|
||||
@Override
|
||||
public void consumeAfterUpdateUserFounds(Integer uid, BigDecimal price, String type) {
|
||||
//赠送积分比例
|
||||
String integralStr = systemConfigService.getValueByKey(Constants.CONFIG_KEY_INTEGRAL_RATE);
|
||||
BigDecimal integral = new BigDecimal(integralStr);
|
||||
|
||||
//更新用户积分信息
|
||||
UserOperateFundsRequest founds = new UserOperateFundsRequest();
|
||||
founds.setFoundsType(type);
|
||||
founds.setTitle(Constants.ORDER_LOG_MESSAGE_PAY_SUCCESS);
|
||||
|
||||
founds.setUid(uid);
|
||||
founds.setFoundsCategory(Constants.USER_BILL_CATEGORY_INTEGRAL);
|
||||
founds.setType(1);
|
||||
|
||||
//参考 CrmebUtil getRate说明
|
||||
founds.setValue(integral.multiply(price).setScale(0, BigDecimal.ROUND_DOWN));
|
||||
updateFounds(founds, true);
|
||||
|
||||
//更新用户经验信息
|
||||
founds.setUid(uid);
|
||||
founds.setFoundsCategory(Constants.USER_BILL_CATEGORY_EXPERIENCE);
|
||||
founds.setType(1);
|
||||
founds.setValue(price.setScale(0, BigDecimal.ROUND_DOWN));
|
||||
updateFounds(founds, true);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定分销关系
|
||||
* @param user User 用户user类
|
||||
* @param spreadUid Integer 推广人id
|
||||
* @return void
|
||||
*/
|
||||
@Override
|
||||
public void bindSpread(User user, Integer spreadUid) {
|
||||
//新用户会在注册的时候单独绑定,此处只处理登录用户
|
||||
if(spreadUid == 0){
|
||||
return;
|
||||
}
|
||||
//如果当前用户没有绑定,并且后台配置人人分销,那么需要邦迪
|
||||
if(user.getSpreadUid() > 0){
|
||||
return;
|
||||
}
|
||||
|
||||
String distribution = systemConfigService.getValueByKey(Constants.CONFIG_KEY_DISTRIBUTION_TYPE);
|
||||
|
||||
//人人分销 + 当前已绑定的id和推广人id不一样
|
||||
if(distribution.equals("0") && !user.getSpreadUid().equals(spreadUid)){
|
||||
user.setSpreadUid(spreadUid);
|
||||
user.setSpreadTime(DateUtil.nowDateTime());
|
||||
}
|
||||
updateById(user);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -384,6 +384,7 @@ public class UserSignServiceImpl extends ServiceImpl<UserSignDao, UserSign> impl
|
||||
public List<UserSign> getListByCondition(UserSign sign, PageParamRequest pageParamRequest) {
|
||||
LambdaQueryWrapper<UserSign> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.setEntity(sign);
|
||||
lqw.orderByDesc(UserSign::getCreateTime);
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user