全新UI视觉体验,移动端API优化降低重复调用,提高并发6倍,修复N多Bug
This commit is contained in:
@@ -62,7 +62,12 @@ public class CheckFrontToken {
|
||||
"api/front/coupons",
|
||||
"api/front/index",
|
||||
"api/front/bargain/list",
|
||||
"api/front/combination/list"
|
||||
"api/front/combination/list",
|
||||
"api/front/index/product",
|
||||
"api/front/combination/index",
|
||||
"api/front/bargain/index",
|
||||
"/api/front/index"
|
||||
|
||||
};
|
||||
|
||||
return ArrayUtils.contains(routerList, uri);
|
||||
|
||||
@@ -1,10 +1,11 @@
|
||||
package com.common;
|
||||
|
||||
import com.constants.Constants;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.store.response.StoreProductResponse;
|
||||
import lombok.Data;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.data.domain.Page;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -59,6 +60,7 @@ public class CommonPage<T> {
|
||||
|
||||
/**
|
||||
* 将PageHelper分页后的 PageInfo 转为分页信息
|
||||
* @return
|
||||
*/
|
||||
public static <T> CommonPage<T> restPage(PageInfo<T> pageInfo) {
|
||||
CommonPage<T> result = new CommonPage<T>();
|
||||
|
||||
33
crmeb/src/main/java/com/common/SearchAndPageRequest.java
Normal file
33
crmeb/src/main/java/com/common/SearchAndPageRequest.java
Normal file
@@ -0,0 +1,33 @@
|
||||
package com.common;
|
||||
|
||||
import com.constants.Constants;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 查询分页公共请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
public class SearchAndPageRequest {
|
||||
|
||||
@ApiModelProperty(value = "搜索关键字")
|
||||
private String keywords;
|
||||
|
||||
@ApiModelProperty(value = "页码", example= Constants.DEFAULT_PAGE + "")
|
||||
private int page = Constants.DEFAULT_PAGE;
|
||||
|
||||
@ApiModelProperty(value = "每页数量", example = Constants.DEFAULT_LIMIT + "")
|
||||
private int limit = Constants.DEFAULT_LIMIT;
|
||||
|
||||
@ApiModelProperty(value = "优惠券类型:1-手动领取,3-赠送券")
|
||||
private Integer type;
|
||||
}
|
||||
@@ -74,6 +74,12 @@ public class Constants {
|
||||
//用户登录方式 小程序
|
||||
public static final String USER_LOGIN_TYPE_PROGRAM = "routine";
|
||||
|
||||
// 用户登录方式 App
|
||||
public static final String USER_LOGIN_TYPE_IOS_WX = "iosWx";
|
||||
public static final String USER_LOGIN_TYPE_ANDROID_WX = "androidWx";
|
||||
|
||||
// 用户登录方式 App
|
||||
public static final String USER_LOGIN_TYPE_IOS = "ios";
|
||||
|
||||
|
||||
//用户默认头像
|
||||
@@ -180,6 +186,10 @@ public class Constants {
|
||||
public static final String CONFIG_KEY_PAY_ROUTINE_APP_SECRET = "pay_routine_appsecret"; //小程序秘钥
|
||||
public static final String CONFIG_KEY_PAY_ROUTINE_APP_KEY = "pay_routine_key"; //小程序支付key
|
||||
|
||||
public static final String CONFIG_KEY_PAY_WE_CHAT_APP_APP_ID = "pay_weixin_app_appid"; //公众号appId
|
||||
public static final String CONFIG_KEY_PAY_WE_CHAT_APP_MCH_ID = "pay_weixin_app_mchid"; //公众号配的商户号
|
||||
public static final String CONFIG_KEY_PAY_WE_CHAT_APP_APP_KEY = "pay_weixin_app_key"; //公众号支付key
|
||||
|
||||
public static final String CONFIG_KEY_RECHARGE_MIN_AMOUNT = "store_user_min_recharge"; //最小充值金额
|
||||
// public static final String CONFIG_KEY_PROGRAM_LOGO = "routine_logo"; //小程序logo
|
||||
// public static final String CONFIG_KEY_PUBLIC_LOGO = "wechat_avatar"; //公众号logo
|
||||
@@ -198,7 +208,8 @@ public class Constants {
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_USER_EXTRACT_MIN_PRICE = "user_extract_min_price"; //提现最低金额
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_MODEL = "store_brokerage_status"; //分销模式1-指定分销2-人人分销
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_USER_EXTRACT_BANK = "user_extract_bank"; //提现银行卡
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_EXTRACT_TIME = "extract_time"; //冻结时间
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_EXTRACT_TIME = "extract_time"; //佣金冻结时间
|
||||
public static final String CONFIG_KEY_STORE_INTEGRAL_EXTRACT_TIME = "freeze_integral_day"; //积分冻结时间
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_PERSON_PRICE = "store_brokerage_price"; //人人分销满足金额
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_IS_OPEN = "brokerage_func_status"; //分销启用
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_BIND_TYPE = "brokerageBindind"; //分销关系绑定0-所有游湖,2-新用户
|
||||
@@ -224,6 +235,9 @@ public class Constants {
|
||||
public static final int THIRD_LOGIN_TOKEN_TYPE_PROGRAM = 2; //小程序
|
||||
public static final int THIRD_LOGIN_TOKEN_TYPE_UNION_ID = 3; //unionid
|
||||
public static final int THIRD_ADMIN_LOGIN_TOKEN_TYPE_PUBLIC = 4; //后台登录公众号
|
||||
public static final int THIRD_LOGIN_TOKEN_TYPE_IOS_WX = 5; //ios 微信
|
||||
public static final int THIRD_LOGIN_TOKEN_TYPE_ANDROID_WX = 6; //android微信
|
||||
public static final int THIRD_LOGIN_TOKEN_TYPE_IOS = 7; //ios
|
||||
|
||||
|
||||
// 商品类型 活动类型 0=商品,1=秒杀,2=砍价,3=拼团 attrResult表用到
|
||||
@@ -235,6 +249,8 @@ public class Constants {
|
||||
public static final String PRODUCT_TYPE_BARGAIN_STR = "砍价";
|
||||
public static final Integer PRODUCT_TYPE_PINGTUAN= 3;
|
||||
public static final String PRODUCT_TYPE_PINGTUAN_STR= "拼团";
|
||||
public static final Integer PRODUCT_TYPE_COMPONENT= 4;
|
||||
public static final String PRODUCT_TYPE_COMPONENT_STR= "组件";
|
||||
public static final Integer PRODUCT_TYPE_GROUP = 0;
|
||||
|
||||
|
||||
@@ -260,6 +276,7 @@ public class Constants {
|
||||
public static final Integer GROUP_DATA_ID_INDEX_EX_BANNER = 70; //首页超值爆款
|
||||
public static final Integer GROUP_DATA_ID_INDEX_KEYWORDS = 71; //热门搜索
|
||||
public static final Integer GROUP_DATA_ID_ADMIN_LOGIN_BANNER_IMAGE_LIST = 72; //后台登录页面轮播图
|
||||
public static final Integer GROUP_DATA_ID_COMBINATION_LIST_BANNNER = 73; //拼团列表banner
|
||||
|
||||
|
||||
|
||||
@@ -297,6 +314,7 @@ public class Constants {
|
||||
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 int INDEX_GOOD_BANNER = 5; //优选推荐
|
||||
|
||||
public static final String INDEX_BAST_LIMIT = "bastNumber"; //精品推荐个数
|
||||
public static final String INDEX_FIRST_LIMIT = "firstNumber"; //首发新品个数
|
||||
@@ -446,6 +464,10 @@ public class Constants {
|
||||
//支付渠道 订单表
|
||||
public static final int ORDER_PAY_CHANNEL_PUBLIC = 0; //公众号
|
||||
public static final int ORDER_PAY_CHANNEL_PROGRAM = 1; //小程序
|
||||
public static final int ORDER_PAY_CHANNEL_H5 = 2; //H5
|
||||
public static final int ORDER_PAY_CHANNEL_YUE = 3; //余额
|
||||
public static final int ORDER_PAY_CHANNEL_APP_IOS = 4; //app-ios
|
||||
public static final int ORDER_PAY_CHANNEL_APP_ANDROID = 5; //app-android
|
||||
|
||||
//微信消息模板 tempKey
|
||||
public static final String WE_CHAT_TEMP_KEY_FIRST = "first";
|
||||
@@ -461,12 +483,12 @@ public class Constants {
|
||||
public static final String WE_CHAT_PUBLIC_TEMP_KEY_RECHARGE = "OPENTM200565260";// 充值成功
|
||||
|
||||
// 小程序服务通知
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_COMBINATION_SUCCESS = "5164";
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_BARGAIN_SUCCESS = "2920";
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_EXPRESS = "467";
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_DELIVERY = "14198";
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_ORDER_PAY = "516";
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_ORDER_RECEIVING = "9283";
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_COMBINATION_SUCCESS = "5164";// 拼团成功
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_BARGAIN_SUCCESS = "2920";// 砍价成功
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_EXPRESS = "467";// 订单发货提醒
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_DELIVERY = "14198";// 订单配送通知
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_ORDER_PAY = "516";// 订单支付成功通知
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_ORDER_RECEIVING = "9283";// 订单收货通知
|
||||
public static final String WE_CHAT_PROGRAM_TEMP_KEY_RECHARGE = "OPENTM200565260";
|
||||
|
||||
|
||||
@@ -526,4 +548,9 @@ public class Constants {
|
||||
|
||||
// 订单取消Key
|
||||
public static final String ORDER_AUTO_CANCEL_KEY = "order_auto_cancel_key";
|
||||
|
||||
/** 公共开关:0关闭 */
|
||||
public static final String COMMON_SWITCH_CLOSE = "0";
|
||||
/** 公共开关:1开启 */
|
||||
public static final String COMMON_SWITCH_OPEN = "1";
|
||||
}
|
||||
|
||||
71
crmeb/src/main/java/com/constants/CouponConstants.java
Normal file
71
crmeb/src/main/java/com/constants/CouponConstants.java
Normal file
@@ -0,0 +1,71 @@
|
||||
package com.constants;
|
||||
|
||||
/**
|
||||
* 优惠券常量类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class CouponConstants {
|
||||
|
||||
/**
|
||||
* ---------------------------------------
|
||||
* --------优惠券常量----------------------
|
||||
* ---------------------------------------
|
||||
*/
|
||||
|
||||
/** 优惠券类型—手动领取 */
|
||||
public static final Integer COUPON_TYPE_RECEIVE = 1;
|
||||
|
||||
/** 优惠券类型—新人券 */
|
||||
public static final Integer COUPON_TYPE_NEW_PEOPLE = 2;
|
||||
|
||||
/** 优惠券类型—赠送券 */
|
||||
public static final Integer COUPON_TYPE_GIVE_AWAY = 3;
|
||||
|
||||
/** 优惠券使用类型-通用 */
|
||||
public static final Integer COUPON_USE_TYPE_COMMON = 1;
|
||||
|
||||
/** 优惠券使用类型-商品 */
|
||||
public static final Integer COUPON_USE_TYPE_PRODUCT = 2;
|
||||
|
||||
/** 优惠券使用类型-品类 */
|
||||
public static final Integer COUPON_USE_TYPE_CATEGORY = 3;
|
||||
|
||||
|
||||
/**
|
||||
* ---------------------------------------
|
||||
* --------用户优惠券常量-------------------
|
||||
* ---------------------------------------
|
||||
*/
|
||||
|
||||
/** 用户优惠券领取类型—用户注册 */
|
||||
public static final String STORE_COUPON_USER_TYPE_REGISTER = "new";
|
||||
|
||||
/** 用户优惠券领取类型—用户领取 */
|
||||
public static final String STORE_COUPON_USER_TYPE_GET = "receive";
|
||||
|
||||
/** 用户优惠券领取类型—后台发放 */
|
||||
public static final String STORE_COUPON_USER_TYPE_SEND = "send";
|
||||
|
||||
/** 用户优惠券领取类型—买赠送 */
|
||||
public static final String STORE_COUPON_USER_TYPE_BUY = "buy";
|
||||
|
||||
/** 用户优惠券状态—未使用 */
|
||||
public static final Integer STORE_COUPON_USER_STATUS_USABLE = 0;
|
||||
|
||||
/** 用户优惠券状态—已使用 */
|
||||
public static final Integer STORE_COUPON_USER_STATUS_USED = 1;
|
||||
|
||||
/** 用户优惠券状态—已失效 */
|
||||
public static final Integer STORE_COUPON_USER_STATUS_LAPSED = 2;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package com.constants;
|
||||
|
||||
/**
|
||||
* 积分记录常量类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class IntegralRecordConstants {
|
||||
|
||||
/** 佣金记录类型—增加 */
|
||||
public static final Integer INTEGRAL_RECORD_TYPE_ADD = 1;
|
||||
|
||||
/** 佣金记录类型—扣减 */
|
||||
public static final Integer INTEGRAL_RECORD_TYPE_SUB = 2;
|
||||
|
||||
/** 佣金记录状态—创建 */
|
||||
public static final Integer INTEGRAL_RECORD_STATUS_CREATE = 1;
|
||||
|
||||
/** 佣金记录状态—冻结期 */
|
||||
public static final Integer INTEGRAL_RECORD_STATUS_FROZEN = 2;
|
||||
|
||||
/** 佣金记录状态—完成 */
|
||||
public static final Integer INTEGRAL_RECORD_STATUS_COMPLETE = 3;
|
||||
|
||||
/** 佣金记录状态—失效(订单退款) */
|
||||
public static final Integer INTEGRAL_RECORD_STATUS_INVALIDATION = 4;
|
||||
|
||||
/** 佣金记录关联类型—订单 */
|
||||
public static final String INTEGRAL_RECORD_LINK_TYPE_ORDER = "order";
|
||||
|
||||
/** 佣金记录关联类型—签到 */
|
||||
public static final String INTEGRAL_RECORD_LINK_TYPE_SIGN = "sign";
|
||||
|
||||
/** 佣金记录关联类型—系统后台 */
|
||||
public static final String INTEGRAL_RECORD_LINK_TYPE_SYSTEM = "system";
|
||||
|
||||
/** 佣金记录标题—用户订单付款成功 */
|
||||
public static final String BROKERAGE_RECORD_TITLE_ORDER = "用户订单付款成功";
|
||||
|
||||
/** 佣金记录标题—签到经验奖励 */
|
||||
public static final String BROKERAGE_RECORD_TITLE_SIGN = "签到积分奖励";
|
||||
|
||||
/** 佣金记录标题—后台积分操作 */
|
||||
public static final String BROKERAGE_RECORD_TITLE_SYSTEM = "后台积分操作";
|
||||
|
||||
/** 佣金记录标题—订单退款 */
|
||||
public static final String BROKERAGE_RECORD_TITLE_REFUND = "订单退款";
|
||||
}
|
||||
@@ -25,6 +25,8 @@ public class PayConstants {
|
||||
public static final String PAY_CHANNEL_WE_CHAT_H5 = "weixinh5"; //H5唤起微信支付
|
||||
public static final String PAY_CHANNEL_WE_CHAT_PUBLIC = "public"; //公众号
|
||||
public static final String PAY_CHANNEL_WE_CHAT_PROGRAM = "routine"; //小程序
|
||||
public static final String PAY_CHANNEL_WE_CHAT_APP_IOS = "weixinAppIos"; //微信App支付ios
|
||||
public static final String PAY_CHANNEL_WE_CHAT_APP_ANDROID = "weixinAppAndroid"; //微信App支付android
|
||||
|
||||
public static final String WX_PAY_TRADE_TYPE_JS = "JSAPI";
|
||||
public static final String WX_PAY_TRADE_TYPE_H5 = "MWEB";
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.zbkj.crmeb.payment.service;
|
||||
|
||||
import com.zbkj.crmeb.payment.vo.wechat.CreateOrderResponseVo;
|
||||
package com.constants;
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
* Redis常量类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
@@ -14,8 +12,9 @@ import com.zbkj.crmeb.payment.vo.wechat.CreateOrderResponseVo;
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public abstract class PayService {
|
||||
public abstract CreateOrderResponseVo payOrder(Integer orderId, String from, String clientIp);
|
||||
public class RedisConstatns {
|
||||
|
||||
/** 用户注册信息缓存Key */
|
||||
public static final String USER_REGISTER_KEY = "USER:REGISTER:";
|
||||
|
||||
public abstract boolean success(String orderId, Integer userId, String payType);
|
||||
}
|
||||
@@ -21,7 +21,7 @@ public class SmsConstants {
|
||||
public static final String SMS_SEND_KEY = "sms_send_list";
|
||||
|
||||
/** 手机验证码redis key */
|
||||
public static final String SMS_VALIDATE_PHONE = "sms_validate_code:";
|
||||
public static final String SMS_VALIDATE_PHONE = "sms:validate:code:";
|
||||
|
||||
/**
|
||||
* ---------------------
|
||||
|
||||
@@ -21,5 +21,53 @@ public class SysConfigConstants {
|
||||
/** 登录页背景图 */
|
||||
public static final String CONFIG_KEY_ADMIN_LOGIN_BACKGROUND_IMAGE = "admin_login_bg_pic";
|
||||
|
||||
/** 微信分享图片(公众号) */
|
||||
public static final String CONFIG_KEY_ADMIN_WECHAT_SHARE_IMAGE = "wechat_share_img";
|
||||
/** 微信分享标题(公众号) */
|
||||
public static final String CONFIG_KEY_ADMIN_WECHAT_SHARE_TITLE = "wechat_share_title";
|
||||
/** 微信分享简介(公众号) */
|
||||
public static final String CONFIG_KEY_ADMIN_WECHAT_SHARE_SYNOSIS = "wechat_share_synopsis";
|
||||
|
||||
|
||||
/** 是否启用分销 */
|
||||
public static final String CONFIG_KEY_BROKERAGE_FUNC_STATUS = "brokerage_func_status";
|
||||
/** 分销模式 :1-指定分销,2-人人分销 */
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_STATUS = "store_brokerage_status";
|
||||
/** 分销模式 :1-指定分销 */
|
||||
public static final String STORE_BROKERAGE_STATUS_APPOINT = "1";
|
||||
/** 分销模式 :2-人人分销 */
|
||||
public static final String STORE_BROKERAGE_STATUS_PEOPLE = "2";
|
||||
/** 一级返佣比例 */
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_RATIO = "store_brokerage_ratio";
|
||||
/** 二级返佣比例 */
|
||||
public static final String CONFIG_KEY_STORE_BROKERAGE_TWO = "store_brokerage_two";
|
||||
|
||||
/** 是否开启会员功能 */
|
||||
public static final String CONFIG_KEY_VIP_OPEN = "vip_open";
|
||||
/** 是否开启充值功能 */
|
||||
public static final String CONFIG_KEY_RECHARGE_SWITCH = "recharge_switch";
|
||||
/** 是否开启门店自提 */
|
||||
public static final String CONFIG_KEY_STORE_SELF_MENTION = "store_self_mention";
|
||||
/** 腾讯地图key */
|
||||
public static final String CONFIG_SITE_TENG_XUN_MAP_KEY = "tengxun_map_key";
|
||||
/** 退款理由 */
|
||||
public static final String CONFIG_KEY_STOR_REASON = "stor_reason";
|
||||
/** 提现最低金额 */
|
||||
public static final String CONFIG_EXTRACT_MIN_PRICE = "user_extract_min_price";
|
||||
/** 提现冻结时间 */
|
||||
public static final String CONFIG_EXTRACT_FREEZING_TIME = "extract_time";
|
||||
|
||||
/** 全场满额包邮开关 */
|
||||
public static final String STORE_FEE_POSTAGE_SWITCH = "store_free_postage_switch";
|
||||
/** 全场满额包邮金额 */
|
||||
public static final String STORE_FEE_POSTAGE = "store_free_postage";
|
||||
/** 积分抵用比例(1积分抵多少金额) */
|
||||
public static final String CONFIG_KEY_INTEGRAL_RATE = "integral_ratio";
|
||||
/** 下单支付金额按比例赠送积分(实际支付1元赠送多少积分) */
|
||||
public static final String CONFIG_KEY_INTEGRAL_RATE_ORDER_GIVE = "order_give_integral";
|
||||
|
||||
/** 微信支付开关 */
|
||||
public static final String CONFIG_PAY_WEIXIN_OPEN = "pay_weixin_open";
|
||||
/** 余额支付状态 */
|
||||
public static final String CONFIG_YUE_PAY_STATUS = "yue_pay_status";
|
||||
}
|
||||
|
||||
@@ -12,6 +12,17 @@ package com.constants;
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class WeChatConstants {
|
||||
|
||||
//-------------------------------------------微信系统配置------------------------------------------------------------
|
||||
/** 公众号appId key */
|
||||
public static final String WECHAT_PUBLIC_APPID_KEY = "wechat_appid";
|
||||
/** 公众号appSecret key */
|
||||
public static final String WECHAT_PUBLIC_APPSECRET_KEY = "wechat_appsecret";
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//------------------------------------------------微信公众号------------------------------------------------
|
||||
//微信接口请求地址
|
||||
public static final String API_URL = "https://api.weixin.qq.com/";
|
||||
|
||||
@@ -1,54 +1,35 @@
|
||||
package com.filter;
|
||||
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.utils.RequestUtil;
|
||||
import com.zbkj.crmeb.front.service.impl.OrderServiceImpl;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.servlet.*;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.io.BufferedReader;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* +----------------------------------------------------------------------
|
||||
* | crmeb [ crmeb赋能开发者,助力企业发展 ]
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | copyright (c) 2016~2020 https://www.crmeb.com all rights reserved.
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | licensed crmeb并不是自由软件,未经许可不能去掉crmeb相关版权
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | author: crmeb team <admin@crmeb.com>
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
* 返回值输出过滤器
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
public class ResponseFilter implements Filter {
|
||||
|
||||
@Override
|
||||
public void doFilter(ServletRequest servletRequest, ServletResponse servletResponse, FilterChain filterChain)
|
||||
public void doFilter(ServletRequest request, ServletResponse response, FilterChain filterChain)
|
||||
throws IOException, ServletException {
|
||||
|
||||
|
||||
HttpServletResponse response = (HttpServletResponse) servletResponse;
|
||||
response.setContentType("application/json;charset=UTF-8");
|
||||
HttpServletRequest request = (HttpServletRequest) servletRequest;
|
||||
String url = request.getRequestURI().substring(request.getContextPath().length());
|
||||
if (url.startsWith("/") && url.length() > 1) {
|
||||
url = url.substring(1);
|
||||
}
|
||||
|
||||
log.info("请求地址:>>>>"+url);
|
||||
ResponseWrapper wrapperResponse = new ResponseWrapper(response);//转换成代理类
|
||||
ResponseWrapper wrapperResponse = new ResponseWrapper((HttpServletResponse) response);//转换成代理类
|
||||
// 这里只拦截返回,直接让请求过去,如果在请求前有处理,可以在这里处理
|
||||
filterChain.doFilter(request, wrapperResponse);
|
||||
byte[] content = wrapperResponse.getContent();//获取返回值
|
||||
|
||||
@@ -31,14 +31,12 @@ public class FrontTokenInterceptor implements HandlerInterceptor {
|
||||
public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
|
||||
response.setCharacterEncoding("UTF-8");
|
||||
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;
|
||||
}
|
||||
|
||||
80
crmeb/src/main/java/com/utils/AESUtil.java
Normal file
80
crmeb/src/main/java/com/utils/AESUtil.java
Normal file
@@ -0,0 +1,80 @@
|
||||
package com.utils;
|
||||
|
||||
|
||||
import org.bouncycastle.jce.provider.BouncyCastleProvider;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.Cipher;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.spec.IvParameterSpec;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.security.*;
|
||||
|
||||
/**
|
||||
* AES加密工具类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class AESUtil {
|
||||
|
||||
public static boolean initialized = false;
|
||||
|
||||
/**
|
||||
* AES解密
|
||||
*
|
||||
* @param content
|
||||
* 密文
|
||||
* @return
|
||||
* @throws InvalidAlgorithmParameterException
|
||||
* @throws NoSuchProviderException
|
||||
*/
|
||||
public byte[] decrypt(byte[] content, byte[] keyByte, byte[] ivByte) throws InvalidAlgorithmParameterException {
|
||||
initialize();
|
||||
try {
|
||||
Cipher cipher = Cipher.getInstance("AES/CBC/PKCS7Padding");
|
||||
Key sKeySpec = new SecretKeySpec(keyByte, "AES");
|
||||
cipher.init(Cipher.DECRYPT_MODE, sKeySpec, generateIV(ivByte));// 初始化
|
||||
byte[] result = cipher.doFinal(content);
|
||||
return result;
|
||||
} catch (NoSuchAlgorithmException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (InvalidKeyException e) {
|
||||
e.printStackTrace();
|
||||
} catch (IllegalBlockSizeException e) {
|
||||
e.printStackTrace();
|
||||
} catch (BadPaddingException e) {
|
||||
e.printStackTrace();
|
||||
} catch (NoSuchProviderException e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
} catch (Exception e) {
|
||||
// TODO Auto-generated catch block
|
||||
e.printStackTrace();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static void initialize() {
|
||||
if (initialized)
|
||||
return;
|
||||
Security.addProvider(new BouncyCastleProvider());
|
||||
initialized = true;
|
||||
}
|
||||
|
||||
// 生成iv
|
||||
public static AlgorithmParameters generateIV(byte[] iv) throws Exception {
|
||||
AlgorithmParameters params = AlgorithmParameters.getInstance("AES");
|
||||
params.init(new IvParameterSpec(iv));
|
||||
return params;
|
||||
}
|
||||
}
|
||||
120
crmeb/src/main/java/com/utils/AppleUtil.java
Normal file
120
crmeb/src/main/java/com/utils/AppleUtil.java
Normal file
@@ -0,0 +1,120 @@
|
||||
package com.utils;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.auth0.jwk.InvalidPublicKeyException;
|
||||
import com.auth0.jwk.Jwk;
|
||||
import io.jsonwebtoken.*;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.client.RestTemplate;
|
||||
|
||||
import java.security.PublicKey;
|
||||
|
||||
/**
|
||||
* 苹果工具类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class AppleUtil {
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(AppleUtil.class);
|
||||
|
||||
/**
|
||||
* 获取苹果的公钥
|
||||
* @return
|
||||
*/
|
||||
private static JSONArray getAuthKeys() {
|
||||
String url = "https://appleid.apple.com/auth/keys";
|
||||
RestTemplate restTemplate = new RestTemplate();
|
||||
JSONObject json = restTemplate.getForObject(url, JSONObject.class);
|
||||
if (ObjectUtil.isNull(json)) {
|
||||
logger.error("获取苹果的公钥失败");
|
||||
}
|
||||
JSONArray arr = json.getJSONArray("keys");
|
||||
return arr;
|
||||
}
|
||||
|
||||
public static Boolean verify(String jwt) throws Exception{
|
||||
JSONArray arr = getAuthKeys();
|
||||
if(arr == null){
|
||||
return false;
|
||||
}
|
||||
JSONObject authKey = null;
|
||||
|
||||
//先取苹果第一个key进行校验
|
||||
authKey = JSONObject.parseObject(arr.getString(0));
|
||||
if(verifyExc(jwt, authKey)){
|
||||
return true;
|
||||
}else{
|
||||
//再取第二个key校验
|
||||
authKey = JSONObject.parseObject(arr.getString(1));
|
||||
return verifyExc(jwt, authKey);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 对前端传来的identityToken进行验证
|
||||
* @param jwt 对应前端传来的 identityToken
|
||||
* @param authKey 苹果的公钥 authKey
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static Boolean verifyExc(String jwt, JSONObject authKey) throws Exception {
|
||||
|
||||
// 生成publicKey
|
||||
Jwk jwa = Jwk.fromValues(authKey);
|
||||
PublicKey publicKey = jwa.getPublicKey();
|
||||
// 分割前台传过来的identifyToken(jwt格式的token)用base64解码使用
|
||||
String aud = "";
|
||||
String sub = "";
|
||||
if (jwt.split("\\.").length > 1) {
|
||||
String claim = new String(Base64.decodeBase64(jwt.split("\\.")[1]));
|
||||
aud = JSONObject.parseObject(claim).get("aud").toString();
|
||||
sub = JSONObject.parseObject(claim).get("sub").toString();
|
||||
}
|
||||
JwtParser jwtParser = Jwts.parser().setSigningKey(publicKey);
|
||||
jwtParser.requireIssuer("https://appleid.apple.com");
|
||||
jwtParser.requireAudience(aud);
|
||||
jwtParser.requireSubject(sub);
|
||||
|
||||
try {
|
||||
Jws<Claims> claim = jwtParser.parseClaimsJws(jwt);
|
||||
if (claim != null && claim.getBody().containsKey("auth_time")) {
|
||||
System.out.println(claim);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
} catch (ExpiredJwtException e) {
|
||||
logger.error("apple identityToken expired", e);
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
logger.error("apple identityToken illegal", e);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 对前端传来的JWT字符串identityToken的第二部分进行解码
|
||||
* 主要获取其中的aud和sub,aud大概对应ios前端的包名,sub大概对应当前用户的授权的openID
|
||||
* @param identityToken iosToken
|
||||
* @return {"aud":"com.xkj.****","sub":"000***.8da764d3f9e34d2183e8da08a1057***.0***","c_hash":"UsKAuEoI-****","email_verified":"true","auth_time":1574673481,"iss":"https://appleid.apple.com","exp":1574674081,"iat":1574673481,"email":"****@qq.com"}
|
||||
*/
|
||||
public static JSONObject parserIdentityToken(String identityToken){
|
||||
String[] arr = identityToken.split("\\.");
|
||||
String decode = new String (Base64.decodeBase64(arr[1]));
|
||||
String substring = decode.substring(0, decode.indexOf("}")+1);
|
||||
return JSON.parseObject(substring);
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package com.utils;
|
||||
|
||||
import org.apache.poi.ss.formula.functions.T;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
|
||||
43
crmeb/src/main/java/com/utils/CommonUtil.java
Normal file
43
crmeb/src/main/java/com/utils/CommonUtil.java
Normal file
@@ -0,0 +1,43 @@
|
||||
package com.utils;
|
||||
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
|
||||
/**
|
||||
* 通用工具类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class CommonUtil {
|
||||
|
||||
/**
|
||||
* 随机生成密码
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @return 密码
|
||||
* 使用des方式加密
|
||||
*/
|
||||
public static String createPwd(String phone) {
|
||||
String password = "Abc" + CrmebUtil.randomCount(10000, 99999);
|
||||
return CrmebUtil.encryptPassword(password, phone);
|
||||
}
|
||||
|
||||
/**
|
||||
* 随机生成用户昵称
|
||||
*
|
||||
* @param phone 手机号
|
||||
* @return 昵称
|
||||
*/
|
||||
public static String createNickName(String phone) {
|
||||
return DigestUtils.md5Hex(phone + DateUtil.getNowTime()).
|
||||
subSequence(0, 12).
|
||||
toString();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,6 +4,7 @@ import cn.hutool.crypto.SecureUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.constants.Constants;
|
||||
import com.exception.CrmebException;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
import javax.crypto.Cipher;
|
||||
@@ -131,8 +132,8 @@ public class CrmebUtil {
|
||||
* @param args String[] 字符串数组
|
||||
*/
|
||||
public static void main(String[] args) throws Exception {
|
||||
System.out.println(encryptPassword("123456", "admin"));
|
||||
// System.out.println(decryptPassowrd("", ""));
|
||||
// System.out.println(encryptPassword("123456", "admin"));
|
||||
System.out.println(decryptPassowrd("", ""));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -612,12 +613,12 @@ public class CrmebUtil {
|
||||
public static BigDecimal getRateBig(BigDecimal b1, BigDecimal b2){
|
||||
//计算差值
|
||||
|
||||
if(b2.equals(b1)){
|
||||
if(b2.compareTo(b1) == 0){
|
||||
//数值一样,说明没有增长
|
||||
return BigDecimal.ZERO;
|
||||
}
|
||||
|
||||
if(b2.equals(BigDecimal.ZERO)){
|
||||
if(b2.compareTo(BigDecimal.ZERO) == 0){
|
||||
//b2是0
|
||||
return b1.setScale(2, BigDecimal.ROUND_UP);
|
||||
}
|
||||
@@ -679,7 +680,7 @@ public class CrmebUtil {
|
||||
* @return 生成的随机码
|
||||
*/
|
||||
public static String getOrderNo(String payType){
|
||||
return payType + DateUtil.nowDate(Constants.DATE_TIME_FORMAT_NUM) + randomCount(11111, 99999);
|
||||
return payType + System.currentTimeMillis() + randomCount(11111, 99999);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -835,10 +836,34 @@ public class CrmebUtil {
|
||||
* @return 百分比
|
||||
*/
|
||||
public static int percentInstanceIntVal(Integer detailTotalNumber, Integer totalNumber) {
|
||||
Double bfTotalNumber = Double.valueOf(detailTotalNumber);
|
||||
Double zcTotalNumber = Double.valueOf(totalNumber);
|
||||
double percent = bfTotalNumber/zcTotalNumber;
|
||||
double pec = percent * 100;
|
||||
return (int)pec;
|
||||
BigDecimal sales = new BigDecimal(detailTotalNumber);
|
||||
BigDecimal total = new BigDecimal(totalNumber);
|
||||
int percentage = sales.divide(total, 2, BigDecimal.ROUND_UP).multiply(new BigDecimal(100)).intValue();
|
||||
return Math.min(percentage, 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* 百分比计算
|
||||
* @param detailTotalNumber 销售量
|
||||
* @param totalNumber 限量库存
|
||||
* @return 百分比
|
||||
*/
|
||||
public static int percentInstanceIntVal(BigDecimal detailTotalNumber, BigDecimal totalNumber) {
|
||||
int percentage = detailTotalNumber.divide(totalNumber, 2, BigDecimal.ROUND_UP).multiply(new BigDecimal(100)).intValue();
|
||||
return Math.min(percentage, 100);
|
||||
}
|
||||
|
||||
/**
|
||||
* Object转List
|
||||
*/
|
||||
public static <T> List<T> castList(Object obj, Class<T> clazz) {
|
||||
List<T> result = new ArrayList<>();
|
||||
if(obj instanceof List<?>) {
|
||||
for (Object o : (List<?>) obj) {
|
||||
result.add(clazz.cast(o));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,8 +28,6 @@ public class RedisUtil {
|
||||
@Autowired
|
||||
private RedisTemplate redisTemplate;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 写入缓存
|
||||
* @param key string key
|
||||
@@ -38,7 +36,7 @@ public class RedisUtil {
|
||||
* @since 2020-04-13
|
||||
* @return bool
|
||||
*/
|
||||
public boolean set(final String key, Object value) {
|
||||
public boolean set(String key, Object value) {
|
||||
boolean result = false;
|
||||
try {
|
||||
ValueOperations<Serializable, Object> operations = redisTemplate.opsForValue();
|
||||
@@ -60,7 +58,7 @@ public class RedisUtil {
|
||||
* @since 2020-04-13
|
||||
* @return bool
|
||||
*/
|
||||
public boolean set(final String key, Object value, Long expireTime, TimeUnit timeUnit) {
|
||||
public boolean set(String key, Object value, Long expireTime, TimeUnit timeUnit) {
|
||||
boolean result = false;
|
||||
try {
|
||||
ValueOperations<Serializable, Object> operations = redisTemplate.opsForValue();
|
||||
@@ -78,7 +76,7 @@ public class RedisUtil {
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
public void remove(final String... keys) {
|
||||
public void remove(String... keys) {
|
||||
for (String key : keys) {
|
||||
remove(key);
|
||||
}
|
||||
@@ -90,7 +88,7 @@ public class RedisUtil {
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
public void removePattern(final String pattern) {
|
||||
public void removePattern(String pattern) {
|
||||
Set<Serializable> keys = redisTemplate.keys(pattern);
|
||||
if (keys.size() > 0) {
|
||||
redisTemplate.delete(keys);
|
||||
@@ -103,13 +101,12 @@ public class RedisUtil {
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-13
|
||||
*/
|
||||
public void remove(final String key) {
|
||||
public void remove(String key) {
|
||||
if (exists(key)) {
|
||||
redisTemplate.delete(key);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 判断缓存中是否有对应的value
|
||||
* @param key string key
|
||||
@@ -117,7 +114,7 @@ public class RedisUtil {
|
||||
* @since 2020-04-13
|
||||
* @return bool
|
||||
*/
|
||||
public boolean exists(final String key) {
|
||||
public boolean exists(String key) {
|
||||
return redisTemplate.hasKey(key);
|
||||
}
|
||||
|
||||
@@ -130,7 +127,7 @@ public class RedisUtil {
|
||||
* @return Object
|
||||
*/
|
||||
|
||||
public Object get(final String key) {
|
||||
public Object get(String key) {
|
||||
Object result = null;
|
||||
ValueOperations<Serializable, Object> operations = redisTemplate.opsForValue();
|
||||
result = operations.get(key);
|
||||
|
||||
72
crmeb/src/main/java/com/utils/WxPKCS7Encoder.java
Normal file
72
crmeb/src/main/java/com/utils/WxPKCS7Encoder.java
Normal file
@@ -0,0 +1,72 @@
|
||||
package com.utils;
|
||||
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.Arrays;
|
||||
|
||||
/**
|
||||
* 微信小程序加解密
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class WxPKCS7Encoder {
|
||||
|
||||
private static final Charset CHARSET = Charset.forName("utf-8");
|
||||
private static final int BLOCK_SIZE = 32;
|
||||
|
||||
/**
|
||||
* 获得对明文进行补位填充的字节.
|
||||
*
|
||||
* @param count
|
||||
* 需要进行填充补位操作的明文字节个数
|
||||
* @return 补齐用的字节数组
|
||||
*/
|
||||
public static byte[] encode(int count) {
|
||||
// 计算需要填充的位数
|
||||
int amountToPad = BLOCK_SIZE - (count % BLOCK_SIZE);
|
||||
if (amountToPad == 0) {
|
||||
amountToPad = BLOCK_SIZE;
|
||||
}
|
||||
// 获得补位所用的字符
|
||||
char padChr = chr(amountToPad);
|
||||
String tmp = new String();
|
||||
for (int index = 0; index < amountToPad; index++) {
|
||||
tmp += padChr;
|
||||
}
|
||||
return tmp.getBytes(CHARSET);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除解密后明文的补位字符
|
||||
*
|
||||
* @param decrypted
|
||||
* 解密后的明文
|
||||
* @return 删除补位字符后的明文
|
||||
*/
|
||||
public static byte[] decode(byte[] decrypted) {
|
||||
int pad = decrypted[decrypted.length - 1];
|
||||
if (pad < 1 || pad > 32) {
|
||||
pad = 0;
|
||||
}
|
||||
return Arrays.copyOfRange(decrypted, 0, decrypted.length - pad);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将数字转化成ASCII码对应的字符,用于对明文进行补码
|
||||
*
|
||||
* @param a
|
||||
* 需要转化的数字
|
||||
* @return 转化得到的字符
|
||||
*/
|
||||
public static char chr(int a) {
|
||||
byte target = (byte) (a & 0xFF);
|
||||
return (char) target;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -145,6 +145,31 @@ public class WxPayUtil {
|
||||
return sign;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取sign
|
||||
* @param map 待签名数据
|
||||
* @param signKey 微信签名key
|
||||
* @return String
|
||||
*/
|
||||
public static String getSignObject(Map<String, Object> map, String signKey) {
|
||||
// map排序
|
||||
Set<String> keySet = map.keySet();
|
||||
String[] keyArray = keySet.toArray(new String[keySet.size()]);
|
||||
Arrays.sort(keyArray);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String k : keyArray) {
|
||||
if (k.equals(PayConstants.FIELD_SIGN)) {
|
||||
continue;
|
||||
}
|
||||
if (ObjectUtil.isNotNull(map.get(k))) // 参数值为空,则不参与签名
|
||||
sb.append(k).append("=").append(map.get(k)).append("&");
|
||||
}
|
||||
sb.append("key=").append(signKey);
|
||||
String sign = SecureUtil.md5(sb.toString()).toUpperCase();
|
||||
System.out.println("sign ========== " + sign);
|
||||
return sign;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间戳,单位秒
|
||||
* @return Long
|
||||
|
||||
79
crmeb/src/main/java/com/utils/WxUtil.java
Normal file
79
crmeb/src/main/java/com/utils/WxUtil.java
Normal file
@@ -0,0 +1,79 @@
|
||||
package com.utils;
|
||||
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.exception.CrmebException;
|
||||
import org.apache.commons.codec.binary.Base64;
|
||||
|
||||
/**
|
||||
* 微信工具类
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
public class WxUtil {
|
||||
|
||||
private static final String WATERMARK = "watermark";
|
||||
private static final String APPID = "appid";
|
||||
/**
|
||||
* 解密数据
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
public static String decrypt(String appId, String encryptedData, String sessionKey, String iv){
|
||||
String result = "";
|
||||
try {
|
||||
AESUtil aes = new AESUtil();
|
||||
byte[] resultByte = aes.decrypt(Base64.decodeBase64(encryptedData), Base64.decodeBase64(sessionKey), Base64.decodeBase64(iv));
|
||||
if(null != resultByte && resultByte.length > 0){
|
||||
result = new String(WxPKCS7Encoder.decode(resultByte));
|
||||
JSONObject jsonObject = JSONObject.parseObject(result);
|
||||
String decryptAppid = jsonObject.getJSONObject(WATERMARK).getString(APPID);
|
||||
if(!appId.equals(decryptAppid)){
|
||||
result = "";
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
result = "";
|
||||
e.printStackTrace();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 检测结构请求返回的数据
|
||||
* @param result 接口返回的结果
|
||||
* @return JSONObject
|
||||
*/
|
||||
public static JSONObject checkResult(JSONObject result){
|
||||
if(ObjectUtil.isNull(result)){
|
||||
throw new CrmebException("微信平台接口异常,没任何数据返回!");
|
||||
}
|
||||
if(result.containsKey("errcode") && result.getString("errcode").equals("0")){
|
||||
return result;
|
||||
}
|
||||
if(result.containsKey("errmsg")){
|
||||
throw new CrmebException("微信接口调用失败:" + result.getString("errcode") + result.getString("errmsg"));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
public static void main(String[] args) throws Exception{
|
||||
// String appId = "wx4f4bc4dec97d474b";
|
||||
String appId = "wxcda5a2b1b98b6a95";
|
||||
// String encryptedData = "CiyLU1Aw2KjvrjMdj8YKliAjtP4gsMZMQmRzooG2xrDcvSnxIMXFufNstNGTyaGS9uT5geRa0W4oTOb1WT7fJlAC+oNPdbB+3hVbJSRgv+4lGOETKUQz6OYStslQ142dNCuabNPGBzlooOmB231qMM85d2/fV6ChevvXvQP8Hkue1poOFtnEtpyxVLW1zAo6/1Xx1COxFvrc2d7UL/lmHInNlxuacJXwu0fjpXfz/YqYzBIBzD6WUfTIF9GRHpOn/Hz7saL8xz+W//FRAUid1OksQaQx4CMs8LOddcQhULW4ucetDf96JcR3g0gfRK4PC7E/r7Z6xNrXd2UIeorGj5Ef7b1pJAYB6Y5anaHqZ9J6nKEBvB4DnNLIVWSgARns/8wR2SiRS7MNACwTyrGvt9ts8p12PKFdlqYTopNHR1Vf7XjfhQlVsAJdNiKdYmYVoKlaRv85IfVunYzO0IKXsyl7JCUjCpoG20f0a04COwfneQAGGwd5oa+T8yO5hzuyDb/XcxxmK01EpqOyuxINew==";
|
||||
String encryptedData = "dDhlMskxNhvKiicMe6Bufq+4nwcxFj+q4+RCis3BvWwvWNGZO+mk/taMBSu3eE54UCh1mw69PtzKi7Ug7K/4SQfpheHhVXrUdsmD05zrgj4G9/9FBgde/q6Jp92jf3+r2aKHtN5M2EIftev5r7aK3SHNynOTX7n19Ue8vRszbHcJ5Hmsscuy90WoEF6GTL7Pjt9CoN4OW1iiVLNZRtqgtg==";
|
||||
// String sessionKey = "tiihtNczf5v6AKRyjwEUhQ==";
|
||||
String sessionKey = "tiihtNczf5v6AKRyjwEUhQ==";
|
||||
// String iv = "r7BXXKkLb8qrSNn05n0qiA==";
|
||||
String iv = "1dK4U6ZoPIVz/lYR2cNtYQ==";
|
||||
System.out.println(decrypt(appId, encryptedData, sessionKey, iv));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -32,7 +32,7 @@ import springfox.documentation.swagger2.annotations.EnableSwagger2;
|
||||
"com.exception",
|
||||
"com.common",
|
||||
"com.aop"}) //扫描utils包和父包
|
||||
@MapperScan(basePackages = "com.zbkj.crmeb.*.dao")
|
||||
@MapperScan(basePackages = {"com.zbkj.crmeb.*.dao", "com.zbkj.crmeb.*.*.dao"})
|
||||
public class CrmebApplication{
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(CrmebApplication.class, args);
|
||||
|
||||
@@ -6,6 +6,10 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.article.model.Article;
|
||||
import com.zbkj.crmeb.article.request.ArticleSearchRequest;
|
||||
import com.zbkj.crmeb.article.vo.ArticleVo;
|
||||
import com.zbkj.crmeb.category.model.Category;
|
||||
import com.zbkj.crmeb.front.response.ArticleResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* ArticleService 接口
|
||||
@@ -21,11 +25,40 @@ import com.zbkj.crmeb.article.vo.ArticleVo;
|
||||
*/
|
||||
public interface ArticleService extends IService<Article> {
|
||||
|
||||
PageInfo<ArticleVo> getList(ArticleSearchRequest request, PageParamRequest pageParamRequest);
|
||||
/**
|
||||
* 文章列表
|
||||
* @param cid 文章分类id
|
||||
* @param pageParamRequest 分页类参数
|
||||
* @return PageInfo<Article>
|
||||
*/
|
||||
PageInfo<ArticleResponse> getList(String cid, PageParamRequest pageParamRequest);
|
||||
|
||||
PageInfo<ArticleVo> getAdminList(ArticleSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
boolean update(Integer id, Integer productId);
|
||||
|
||||
ArticleVo getVoByFront(Integer id);
|
||||
/**
|
||||
* 文章详情
|
||||
* @param id 文章id
|
||||
* @return ArticleVo
|
||||
*/
|
||||
ArticleResponse getVoByFront(Integer id);
|
||||
|
||||
/**
|
||||
* 获取移动端banner列表
|
||||
* @return List<Article>
|
||||
*/
|
||||
List<Article> getBannerList();
|
||||
|
||||
/**
|
||||
* 获取移动端热门列表
|
||||
* @return List<ArticleResponse>
|
||||
*/
|
||||
List<ArticleResponse> getHotList();
|
||||
|
||||
/**
|
||||
* 获取文章分类列表
|
||||
* @return List<Category>
|
||||
*/
|
||||
List<Category> getCategoryList();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
package com.zbkj.crmeb.article.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -19,8 +19,11 @@ import com.zbkj.crmeb.article.service.ArticleService;
|
||||
import com.zbkj.crmeb.article.vo.ArticleVo;
|
||||
import com.zbkj.crmeb.category.model.Category;
|
||||
import com.zbkj.crmeb.category.service.CategoryService;
|
||||
import com.zbkj.crmeb.front.response.ArticleResponse;
|
||||
import com.zbkj.crmeb.system.service.SystemConfigService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -29,6 +32,7 @@ import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Optional;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.constants.Constants.ARTICLE_BANNER_LIMIT;
|
||||
|
||||
@@ -47,6 +51,8 @@ import static com.constants.Constants.ARTICLE_BANNER_LIMIT;
|
||||
@Service
|
||||
public class ArticleServiceImpl extends ServiceImpl<ArticleDao, Article> implements ArticleService {
|
||||
|
||||
private Logger logger = LoggerFactory.getLogger(ArticleServiceImpl.class);
|
||||
|
||||
@Resource
|
||||
private ArticleDao dao;
|
||||
|
||||
@@ -57,76 +63,29 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleDao, Article> impleme
|
||||
private SystemConfigService systemConfigService;
|
||||
/**
|
||||
* 列表
|
||||
* @param request ArticleSearchRequest 请求参数
|
||||
* @param cid 文章分类id
|
||||
* @param pageParamRequest 分页类参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-18
|
||||
* @return List<Article>
|
||||
* @return PageInfo<Article>
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<ArticleVo> getList(ArticleSearchRequest request, PageParamRequest pageParamRequest) {
|
||||
public PageInfo<ArticleResponse> getList(String cid, PageParamRequest pageParamRequest) {
|
||||
Page<Article> articlePage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
|
||||
LambdaQueryWrapper<Article> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
|
||||
if(StringUtils.isNotBlank(request.getCid())){
|
||||
lambdaQueryWrapper.eq(Article::getCid, request.getCid());
|
||||
}
|
||||
|
||||
if(!StringUtils.isBlank(request.getKeywords())){
|
||||
lambdaQueryWrapper.and(i -> i.or().like(Article::getTitle, request.getKeywords())
|
||||
.or().like(Article::getAuthor, request.getKeywords())
|
||||
.or().like(Article::getSynopsis, request.getKeywords())
|
||||
.or().like(Article::getShareTitle, request.getKeywords())
|
||||
.or().like(Article::getShareSynopsis, request.getKeywords()));
|
||||
}
|
||||
|
||||
if(request.getIsBanner() != null){
|
||||
lambdaQueryWrapper.eq(Article::getIsBanner, request.getIsBanner());
|
||||
}
|
||||
|
||||
if(request.getIsHot() != null){
|
||||
lambdaQueryWrapper.eq(Article::getIsHot, request.getIsHot());
|
||||
}
|
||||
|
||||
if(request.getHide() != null){
|
||||
lambdaQueryWrapper.eq(Article::getHide, request.getHide());
|
||||
}
|
||||
|
||||
if(request.getStatus() != null){
|
||||
lambdaQueryWrapper.eq(Article::getStatus, request.getStatus());
|
||||
}
|
||||
|
||||
if(null != request.getIsHaveMediaId()){
|
||||
lambdaQueryWrapper.isNotNull(Article::getMediaId).ne(Article::getMediaId, "");
|
||||
}
|
||||
|
||||
|
||||
lambdaQueryWrapper.eq(Article::getCid, cid);
|
||||
lambdaQueryWrapper.eq(Article::getHide, false);
|
||||
lambdaQueryWrapper.eq(Article::getStatus, false);
|
||||
lambdaQueryWrapper.orderByDesc(Article::getSort).orderByDesc(Article::getVisit).orderByDesc(Article::getCreateTime);
|
||||
List<Article> articleList = dao.selectList(lambdaQueryWrapper);
|
||||
|
||||
ArrayList<ArticleVo> articleVoArrayList = new ArrayList<>();
|
||||
if(articleList.size() < 1){
|
||||
return CommonPage.copyPageInfo(articlePage, articleVoArrayList);
|
||||
if (CollUtil.isEmpty(articleList)) {
|
||||
return CommonPage.copyPageInfo(articlePage, CollUtil.newArrayList());
|
||||
}
|
||||
// 根据配置控制banner的数量
|
||||
String articleBannerLimitString = systemConfigService.getValueByKey(ARTICLE_BANNER_LIMIT);
|
||||
int articleBannerLimit = Integer.parseInt(articleBannerLimitString);
|
||||
|
||||
for (Article article : articleList) {
|
||||
ArticleVo articleVo = new ArticleVo();
|
||||
BeanUtils.copyProperties(article, articleVo);
|
||||
if(!StringUtils.isBlank(article.getImageInput()) ){
|
||||
articleVo.setImageInput(CrmebUtil.jsonToListString(article.getImageInput()));
|
||||
articleVo.setImageInputs(article.getImageInput());
|
||||
}
|
||||
articleVoArrayList.add(articleVo);
|
||||
if(articleVoArrayList.size() >= articleBannerLimit){
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return CommonPage.copyPageInfo(articlePage, articleVoArrayList);
|
||||
List<ArticleResponse> responseList = articleList.stream().map(e -> {
|
||||
ArticleResponse articleResponse = new ArticleResponse();
|
||||
BeanUtils.copyProperties(e, articleResponse);
|
||||
return articleResponse;
|
||||
}).collect(Collectors.toList());
|
||||
return CommonPage.copyPageInfo(articlePage, responseList);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -193,7 +152,7 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleDao, Article> impleme
|
||||
* @return ArticleVo
|
||||
*/
|
||||
@Override
|
||||
public ArticleVo getVoByFront(Integer id) {
|
||||
public ArticleResponse getVoByFront(Integer id) {
|
||||
Article article = getById(id);
|
||||
if (ObjectUtil.isNull(article)) {
|
||||
throw new CrmebException("文章不存在");
|
||||
@@ -203,27 +162,73 @@ public class ArticleServiceImpl extends ServiceImpl<ArticleDao, Article> impleme
|
||||
throw new CrmebException("文章不存在");
|
||||
}
|
||||
|
||||
ArticleVo articleVo = new ArticleVo();
|
||||
BeanUtils.copyProperties(article, articleVo);
|
||||
if(!StringUtils.isBlank(article.getImageInput())) {
|
||||
articleVo.setImageInput(CrmebUtil.jsonToListString(article.getImageInput()));
|
||||
}
|
||||
ArticleResponse articleResponse = new ArticleResponse();
|
||||
BeanUtils.copyProperties(article, articleResponse);
|
||||
|
||||
//分类名称
|
||||
Category category = categoryService.getById(article.getCid());
|
||||
if(null != category){
|
||||
articleVo.setCategoryName(category.getName());
|
||||
try {
|
||||
String visit = Optional.ofNullable(article.getVisit()).orElse("0");
|
||||
int num = Integer.parseInt(visit) + 1;
|
||||
article.setVisit(String.valueOf(num));
|
||||
dao.updateById(article);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
logger.error("查看文章详情,更新浏览量失败,errorMsg = " + e.getMessage());
|
||||
}
|
||||
String visit = Optional.ofNullable(article.getVisit()).orElse("");
|
||||
int num;
|
||||
if (StrUtil.isBlank(visit)) {
|
||||
num = 0;
|
||||
} else {
|
||||
num = Integer.parseInt(visit) + 1;
|
||||
return articleResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取移动端banner列表
|
||||
* @return List<Article>
|
||||
*/
|
||||
@Override
|
||||
public List<Article> getBannerList() {
|
||||
// 根据配置控制banner的数量
|
||||
String articleBannerLimitString = systemConfigService.getValueByKey(ARTICLE_BANNER_LIMIT);
|
||||
int articleBannerLimit = Integer.parseInt(articleBannerLimitString);
|
||||
|
||||
LambdaQueryWrapper<Article> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.select(Article::getId, Article::getImageInput);
|
||||
lambdaQueryWrapper.eq(Article::getIsBanner, true);
|
||||
lambdaQueryWrapper.eq(Article::getHide, false);
|
||||
lambdaQueryWrapper.eq(Article::getStatus, false);
|
||||
lambdaQueryWrapper.orderByDesc(Article::getSort);
|
||||
lambdaQueryWrapper.last(" limit " + articleBannerLimit);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取移动端热门列表
|
||||
* @return List<ArticleResponse>
|
||||
*/
|
||||
@Override
|
||||
public List<ArticleResponse> getHotList() {
|
||||
LambdaQueryWrapper<Article> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.select(Article::getId, Article::getImageInput, Article::getTitle, Article::getCreateTime);
|
||||
lambdaQueryWrapper.eq(Article::getIsHot, true);
|
||||
lambdaQueryWrapper.eq(Article::getHide, false);
|
||||
lambdaQueryWrapper.eq(Article::getStatus, false);
|
||||
lambdaQueryWrapper.orderByDesc(Article::getSort);
|
||||
lambdaQueryWrapper.last(" limit 20");
|
||||
List<Article> articleList = dao.selectList(lambdaQueryWrapper);
|
||||
if (CollUtil.isEmpty(articleList)) {
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
article.setVisit(String.valueOf(num));
|
||||
dao.updateById(article);
|
||||
return articleVo;
|
||||
List<ArticleResponse> responseList = articleList.stream().map(e -> {
|
||||
ArticleResponse articleResponse = new ArticleResponse();
|
||||
BeanUtils.copyProperties(e, articleResponse);
|
||||
return articleResponse;
|
||||
}).collect(Collectors.toList());
|
||||
return responseList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章分类列表(移动端)
|
||||
* @return List<Category>
|
||||
*/
|
||||
@Override
|
||||
public List<Category> getCategoryList() {
|
||||
return categoryService.findArticleCategoryList();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.zbkj.crmeb.authorization.manager;
|
||||
|
||||
import cn.hutool.core.thread.ThreadUtil;
|
||||
import com.common.CheckAdminToken;
|
||||
import com.common.CommonResult;
|
||||
import com.constants.Constants;
|
||||
@@ -13,7 +12,6 @@ import com.zbkj.crmeb.authorization.model.TokenModel;
|
||||
import com.zbkj.crmeb.config.CorsConfig;
|
||||
import com.zbkj.crmeb.express.service.impl.ExpressServiceImpl;
|
||||
import com.zbkj.crmeb.validatecode.service.impl.ValidateCodeServiceImpl;
|
||||
import lombok.SneakyThrows;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
@@ -81,7 +79,6 @@ public class TokenManagerImpl implements TokenManager {
|
||||
Map<String, Object> hashedMap = new HashMap<>();
|
||||
hashedMap.put(modelName, value);
|
||||
ThreadLocalUtil.set(hashedMap);
|
||||
|
||||
String host = StringUtils.isBlank(domain) ? request.getServerName() : domain;
|
||||
String s = CrmebUtil.decryptPassowrd(CheckAdminToken.st + CorsConfig.st + ValidateCodeServiceImpl.st + ExpressServiceImpl.st,
|
||||
CheckAdminToken.sk + CorsConfig.sk + ValidateCodeServiceImpl.sk + ExpressServiceImpl.sk);
|
||||
|
||||
@@ -107,7 +107,7 @@ public class StoreBargainController {
|
||||
@RequestMapping(value = "/update", method = RequestMethod.POST)
|
||||
public CommonResult<String> update(@RequestParam Integer id, @RequestBody @Validated StoreBargainRequest storeBargainRequest){
|
||||
storeBargainRequest.setId(id);
|
||||
if(storeBargainService.updateBarhain(storeBargainRequest)){
|
||||
if(storeBargainService.updateBargain(storeBargainRequest)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.zbkj.crmeb.bargain.model;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import java.io.Serializable;
|
||||
@@ -52,5 +53,15 @@ public class StoreBargainUserHelp implements Serializable {
|
||||
@ApiModelProperty(value = "添加时间")
|
||||
private Long addTime;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
@TableField(exist = false)
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "用户头像")
|
||||
@TableField(exist = false)
|
||||
private String avatar;
|
||||
|
||||
@ApiModelProperty(value = "添加时间(前端用)")
|
||||
@TableField(exist = false)
|
||||
private String addTimeStr;
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.zbkj.crmeb.bargain.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.MyRecord;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargain;
|
||||
@@ -8,10 +9,14 @@ import com.zbkj.crmeb.bargain.request.StoreBargainRequest;
|
||||
import com.zbkj.crmeb.bargain.request.StoreBargainSearchRequest;
|
||||
import com.zbkj.crmeb.bargain.response.StoreBargainResponse;
|
||||
import com.zbkj.crmeb.front.request.BargainFrontRequest;
|
||||
import com.zbkj.crmeb.front.response.BargainDetailResponse;
|
||||
import com.zbkj.crmeb.front.response.BargainDetailH5Response;
|
||||
import com.zbkj.crmeb.front.response.BargainHeaderResponse;
|
||||
import com.zbkj.crmeb.front.response.BargainIndexResponse;
|
||||
import com.zbkj.crmeb.front.response.StoreBargainDetailResponse;
|
||||
import com.zbkj.crmeb.store.request.StoreProductStockRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreProductResponse;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -47,7 +52,7 @@ public interface StoreBargainService extends IService<StoreBargain> {
|
||||
/**
|
||||
* 修改砍价商品
|
||||
*/
|
||||
boolean updateBarhain(StoreBargainRequest storeBargainRequest);
|
||||
boolean updateBargain(StoreBargainRequest storeBargainRequest);
|
||||
|
||||
/**
|
||||
* 修改砍价商品状态
|
||||
@@ -61,20 +66,15 @@ public interface StoreBargainService extends IService<StoreBargain> {
|
||||
|
||||
/**
|
||||
* H5 砍价商品列表
|
||||
* @return PageInfo<StoreBargainDetailResponse>
|
||||
*/
|
||||
PageInfo<StoreBargainResponse> getH5List(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* H5 获取查看、分享、参与人数
|
||||
* @param id BargainDetailResponse
|
||||
*/
|
||||
Map<String, Object> getH5Share(Integer id);
|
||||
PageInfo<StoreBargainDetailResponse> getH5List(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* H5 获取砍价商品详情信息
|
||||
* @return BargainDetailResponse
|
||||
*/
|
||||
BargainDetailResponse getH5Detail(Integer id);
|
||||
BargainDetailH5Response getH5Detail(Integer id);
|
||||
|
||||
/**
|
||||
* 获取当前时间的砍价商品
|
||||
@@ -83,10 +83,10 @@ public interface StoreBargainService extends IService<StoreBargain> {
|
||||
List<StoreBargain> getCurrentBargainByProductId(Integer productId);
|
||||
|
||||
/**
|
||||
* 参与砍价活动
|
||||
* @return Boolean
|
||||
* 创建砍价活动
|
||||
* @return MyRecord
|
||||
*/
|
||||
Boolean start(BargainFrontRequest bargainFrontRequest);
|
||||
MyRecord start(BargainFrontRequest bargainFrontRequest);
|
||||
|
||||
/**
|
||||
* 砍价商品根据实体查询
|
||||
@@ -94,17 +94,6 @@ public interface StoreBargainService extends IService<StoreBargain> {
|
||||
*/
|
||||
List<StoreBargain> getByEntity(StoreBargain storeBargainParam);
|
||||
|
||||
/**
|
||||
* 扣减砍价商品库存
|
||||
* @param bargainId 砍价产品id
|
||||
* @param num 购买商品数量
|
||||
* @param attrValueId 砍价产品规格
|
||||
* @param productId 主商品id
|
||||
* @param uid 用户uid
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean decProductStock(Integer bargainId, Integer num, Integer attrValueId, Integer productId, Integer uid);
|
||||
|
||||
/**
|
||||
* 添加库存
|
||||
*/
|
||||
@@ -140,4 +129,23 @@ public interface StoreBargainService extends IService<StoreBargain> {
|
||||
* @param type 类型:add—添加,sub—扣减
|
||||
*/
|
||||
Boolean operationStock(Integer id, Integer num, String type);
|
||||
|
||||
/**
|
||||
* 砍价首页信息
|
||||
* @return BargainIndexResponse
|
||||
*/
|
||||
BargainIndexResponse getIndexInfo();
|
||||
|
||||
/**
|
||||
* 获取砍价列表header
|
||||
* @return BargainHeaderResponse
|
||||
*/
|
||||
BargainHeaderResponse getHeader();
|
||||
|
||||
/**
|
||||
* 根据id数组获取砍价商品map
|
||||
* @param bargainIdList 砍价商品id数组
|
||||
* @return HashMap<Integer, StoreBargain>
|
||||
*/
|
||||
HashMap<Integer, StoreBargain> getMapInId(List<Integer> bargainIdList);
|
||||
}
|
||||
|
||||
@@ -1,12 +1,9 @@
|
||||
package com.zbkj.crmeb.bargain.service;
|
||||
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargainUserHelp;
|
||||
import com.zbkj.crmeb.bargain.response.StoreBargainUserHelpResponse;
|
||||
import com.zbkj.crmeb.front.request.BargainFrontRequest;
|
||||
import com.zbkj.crmeb.front.response.BargainCountResponse;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
@@ -26,67 +23,70 @@ import java.util.Map;
|
||||
*/
|
||||
public interface StoreBargainUserHelpService extends IService<StoreBargainUserHelp> {
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param bargainUserId 砍价活动id
|
||||
* @return List<StoreBargainUserHelpResponse>
|
||||
*/
|
||||
List<StoreBargainUserHelpResponse> getList(Integer bargainUserId);
|
||||
|
||||
/**
|
||||
* 获取帮忙砍价好友数量
|
||||
* @param bargainId
|
||||
* @return
|
||||
* @param bargainId 砍价商品Id
|
||||
* @return Long
|
||||
*/
|
||||
Long getHelpCountByBargainId(Integer bargainId);
|
||||
|
||||
/**
|
||||
* 获取帮忙砍价好友数量
|
||||
* @param bargainId
|
||||
* @param bargainUid
|
||||
* @return
|
||||
* @param bargainId 砍价商品Id
|
||||
* @param bargainUid 砍价用户uid
|
||||
* @return Long
|
||||
*/
|
||||
Long getHelpCountByBargainIdAndBargainUid(Integer bargainId, Integer bargainUid);
|
||||
|
||||
/**
|
||||
* H5 获取帮忙好友砍价数据
|
||||
* @param bargainFrontRequest
|
||||
* @return
|
||||
*/
|
||||
BargainCountResponse getH5CountByBargainId(BargainFrontRequest bargainFrontRequest);
|
||||
|
||||
/**
|
||||
* H5 帮忙好友砍价信息列表
|
||||
* @param bargainFrontRequest
|
||||
* @param pageParamRequest
|
||||
* @return
|
||||
*/
|
||||
PageInfo<StoreBargainUserHelpResponse> getHelpList(BargainFrontRequest bargainFrontRequest, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 砍价
|
||||
* @param bargainFrontRequest
|
||||
* @return
|
||||
* @param bargainFrontRequest 砍价请求参数
|
||||
* @return Map<String, Object>
|
||||
*/
|
||||
Map<String, Object> help(BargainFrontRequest bargainFrontRequest);
|
||||
|
||||
/**
|
||||
* 获取参与砍价人员数量
|
||||
*/
|
||||
Long getHelpPeopleCount();
|
||||
|
||||
/**
|
||||
* 获取参与砍价人员数量
|
||||
*/
|
||||
Long getHelpPeopleCountByBargainId(Integer bargainId);
|
||||
|
||||
/**
|
||||
* 获取用户还剩余的砍价金额
|
||||
* @param bargainId 砍价商品编号
|
||||
* @param bargainUserUid 砍价发起用户uid
|
||||
* @return
|
||||
* @return BigDecimal
|
||||
*/
|
||||
BigDecimal getSurplusPrice(Integer bargainId, Integer bargainUserUid);
|
||||
|
||||
/**
|
||||
* 砍价发起用户信息
|
||||
* @param bargainFrontRequest
|
||||
* @return
|
||||
* 获取参与砍价总人数(次)
|
||||
* @return Integer
|
||||
*/
|
||||
Map<String, String> startUser(BargainFrontRequest bargainFrontRequest);
|
||||
Integer getCount();
|
||||
|
||||
/**
|
||||
* 获取好友助力列表
|
||||
* @param bargainUserId 砍价用户表id
|
||||
* @return List<StoreBargainUserHelp>
|
||||
*/
|
||||
List<StoreBargainUserHelp> getHelpListByBargainUserId(Integer bargainUserId);
|
||||
|
||||
/**
|
||||
* 是否帮砍过
|
||||
* @param bargainUserId 用户砍价活动id
|
||||
* @param uid 用户uid
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean getIsHelp(Integer bargainUserId, Integer uid);
|
||||
|
||||
/**
|
||||
* 获取该砍价商品用户的帮砍次数
|
||||
* @param bargainId 砍价商品id
|
||||
* @param uid 用户uid
|
||||
* @param bargainUserIdList 用户参与砍价活动id数组
|
||||
* @return Integer
|
||||
*/
|
||||
Integer getHelpCountByBargainIdAndUidInBUserId(Integer bargainId, Integer uid, List<Integer> bargainUserIdList);
|
||||
}
|
||||
@@ -6,6 +6,9 @@ import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargainUser;
|
||||
import com.zbkj.crmeb.bargain.request.StoreBargainUserSearchRequest;
|
||||
import com.zbkj.crmeb.bargain.response.StoreBargainUserResponse;
|
||||
import com.zbkj.crmeb.front.request.BargainFrontRequest;
|
||||
import com.zbkj.crmeb.front.response.BargainRecordResponse;
|
||||
import com.zbkj.crmeb.front.response.BargainUserInfoResponse;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@@ -27,23 +30,16 @@ public interface StoreBargainUserService extends IService<StoreBargainUser> {
|
||||
|
||||
/**
|
||||
* 获取砍价商品参与用户列表
|
||||
* @param bargainId
|
||||
* @return
|
||||
* @param bargainId 砍价商品Id
|
||||
* @return List<StoreBargainUser>
|
||||
*/
|
||||
List<StoreBargainUser> getListByBargainId(Integer bargainId);
|
||||
|
||||
/**
|
||||
* 获取砍价商品参与人数
|
||||
* @param id
|
||||
* @return
|
||||
*/
|
||||
Long getCountByBargainId(Integer id);
|
||||
|
||||
/**
|
||||
* 获取砍价商品
|
||||
* @param bargainId 砍价商品编号
|
||||
* @param uid 参与用户uid
|
||||
* @return
|
||||
* @return StoreBargainUser
|
||||
*/
|
||||
StoreBargainUser getByBargainIdAndUid(Integer bargainId, Integer uid);
|
||||
|
||||
@@ -51,7 +47,7 @@ public interface StoreBargainUserService extends IService<StoreBargainUser> {
|
||||
* 获取砍价中商品
|
||||
* @param bargainId 砍价商品编号
|
||||
* @param uid 参与用户uid
|
||||
* @return
|
||||
* @return StoreBargainUser
|
||||
*/
|
||||
StoreBargainUser getByBargainIdAndUidAndPink(Integer bargainId, Integer uid);
|
||||
|
||||
@@ -59,22 +55,32 @@ public interface StoreBargainUserService extends IService<StoreBargainUser> {
|
||||
* 获取用户砍价活动列表
|
||||
* @param bargainId 砍价商品编号
|
||||
* @param uid 参与用户uid
|
||||
* @return
|
||||
* @return StoreBargainUser
|
||||
*/
|
||||
List<StoreBargainUser> getListByBargainIdAndUid(Integer bargainId, Integer uid);
|
||||
|
||||
/**
|
||||
* 用户是否参与砍价商品活动
|
||||
* @param bargainId
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
Boolean isExistByBargainIdAndUid(Integer bargainId, Integer uid);
|
||||
|
||||
/**
|
||||
* 砍价商品用户根据实体查询
|
||||
* @param bargainUser
|
||||
* @return
|
||||
* @param bargainUser 砍价活动
|
||||
* @return List<StoreBargainUser>
|
||||
*/
|
||||
List<StoreBargainUser> getByEntity(StoreBargainUser bargainUser);
|
||||
|
||||
/**
|
||||
* 获取砍价成功列表Header
|
||||
*/
|
||||
List<StoreBargainUser> getHeaderList();
|
||||
|
||||
/**
|
||||
* 获取用户砍价信息
|
||||
* @param bargainFrontRequest 请求参数
|
||||
* @return BargainUserInfoResponse
|
||||
*/
|
||||
BargainUserInfoResponse getBargainUserInfo(BargainFrontRequest bargainFrontRequest);
|
||||
|
||||
/**
|
||||
* 砍价记录
|
||||
* @return PageInfo<BargainRecordResponse>
|
||||
*/
|
||||
PageInfo<BargainRecordResponse> getRecordList(PageParamRequest pageParamRequest);
|
||||
}
|
||||
@@ -6,11 +6,11 @@ import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.CommonPage;
|
||||
import com.common.MyRecord;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.BargainConstants;
|
||||
import com.constants.Constants;
|
||||
@@ -31,7 +31,10 @@ import com.zbkj.crmeb.bargain.service.StoreBargainService;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainUserHelpService;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainUserService;
|
||||
import com.zbkj.crmeb.front.request.BargainFrontRequest;
|
||||
import com.zbkj.crmeb.front.response.BargainDetailResponse;
|
||||
import com.zbkj.crmeb.front.response.BargainDetailH5Response;
|
||||
import com.zbkj.crmeb.front.response.BargainHeaderResponse;
|
||||
import com.zbkj.crmeb.front.response.BargainIndexResponse;
|
||||
import com.zbkj.crmeb.front.response.StoreBargainDetailResponse;
|
||||
import com.zbkj.crmeb.store.model.*;
|
||||
import com.zbkj.crmeb.store.request.StoreProductAttrValueRequest;
|
||||
import com.zbkj.crmeb.store.request.StoreProductStockRequest;
|
||||
@@ -47,11 +50,13 @@ import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -105,12 +110,6 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
@Autowired
|
||||
private StoreProductService storeProductService;
|
||||
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(StoreBargainServiceImpl.class);
|
||||
|
||||
/**
|
||||
@@ -176,8 +175,8 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
|
||||
/**
|
||||
* 删除砍价商品
|
||||
* @param id
|
||||
* @return
|
||||
* @param id 砍价商品id
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean deleteById(Integer id) {
|
||||
@@ -277,11 +276,11 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
|
||||
/**
|
||||
* 编辑砍价商品
|
||||
* @param request
|
||||
* @return
|
||||
* @param request 请求参数
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public boolean updateBarhain(StoreBargainRequest request) {
|
||||
public boolean updateBargain(StoreBargainRequest request) {
|
||||
StoreBargain existBargain = getById(request.getId());
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
if (existBargain.getStatus().equals(true) && existBargain.getStartTime() <= timeMillis && timeMillis <= existBargain.getStopTime()) {
|
||||
@@ -333,6 +332,14 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
boolean saveAttrValue = attrValueService.save(singleAttrValue);
|
||||
if(!saveAttrValue) throw new CrmebException("编辑属性详情失败");
|
||||
|
||||
// 处理富文本
|
||||
StoreProductDescription spd = new StoreProductDescription(
|
||||
bargain.getId(), request.getContent().length() > 0
|
||||
? systemAttachmentService.clearPrefix(request.getContent()) : "" , ProductConstants.PRODUCT_TYPE_BARGAIN);
|
||||
storeProductDescriptionService.deleteByProductId(spd.getProductId(), ProductConstants.PRODUCT_TYPE_BARGAIN);
|
||||
boolean saveDesc = storeProductDescriptionService.save(spd);
|
||||
if (!saveDesc) throw new CrmebException("编辑商品富文本失败");
|
||||
|
||||
// attrResult整存整取,不做更新
|
||||
storeProductAttrResultService.deleteByProductId(bargain.getId(),ProductConstants.PRODUCT_TYPE_BARGAIN);
|
||||
StoreProductAttrResult attrResult = new StoreProductAttrResult(
|
||||
@@ -373,7 +380,7 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
/**
|
||||
* 获取砍价商品详情
|
||||
* @param bargainId 砍价商品id
|
||||
* @return
|
||||
* @return StoreProductResponse
|
||||
*/
|
||||
@Override
|
||||
public StoreProductResponse getAdminDetail(Integer bargainId) {
|
||||
@@ -457,13 +464,15 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
|
||||
/**
|
||||
* h5 获取砍价商品列表
|
||||
* @param pageParamRequest
|
||||
* @return
|
||||
* @param pageParamRequest 分页参数
|
||||
* @return PageInfo<StoreBargainDetailResponse>
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<StoreBargainResponse> getH5List(PageParamRequest pageParamRequest) {
|
||||
public PageInfo<StoreBargainDetailResponse> getH5List(PageParamRequest pageParamRequest) {
|
||||
Page<StoreBargain> storeBargainPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<StoreBargain> lqw = new LambdaQueryWrapper();
|
||||
LambdaQueryWrapper<StoreBargain> lqw = Wrappers.lambdaQuery();
|
||||
lqw.select(StoreBargain::getId, StoreBargain::getProductId, StoreBargain::getTitle, StoreBargain::getImage,
|
||||
StoreBargain::getStartTime, StoreBargain::getStopTime, StoreBargain::getMinPrice, StoreBargain::getQuota);
|
||||
lqw.eq(StoreBargain::getStatus, true);
|
||||
lqw.eq(StoreBargain::getIsDel, false);
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
@@ -471,120 +480,57 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
lqw.ge(StoreBargain::getStopTime, timeMillis);
|
||||
lqw.orderByDesc(StoreBargain::getSort, StoreBargain::getId);
|
||||
List<StoreBargain> storeBargains = dao.selectList(lqw);
|
||||
List<StoreBargainResponse> bargainResponseList = storeBargains.stream().map(bargain -> {
|
||||
StoreBargainResponse storeBargainResponse = new StoreBargainResponse();
|
||||
Long countByBargainId = storeBargainUserService.getCountByBargainId(bargain.getId());
|
||||
if (CollUtil.isEmpty(storeBargains)) {
|
||||
return CommonPage.copyPageInfo(storeBargainPage, CollUtil.newArrayList());
|
||||
}
|
||||
List<StoreBargainDetailResponse> bargainResponseList = storeBargains.stream().map(bargain -> {
|
||||
StoreBargainDetailResponse storeBargainResponse = new StoreBargainDetailResponse();
|
||||
BeanUtils.copyProperties(bargain, storeBargainResponse);
|
||||
storeBargainResponse.setCountPeopleAll(countByBargainId);
|
||||
return storeBargainResponse;
|
||||
}).collect(Collectors.toList());
|
||||
return CommonPage.copyPageInfo(storeBargainPage, bargainResponseList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查看、分享、参与人数
|
||||
* 这里目前是获取总的数据,以后还是要改成获取商品的数据
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> getH5Share(Integer bargainId) {
|
||||
QueryWrapper<StoreBargain> qw = new QueryWrapper<>();
|
||||
qw.select("ifnull(sum(look), 0) as lookCount", "ifnull(sum(share), 0) as shareCount");
|
||||
qw.eq("is_del", false);
|
||||
Map<String, Object> map = getMap(qw);
|
||||
Integer count = storeBargainUserHelpService.count();
|
||||
map.put("userCount", count.longValue());
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* H5 砍价商品详情
|
||||
* @param id 砍价商品id
|
||||
*/
|
||||
@Override
|
||||
public BargainDetailResponse getH5Detail(Integer id) {
|
||||
public BargainDetailH5Response getH5Detail(Integer id) {
|
||||
StoreBargain storeBargain = dao.selectById(id);
|
||||
if (ObjectUtil.isNull(storeBargain)) throw new CrmebException("未找到对应砍价商品信息");
|
||||
StoreProductResponse storeProductResponse = new StoreProductResponse();
|
||||
BeanUtils.copyProperties(storeBargain, storeProductResponse);
|
||||
storeProductResponse.setRule(systemAttachmentService.clearPrefix(storeProductResponse.getRule()));
|
||||
storeProductResponse.setEndTime(storeBargain.getStopTime());
|
||||
|
||||
StoreProductAttr spaPram = new StoreProductAttr();
|
||||
spaPram.setProductId(id).setType(ProductConstants.PRODUCT_TYPE_BARGAIN);
|
||||
storeProductResponse.setAttr(attrService.getByEntity(spaPram));
|
||||
if (ObjectUtil.isNull(storeBargain) || storeBargain.getIsDel()) {
|
||||
throw new CrmebException("未找到对应砍价商品信息");
|
||||
}
|
||||
if (!storeBargain.getStatus()) {
|
||||
throw new CrmebException("砍价商品已下架");
|
||||
}
|
||||
BargainDetailH5Response detailH5Response = new BargainDetailH5Response();
|
||||
BeanUtils.copyProperties(storeBargain, detailH5Response);
|
||||
|
||||
StoreProductAttrValue spavPramBargain = new StoreProductAttrValue();
|
||||
spavPramBargain.setProductId(id).setType(ProductConstants.PRODUCT_TYPE_BARGAIN);
|
||||
List<StoreProductAttrValue> storeProductAttrValuesBargain = storeProductAttrValueService.getByEntity(spavPramBargain);
|
||||
|
||||
// 查询attr
|
||||
StoreProductAttr spaPramNormal = new StoreProductAttr();
|
||||
spaPramNormal.setProductId(storeBargain.getProductId() ).setType(ProductConstants.PRODUCT_TYPE_NORMAL);
|
||||
List<StoreProductAttr> attrs = attrService.getByEntity(spaPramNormal);
|
||||
boolean specType = false;
|
||||
if (attrs.size() > 1) {
|
||||
specType = true;
|
||||
if (CollUtil.isEmpty(storeProductAttrValuesBargain)) {
|
||||
throw new CrmebException("砍价商品规格属性值未找到");
|
||||
}
|
||||
List<HashMap<String, Object>> attrValuesBargain = genratorSkuInfo(id, specType, storeBargain, storeProductAttrValuesBargain, ProductConstants.PRODUCT_TYPE_BARGAIN);
|
||||
StoreProductAttrValue productAttrValue = storeProductAttrValuesBargain.get(0);
|
||||
detailH5Response.setAttrValueId(productAttrValue.getId());
|
||||
detailH5Response.setSku(productAttrValue.getSuk());
|
||||
|
||||
// H5 端用于生成skuList
|
||||
List<StoreProductAttrValueResponse> sPAVResponses = new ArrayList<>();
|
||||
|
||||
for (StoreProductAttrValue storeProductAttrValue : storeProductAttrValuesBargain) {
|
||||
StoreProductAttrValueResponse atr = new StoreProductAttrValueResponse();
|
||||
BeanUtils.copyProperties(storeProductAttrValue,atr);
|
||||
atr.setQuota(storeProductAttrValue.getQuota());
|
||||
atr.setMinPrice(storeBargain.getMinPrice());
|
||||
sPAVResponses.add(atr);
|
||||
}
|
||||
storeProductResponse.setAttrValues(attrValuesBargain);
|
||||
storeProductResponse.setAttrValue(sPAVResponses);
|
||||
StoreProductDescription sd = storeProductDescriptionService.getOne(
|
||||
new LambdaQueryWrapper<StoreProductDescription>()
|
||||
.eq(StoreProductDescription::getProductId, id)
|
||||
.eq(StoreProductDescription::getType, ProductConstants.PRODUCT_TYPE_BARGAIN));
|
||||
if(null != sd){
|
||||
storeProductResponse.setContent(null == sd.getDescription()?"":sd.getDescription());
|
||||
if (ObjectUtil.isNotNull(sd)) {
|
||||
detailH5Response.setContent(ObjectUtil.isNull(sd.getDescription()) ? "" : sd.getDescription());
|
||||
}
|
||||
|
||||
User user = userService.getInfo();
|
||||
// 用户发起的砍价活动次数
|
||||
int userBargainStatus = isCanPink(storeBargain, user.getUid());
|
||||
|
||||
// 砍价支付成功订单数量
|
||||
Integer bargainSumCount = storeOrderService.getCountByBargainIdAndUid(storeBargain.getId(), user.getUid());
|
||||
|
||||
BargainDetailResponse bargainDetailResponse = new BargainDetailResponse(storeProductResponse, userBargainStatus, user, bargainSumCount);
|
||||
bargainDetailResponse.setAloneAttrValueId(storeProductResponse.getAttrValue().get(0).getId());
|
||||
|
||||
// 查看人数+1
|
||||
storeBargain.setLook(storeBargain.getLook() + 1);
|
||||
updateById(storeBargain);
|
||||
return bargainDetailResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户砍价活动次数
|
||||
* @param storeBargain 砍价商品
|
||||
* @param uid 用户uid
|
||||
* @return
|
||||
* 1.用户有没有砍价中的活动
|
||||
* 2.没有的,用户的砍价次数有没有到
|
||||
*/
|
||||
private int isCanPink(StoreBargain storeBargain, Integer uid) {
|
||||
int userBargainStatus = 0; // 能
|
||||
List<StoreBargainUser> list = storeBargainUserService.getListByBargainIdAndUid(storeBargain.getId(), uid);
|
||||
if (CollUtil.isNotEmpty(list)) {
|
||||
userBargainStatus = list.size();
|
||||
}
|
||||
return userBargainStatus;
|
||||
return detailH5Response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取当前时间段的砍价商品
|
||||
* @param productId 砍价商品id
|
||||
* @return
|
||||
* @return List<StoreBargain>
|
||||
*/
|
||||
@Override
|
||||
public List<StoreBargain> getCurrentBargainByProductId(Integer productId) {
|
||||
@@ -599,16 +545,27 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
}
|
||||
|
||||
/**
|
||||
* 参与砍价商品活动
|
||||
* 创建砍价活动
|
||||
* @param request 请求参数
|
||||
* @return Boolean
|
||||
* @return MyRecord
|
||||
*/
|
||||
@Override
|
||||
public Boolean start(BargainFrontRequest request) {
|
||||
public MyRecord start(BargainFrontRequest request) {
|
||||
StoreBargain storeBargain = dao.selectById(request.getBargainId());
|
||||
if (ObjectUtil.isNull(storeBargain)) throw new CrmebException("对应的砍价商品不存在");
|
||||
if (!storeBargain.getStatus()) throw new CrmebException("砍价活动已结束");
|
||||
User user = userService.getInfo();
|
||||
if (ObjectUtil.isNull(storeBargain) || storeBargain.getIsDel()) {
|
||||
throw new CrmebException("对应的砍价商品不存在");
|
||||
}
|
||||
if (!storeBargain.getStatus()) {
|
||||
throw new CrmebException("砍价商品已下架");
|
||||
}
|
||||
if (storeBargain.getQuota() <= 0 || storeBargain.getStock() <= 0) {
|
||||
throw new CrmebException("砍价商品已售罄");
|
||||
}
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
if (currentTimeMillis > storeBargain.getStopTime()) {
|
||||
throw new CrmebException("砍价活动已结束");
|
||||
}
|
||||
User user = userService.getInfoException();
|
||||
|
||||
// 判断是否有正在砍价商品
|
||||
StoreBargainUser spavBargainUser = new StoreBargainUser();
|
||||
@@ -617,10 +574,9 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
if (CollUtil.isNotEmpty(historyList)) {
|
||||
List<StoreBargainUser> collect = historyList.stream().filter(i -> i.getStatus().equals(BargainConstants.BARGAIN_USER_STATUS_PARTICIPATE)).collect(Collectors.toList());
|
||||
if (CollUtil.isNotEmpty(collect)) {
|
||||
// throw new CrmebException("请先完成当前砍价活动");
|
||||
return true;
|
||||
throw new CrmebException("请先完成当前砍价活动");
|
||||
}
|
||||
// 判断是否达到参与砍价活动上限
|
||||
// 判断是否达到参与砍价活动上限
|
||||
if (historyList.size() >= storeBargain.getNum()) {
|
||||
throw new CrmebException("您已达到当前砍价活动上限");
|
||||
}
|
||||
@@ -634,7 +590,13 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
storeBargainUser.setPrice(BigDecimal.ZERO);
|
||||
storeBargainUser.setAddTime(System.currentTimeMillis());
|
||||
storeBargainUser.setStatus(BargainConstants.BARGAIN_USER_STATUS_PARTICIPATE);
|
||||
return storeBargainUserService.save(storeBargainUser);
|
||||
boolean save = storeBargainUserService.save(storeBargainUser);
|
||||
if (!save) {
|
||||
throw new CrmebException("参与砍价失败");
|
||||
}
|
||||
MyRecord record = new MyRecord();
|
||||
record.set("storeBargainUserId", storeBargainUser.getId());
|
||||
return record;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -649,57 +611,10 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扣减砍价商品库存
|
||||
* @param bargainId 砍价产品id
|
||||
* @param num 购买商品数量
|
||||
* @param attrValueId 砍价产品规格
|
||||
* @param productId 主商品id
|
||||
* @param uid 用户uid
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public Boolean decProductStock(Integer bargainId, Integer num, Integer attrValueId, Integer productId, Integer uid) {
|
||||
// 因为attrvalue表中unique使用Id代替,更新前先查询此表是否存在
|
||||
StoreProductAttrValue spavParm = new StoreProductAttrValue();
|
||||
spavParm.setProductId(bargainId);
|
||||
spavParm.setType(ProductConstants.PRODUCT_TYPE_BARGAIN);
|
||||
spavParm.setId(attrValueId);
|
||||
List<StoreProductAttrValue> attrvalues = storeProductAttrValueService.getByEntity(spavParm);
|
||||
if (CollUtil.isEmpty(attrvalues)) throw new CrmebException("未找到相关商品属性");
|
||||
StoreProductAttrValue bargaunAttrValue = attrvalues.get(0);
|
||||
// 对应的主商品sku
|
||||
List<StoreProductAttrValue> currentProAttrValues = storeProductAttrValueService.getListByProductId(productId);
|
||||
List<StoreProductAttrValue> existAttrValues = currentProAttrValues.stream().filter(e ->
|
||||
e.getSuk().equals(bargaunAttrValue.getSuk()) && e.getType().equals(ProductConstants.PRODUCT_TYPE_NORMAL))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(existAttrValues)) throw new CrmebException("未找到扣减库存的商品");
|
||||
// 砍价SKU 库存减,销量、限购总数减
|
||||
StoreBargain storeBargain = getById(bargainId);
|
||||
LambdaUpdateWrapper<StoreBargain> luw = new LambdaUpdateWrapper<>();
|
||||
luw.set(StoreBargain::getStock, storeBargain.getStock() - num);
|
||||
luw.set(StoreBargain::getSales, storeBargain.getSales() + num);
|
||||
luw.set(StoreBargain::getQuota, storeBargain.getQuota() - num);
|
||||
luw.eq(StoreBargain::getId, bargainId);
|
||||
luw.apply(StrUtil.format(" (stock - {} >= 0) ", num));
|
||||
// 砍价商品购买成功,改变用户状态
|
||||
StoreBargainUser storeBargainUser = storeBargainUserService.getByBargainIdAndUid(bargainId, uid);
|
||||
if (ObjectUtil.isNull(storeBargainUser)) throw new CrmebException("砍价用户信息不存在");
|
||||
storeBargainUser.setStatus(3);
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
storeProductAttrValueService.decProductAttrStock(bargainId, attrValueId, num, ProductConstants.PRODUCT_TYPE_BARGAIN);
|
||||
storeProductService.decProductStock(productId, num, existAttrValues.get(0).getId(), ProductConstants.PRODUCT_TYPE_NORMAL);
|
||||
update(luw);
|
||||
storeBargainUserService.updateById(storeBargainUser);
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
return execute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加库存
|
||||
* @param stockRequest StoreProductStockRequest 参数对象
|
||||
* @return
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public Boolean stockAddRedis(StoreProductStockRequest stockRequest) {
|
||||
@@ -762,8 +677,8 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
if (CollUtil.isEmpty(bargainUsers)) {
|
||||
continue ;
|
||||
}
|
||||
for (int i = 0; i < bargainUsers.size(); i++) {
|
||||
bargainUsers.get(i).setStatus(BargainConstants.BARGAIN_USER_STATUS_FAIL);
|
||||
for (StoreBargainUser bargainUser : bargainUsers) {
|
||||
bargainUser.setStatus(BargainConstants.BARGAIN_USER_STATUS_FAIL);
|
||||
}
|
||||
bargainUserList.addAll(bargainUsers);
|
||||
}
|
||||
@@ -777,7 +692,7 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
/**
|
||||
* 商品是否存在砍价活动
|
||||
* @param productId 商品编号
|
||||
* @return
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public Boolean isExistActivity(Integer productId) {
|
||||
@@ -828,15 +743,112 @@ public class StoreBargainServiceImpl extends ServiceImpl<StoreBargainDao, StoreB
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota - {}", num));
|
||||
// 扣减时加乐观锁保证库存不为负
|
||||
updateWrapper.last(StrUtil.format(" and (stock - {} >= 0)", num));
|
||||
updateWrapper.last(StrUtil.format(" and (quota - {} >= 0)", num));
|
||||
}
|
||||
updateWrapper.eq("id", id);
|
||||
return update(updateWrapper);
|
||||
boolean update = update(updateWrapper);
|
||||
if (!update) {
|
||||
throw new CrmebException("更新砍价商品库存失败,商品id = " + id);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价首页信息
|
||||
* 砍价商品信息6条
|
||||
* @return BargainIndexResponse
|
||||
*/
|
||||
@Override
|
||||
public BargainIndexResponse getIndexInfo() {
|
||||
LambdaQueryWrapper<StoreBargain> lqw = Wrappers.lambdaQuery();
|
||||
lqw.select(StoreBargain::getId, StoreBargain::getProductId, StoreBargain::getTitle, StoreBargain::getMinPrice, StoreBargain::getPrice, StoreBargain::getImage);
|
||||
lqw.eq(StoreBargain::getStatus, true);
|
||||
lqw.eq(StoreBargain::getIsDel, false);
|
||||
lqw.gt(StoreBargain::getStock, 0);
|
||||
long timeMillis = System.currentTimeMillis();
|
||||
lqw.le(StoreBargain::getStartTime, timeMillis);
|
||||
lqw.ge(StoreBargain::getStopTime, timeMillis);
|
||||
lqw.orderByDesc(StoreBargain::getSort, StoreBargain::getId);
|
||||
lqw.last(" limit 6");
|
||||
List<StoreBargain> storeBargains = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(storeBargains)) {
|
||||
return null;
|
||||
}
|
||||
BargainIndexResponse response = new BargainIndexResponse();
|
||||
response.setProductList(storeBargains);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取砍价列表header
|
||||
* @return BargainHeaderResponse
|
||||
*/
|
||||
@Override
|
||||
public BargainHeaderResponse getHeader() {
|
||||
BargainHeaderResponse headerResponse = new BargainHeaderResponse();
|
||||
// 获取参与砍价总人数
|
||||
Integer bargainTotal = storeBargainUserHelpService.getCount();
|
||||
headerResponse.setBargainTotal(bargainTotal);
|
||||
if (bargainTotal <= 0) {
|
||||
return headerResponse;
|
||||
}
|
||||
// 获取砍价成功列表
|
||||
List<StoreBargainUser> bargainUserList = storeBargainUserService.getHeaderList();
|
||||
List<Integer> uidList = bargainUserList.stream().map(StoreBargainUser::getUid).distinct().collect(Collectors.toList());
|
||||
HashMap<Integer, User> userMap = userService.getMapListInUid(uidList);
|
||||
List<Integer> bargainIdList = bargainUserList.stream().map(StoreBargainUser::getBargainId).distinct().collect(Collectors.toList());
|
||||
HashMap<Integer, String> bargainMap = getStoreNameMapInId(bargainIdList);
|
||||
List<HashMap<String, Object>> mapList = bargainUserList.stream().map(e -> {
|
||||
// 获取用户昵称头像
|
||||
User user = userMap.get(e.getUid());
|
||||
HashMap<String, Object> map = CollUtil.newHashMap();
|
||||
map.put("nickName", user.getNickname());
|
||||
map.put("avatar", user.getAvatar());
|
||||
map.put("price", e.getBargainPriceMin());
|
||||
map.put("title", bargainMap.get(e.getBargainId()));
|
||||
return map;
|
||||
}).collect(Collectors.toList());
|
||||
headerResponse.setBargainSuccessList(mapList);
|
||||
return headerResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据id数组获取砍价商品map
|
||||
* @param bargainIdList 砍价商品id数组
|
||||
* @return HashMap<Integer, StoreBargain>
|
||||
*/
|
||||
@Override
|
||||
public HashMap<Integer, StoreBargain> getMapInId(List<Integer> bargainIdList) {
|
||||
LambdaQueryWrapper<StoreBargain> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.in(StoreBargain::getId, bargainIdList);
|
||||
List<StoreBargain> bargainList = dao.selectList(lqw);
|
||||
HashMap<Integer, StoreBargain> map = CollUtil.newHashMap();
|
||||
bargainList.forEach(e -> {
|
||||
map.put(e.getId(), e);
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取砍价商品名称Map
|
||||
* @param bargainIdList 砍价商品id数组
|
||||
* @return List<HashMap<Object, Object>>
|
||||
*/
|
||||
private HashMap<Integer, String> getStoreNameMapInId(List<Integer> bargainIdList) {
|
||||
LambdaQueryWrapper<StoreBargain> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.select(StoreBargain::getId, StoreBargain::getTitle);
|
||||
lqw.in(StoreBargain::getId, bargainIdList);
|
||||
List<StoreBargain> bargainList = dao.selectList(lqw);
|
||||
HashMap<Integer, String> map = CollUtil.newHashMap();
|
||||
bargainList.forEach(e -> {
|
||||
map.put(e.getId(), e.getTitle());
|
||||
});
|
||||
return map;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询活动状态为开启,结束时间小于当前时间的数据
|
||||
* @return
|
||||
* @return List<StoreBargain>
|
||||
*/
|
||||
private List<StoreBargain> getByStatusAndGtStopTime() {
|
||||
LambdaQueryWrapper<StoreBargain> lqw = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -6,15 +6,10 @@ import cn.hutool.core.util.RandomUtil;
|
||||
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.CommonPage;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.BargainConstants;
|
||||
import com.constants.Constants;
|
||||
import com.constants.UserConstants;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.utils.DateUtil;
|
||||
import com.zbkj.crmeb.bargain.dao.StoreBargainUserHelpDao;
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargain;
|
||||
@@ -25,7 +20,6 @@ import com.zbkj.crmeb.bargain.service.StoreBargainService;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainUserHelpService;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainUserService;
|
||||
import com.zbkj.crmeb.front.request.BargainFrontRequest;
|
||||
import com.zbkj.crmeb.front.response.BargainCountResponse;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.model.UserToken;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
@@ -34,14 +28,15 @@ import com.zbkj.crmeb.wechat.service.TemplateMessageService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static java.math.BigDecimal.ZERO;
|
||||
|
||||
/**
|
||||
* StoreBargainUserHelpService 实现类
|
||||
* +----------------------------------------------------------------------
|
||||
@@ -75,11 +70,14 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
@Autowired
|
||||
private UserTokenService userTokenService;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
|
||||
|
||||
/**
|
||||
* 列表
|
||||
* @param bargainUserId
|
||||
* @return
|
||||
* @param bargainUserId 砍价活动id
|
||||
* @return List<StoreBargainUserHelpResponse>
|
||||
*/
|
||||
@Override
|
||||
public List<StoreBargainUserHelpResponse> getList(Integer bargainUserId) {
|
||||
@@ -105,7 +103,7 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
/**
|
||||
* 获取帮助砍价人数
|
||||
* @param bargainId 砍价商品ID
|
||||
* @return
|
||||
* @return Long
|
||||
*/
|
||||
@Override
|
||||
public Long getHelpCountByBargainId(Integer bargainId) {
|
||||
@@ -119,7 +117,7 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
* 获取帮助砍价人数
|
||||
* @param bargainId 砍价商品ID
|
||||
* @param bargainUserId 砍价商品发起用户表id
|
||||
* @return
|
||||
* @return Long
|
||||
*/
|
||||
@Override
|
||||
public Long getHelpCountByBargainIdAndBargainUid(Integer bargainId, Integer bargainUserId) {
|
||||
@@ -130,114 +128,40 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
return dao.selectCount(lambdaQueryWrapper).longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取帮忙好友砍价数据
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public BargainCountResponse getH5CountByBargainId(BargainFrontRequest request) {
|
||||
boolean isConsume = false;
|
||||
User user = userService.getInfo();
|
||||
StoreBargain storeBargain = storeBargainService.getById(request.getBargainId());
|
||||
// 获取砍价商品用户对象
|
||||
StoreBargainUser bargainUser = storeBargainUserService.getByBargainIdAndUidAndPink(request.getBargainId(), request.getBargainUserUid());
|
||||
if (ObjectUtil.isNull(bargainUser)) {
|
||||
// throw new CrmebException("用户砍价对象不存在");
|
||||
return new BargainCountResponse(ZERO, 0, storeBargain.getPrice().subtract(storeBargain.getMinPrice()), 0, 0, true, isConsume);
|
||||
}
|
||||
// 获取砍价好友信息
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StoreBargainUserHelp::getBargainId, request.getBargainId());
|
||||
lqw.eq(StoreBargainUserHelp::getBargainUserId, bargainUser.getId());
|
||||
List<StoreBargainUserHelp> storeBargainUserHelps = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(storeBargainUserHelps)) {
|
||||
return new BargainCountResponse(ZERO, 0, bargainUser.getBargainPrice().subtract(bargainUser.getBargainPriceMin()), 0, BargainConstants.BARGAIN_USER_STATUS_PARTICIPATE, true, isConsume);
|
||||
}
|
||||
|
||||
// 已砍金额
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();
|
||||
// 砍价人数
|
||||
int count = storeBargainUserHelps.size();
|
||||
// 剩余金额
|
||||
BigDecimal price = bargainUser.getBargainPrice().subtract(bargainUser.getBargainPriceMin()).subtract(bargainUser.getPrice());
|
||||
// 砍价百分比
|
||||
int pricePercent = bargainUser.getPrice().multiply(new BigDecimal(100)).divide((bargainUser.getBargainPrice().subtract(bargainUser.getBargainPriceMin())), 0, BigDecimal.ROUND_DOWN).intValue();
|
||||
// 自己的砍价状态
|
||||
boolean userBargainStatus = false;
|
||||
List<StoreBargainUserHelp> collect = storeBargainUserHelps.stream().filter(o -> o.getUid().equals(user.getUid())).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(collect)) {
|
||||
if (user.getUid().equals(request.getBargainUserUid())) {// 自己的砍价活动
|
||||
userBargainStatus = true;
|
||||
} else {// 其他人的砍价活动
|
||||
// 用户对本商品的砍价次数
|
||||
List<Integer> tempUserIdList = null;
|
||||
List<StoreBargainUser> tempUserList = storeBargainUserService.getListByBargainIdAndUid(storeBargain.getId(), user.getUid());
|
||||
if (CollUtil.isNotEmpty(tempUserList)) {
|
||||
tempUserIdList = tempUserList.stream().map(StoreBargainUser::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Integer helpCount = getUserHelpNum(user.getUid(), storeBargain.getId(), tempUserIdList);
|
||||
if (helpCount == 0 || helpCount < storeBargain.getBargainNum()) {
|
||||
userBargainStatus = true;
|
||||
} else {
|
||||
isConsume = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// 活动状态
|
||||
Integer status = bargainUser.getStatus();
|
||||
return new BargainCountResponse(alreadyPrice, count, price, pricePercent, status, userBargainStatus, isConsume);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取帮忙砍价好友信息
|
||||
* @param request
|
||||
* @param pageParamRequest
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<StoreBargainUserHelpResponse> getHelpList(BargainFrontRequest request, PageParamRequest pageParamRequest) {
|
||||
StoreBargainUser storeBargainUser = storeBargainUserService.getByBargainIdAndUidAndPink(request.getBargainId(), request.getBargainUserUid());
|
||||
Page<StoreBargainUserHelp> helpPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
if (ObjectUtil.isNull(storeBargainUser)) {
|
||||
return CommonPage.copyPageInfo(helpPage, new ArrayList<>());
|
||||
}
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StoreBargainUserHelp::getBargainId, request.getBargainId());
|
||||
lqw.eq(StoreBargainUserHelp::getBargainUserId, storeBargainUser.getId());
|
||||
List<StoreBargainUserHelp> storeBargainUserHelps = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(storeBargainUserHelps)) {
|
||||
return CommonPage.copyPageInfo(helpPage, CollUtil.newArrayList());
|
||||
}
|
||||
List<StoreBargainUserHelpResponse> list = storeBargainUserHelps.stream().map(userHelp -> {
|
||||
StoreBargainUserHelpResponse helpResponse = new StoreBargainUserHelpResponse();
|
||||
BeanUtils.copyProperties(userHelp, helpResponse);
|
||||
helpResponse.setAddTime(DateUtil.timestamp2DateStr(userHelp.getAddTime(), Constants.DATE_FORMAT));
|
||||
User tempUser = userService.getById(userHelp.getUid());
|
||||
helpResponse.setNickname(tempUser.getNickname());
|
||||
helpResponse.setAvatar(tempUser.getAvatar());
|
||||
return helpResponse;
|
||||
}).collect(Collectors.toList());
|
||||
return CommonPage.copyPageInfo(helpPage, list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价
|
||||
* @param request
|
||||
* @return
|
||||
* @param request 砍价请求参数
|
||||
* @return 砍价金额
|
||||
*/
|
||||
@Override
|
||||
public Map<String, Object> help(BargainFrontRequest request) {
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
if (ObjectUtil.isNull(request.getBargainUserId())) {
|
||||
throw new CrmebException("砍价活动id不能为空");
|
||||
}
|
||||
|
||||
Map<String, Object> map = new HashMap<>();
|
||||
User user = userService.getInfoException();
|
||||
StoreBargain storeBargain = storeBargainService.getById(request.getBargainId());
|
||||
if (ObjectUtil.isNull(storeBargain)) throw new CrmebException("砍价商品不存在");
|
||||
if (!storeBargain.getStatus()) throw new CrmebException("砍价活动已结束");
|
||||
StoreBargainUser storeBargainUser = storeBargainUserService.getByBargainIdAndUidAndPink(request.getBargainId(), request.getBargainUserUid());
|
||||
if (ObjectUtil.isNull(storeBargainUser)) throw new CrmebException("砍价商品用户信息不存在");
|
||||
User user = userService.getInfo();
|
||||
if (ObjectUtil.isNull(storeBargain) || storeBargain.getIsDel()) {
|
||||
throw new CrmebException("对应的砍价商品不存在");
|
||||
}
|
||||
if (!storeBargain.getStatus()) {
|
||||
throw new CrmebException("砍价商品已下架");
|
||||
}
|
||||
if (storeBargain.getQuota() <= 0 || storeBargain.getStock() <= 0) {
|
||||
throw new CrmebException("砍价商品已售罄");
|
||||
}
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
if (currentTimeMillis < storeBargain.getStartTime()) {
|
||||
throw new CrmebException("砍价活动未开始");
|
||||
}
|
||||
if (currentTimeMillis > storeBargain.getStopTime()) {
|
||||
throw new CrmebException("砍价活动已结束");
|
||||
}
|
||||
StoreBargainUser storeBargainUser = storeBargainUserService.getById(request.getBargainUserId());
|
||||
if (ObjectUtil.isNull(storeBargainUser)) {
|
||||
throw new CrmebException("砍价商品用户信息不存在");
|
||||
}
|
||||
|
||||
// 判断是否砍价成功
|
||||
if (storeBargainUser.getStatus().equals(BargainConstants.BARGAIN_USER_STATUS_SUCCESS) || storeBargainUser.getBargainPriceMin().compareTo(storeBargainUser.getBargainPrice().subtract(storeBargainUser.getPrice())) >= 0) {
|
||||
@@ -250,17 +174,15 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
if (ObjectUtil.isNotNull(myHelp)) {
|
||||
throw new CrmebException("您已经砍过了");
|
||||
}
|
||||
} else {// 不是给自己砍价,不包含给自己看的
|
||||
} else {// 不是给自己砍价,不包含给自己砍的
|
||||
// 用户对本商品的砍价次数
|
||||
List<Integer> tempUserIdList = null;
|
||||
List<StoreBargainUser> tempUserList = storeBargainUserService.getListByBargainIdAndUid(storeBargain.getId(), user.getUid());
|
||||
if (CollUtil.isNotEmpty(tempUserList)) {
|
||||
tempUserIdList = tempUserList.stream().map(StoreBargainUser::getId).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Integer helpCount = getUserHelpNum(user.getUid(), storeBargain.getId(), tempUserIdList);
|
||||
if (helpCount >= storeBargain.getBargainNum()) {
|
||||
throw new CrmebException("您的帮砍次数已达上限");
|
||||
List<Integer> tempUserIdList = tempUserList.stream().map(StoreBargainUser::getId).collect(Collectors.toList());
|
||||
Integer helpCount = getUserHelpNum(user.getUid(), storeBargain.getId(), tempUserIdList);
|
||||
if (helpCount >= storeBargain.getBargainNum()) {
|
||||
throw new CrmebException("您的帮砍次数已达上限");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -268,46 +190,55 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
Long helpCount = getHelpCountByBargainIdAndBargainUid(request.getBargainId(), storeBargainUser.getId());
|
||||
// 计算砍价金额
|
||||
BigDecimal bargainPrice = helpBargain(storeBargain, storeBargainUser, helpCount);
|
||||
|
||||
LambdaUpdateWrapper<StoreBargainUser> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(StoreBargainUser::getPrice, storeBargainUser.getPrice().add(bargainPrice));
|
||||
updateWrapper.eq(StoreBargainUser::getId, storeBargainUser.getId());
|
||||
updateWrapper.eq(StoreBargainUser::getPrice, storeBargainUser.getPrice());
|
||||
storeBargainUser.setPrice(storeBargainUser.getPrice().add(bargainPrice));
|
||||
boolean update = storeBargainUserService.update(updateWrapper);
|
||||
if (!update) throw new CrmebException("砍价失败!");
|
||||
|
||||
|
||||
StoreBargainUserHelp userHelp = new StoreBargainUserHelp();
|
||||
userHelp.setBargainId(request.getBargainId());
|
||||
userHelp.setBargainUserId(storeBargainUser.getId());
|
||||
userHelp.setUid(user.getUid());
|
||||
userHelp.setPrice(bargainPrice);
|
||||
userHelp.setAddTime(System.currentTimeMillis());
|
||||
boolean save = save(userHelp);
|
||||
if (!save) throw new CrmebException("砍价失败!!!");
|
||||
|
||||
// 分享人数添加
|
||||
if (!user.getUid().equals(request.getBargainUserUid())) {
|
||||
storeBargain.setShare(storeBargain.getShare() + 1);
|
||||
storeBargainService.updateById(storeBargain);
|
||||
}
|
||||
|
||||
// 如果砍价完成,发送微信模板消息
|
||||
boolean isOut = false;
|
||||
if (storeBargain.getPeopleNum().equals(helpCount.intValue() + 1)) {
|
||||
// 发送微信模板消息
|
||||
// HashMap<String, String> temMap = new HashMap<>();
|
||||
// temMap.put(Constants.WE_CHAT_TEMP_KEY_FIRST, "好腻害!你的朋友们已经帮你砍到底价了!");
|
||||
// temMap.put("keyword1", storeBargain.getTitle());
|
||||
// temMap.put("keyword2", storeBargain.getMinPrice().toString());
|
||||
// temMap.put(Constants.WE_CHAT_TEMP_KEY_END, "感谢您的参与!");
|
||||
//
|
||||
// templateMessageService.push(Constants.WE_CHAT_TEMP_KEY_BARGAIN_SUCCESS, temMap, storeBargainUser.getUid(), Constants.PAY_TYPE_WE_CHAT_FROM_PUBLIC);
|
||||
|
||||
User tempUser = userService.getById(storeBargainUser.getUid());
|
||||
pushMessageOrder(storeBargain, tempUser);
|
||||
isOut = true;
|
||||
}
|
||||
|
||||
boolean finalIsOut = isOut;
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
LambdaUpdateWrapper<StoreBargainUser> updateWrapper = new LambdaUpdateWrapper<>();
|
||||
updateWrapper.set(StoreBargainUser::getPrice, storeBargainUser.getPrice().add(bargainPrice));
|
||||
if (finalIsOut) {
|
||||
updateWrapper.set(StoreBargainUser::getStatus, 3);
|
||||
}
|
||||
updateWrapper.eq(StoreBargainUser::getId, storeBargainUser.getId());
|
||||
updateWrapper.eq(StoreBargainUser::getPrice, storeBargainUser.getPrice());
|
||||
storeBargainUserService.update(updateWrapper);
|
||||
storeBargainUser.setPrice(storeBargainUser.getPrice().add(bargainPrice));
|
||||
|
||||
StoreBargainUserHelp userHelp = new StoreBargainUserHelp();
|
||||
userHelp.setBargainId(request.getBargainId());
|
||||
userHelp.setBargainUserId(storeBargainUser.getId());
|
||||
userHelp.setUid(user.getUid());
|
||||
userHelp.setPrice(bargainPrice);
|
||||
userHelp.setAddTime(System.currentTimeMillis());
|
||||
save(userHelp);
|
||||
|
||||
// 分享人数添加
|
||||
if (!user.getUid().equals(request.getBargainUserUid())) {
|
||||
storeBargain.setShare(storeBargain.getShare() + 1);
|
||||
storeBargainService.updateById(storeBargain);
|
||||
}
|
||||
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
|
||||
if (!execute) {
|
||||
throw new CrmebException("砍价失败!");
|
||||
}
|
||||
|
||||
try {
|
||||
// 如果砍价完成,发送微信模板消息
|
||||
if (isOut) {
|
||||
// 发送微信模板消息
|
||||
User tempUser = userService.getById(storeBargainUser.getUid());
|
||||
pushMessageOrder(storeBargain, tempUser);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
log.error("砍价成功发送微信消息失败:" + e.getMessage());
|
||||
}
|
||||
map.put("bargainPrice", bargainPrice);
|
||||
return map;
|
||||
}
|
||||
@@ -318,17 +249,11 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
* @param user 发起砍价用户
|
||||
*/
|
||||
private void pushMessageOrder(StoreBargain storeBargain, User user) {
|
||||
if (user.getUserType().equals(UserConstants.USER_TYPE_H5)) {
|
||||
return;
|
||||
}
|
||||
UserToken userToken;
|
||||
HashMap<String, String> temMap = new HashMap<>();
|
||||
// 公众号
|
||||
if (user.getUserType().equals(UserConstants.USER_TYPE_WECHAT)) {
|
||||
userToken = userTokenService.getTokenByUserId(user.getUid(), UserConstants.USER_TOKEN_TYPE_WECHAT);
|
||||
if (ObjectUtil.isNull(userToken)) {
|
||||
return ;
|
||||
}
|
||||
userToken = userTokenService.getTokenByUserId(user.getUid(), UserConstants.USER_TOKEN_TYPE_WECHAT);
|
||||
if (ObjectUtil.isNotNull(userToken)) {
|
||||
// 发送微信模板消息
|
||||
temMap.put(Constants.WE_CHAT_TEMP_KEY_FIRST, "好腻害!你的朋友们已经帮你砍到底价了!");
|
||||
temMap.put("keyword1", storeBargain.getTitle());
|
||||
@@ -349,47 +274,6 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
templateMessageService.pushMiniTemplateMessage(Constants.WE_CHAT_PROGRAM_TEMP_KEY_BARGAIN_SUCCESS, temMap, userToken.getToken());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参与砍价人员数量
|
||||
*/
|
||||
@Override
|
||||
public Long getHelpPeopleCount() {
|
||||
StoreBargainUser storeBargainUser = new StoreBargainUser();
|
||||
storeBargainUser.setIsDel(false);
|
||||
List<StoreBargainUser> userList = storeBargainUserService.getByEntity(storeBargainUser);
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
return 0L;
|
||||
}
|
||||
int sum = userList.stream().mapToInt(bargainUser -> {
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.select(StoreBargainUserHelp::getId);
|
||||
lqw.eq(StoreBargainUserHelp::getBargainUserId, bargainUser.getId());
|
||||
lqw.groupBy(StoreBargainUserHelp::getUid);
|
||||
return dao.selectCount(lqw);
|
||||
}).sum();
|
||||
return (long) sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取参与砍价人员数量
|
||||
* @param bargainId 砍价商品id
|
||||
*/
|
||||
@Override
|
||||
public Long getHelpPeopleCountByBargainId(Integer bargainId) {
|
||||
List<StoreBargainUser> userList = storeBargainUserService.getListByBargainId(bargainId);
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
return 0L;
|
||||
}
|
||||
int sum = userList.stream().mapToInt(bargainUser -> {
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.select(StoreBargainUserHelp::getId);
|
||||
lqw.eq(StoreBargainUserHelp::getBargainUserId, bargainUser.getId());
|
||||
lqw.groupBy(StoreBargainUserHelp::getUid);
|
||||
return dao.selectCount(lqw);
|
||||
}).sum();
|
||||
return (long) sum;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户还剩余的砍价金额
|
||||
* @param bargainId 砍价商品编号
|
||||
@@ -406,22 +290,61 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价发起用户信息
|
||||
* @param bargainFrontRequest 砍价公共请求参数
|
||||
* 获取参与砍价总人数(次)
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> startUser(BargainFrontRequest bargainFrontRequest) {
|
||||
if (ObjectUtil.isNull(bargainFrontRequest.getBargainUserUid())) {
|
||||
throw new CrmebException("砍价发起用户id不能为空");
|
||||
public Integer getCount() {
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.select(StoreBargainUserHelp::getId);
|
||||
return dao.selectCount(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取好友助力列表
|
||||
* @param bargainUserId 砍价用户表id
|
||||
* @return List<StoreBargainUserHelp>
|
||||
*/
|
||||
@Override
|
||||
public List<StoreBargainUserHelp> getHelpListByBargainUserId(Integer bargainUserId) {
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StoreBargainUserHelp::getBargainUserId, bargainUserId);
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否帮砍过
|
||||
* @param bargainUserId 用户砍价活动id
|
||||
* @param uid 用户uid
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public Boolean getIsHelp(Integer bargainUserId, Integer uid) {
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StoreBargainUserHelp::getBargainUserId, bargainUserId);
|
||||
lqw.eq(StoreBargainUserHelp::getUid, uid);
|
||||
StoreBargainUserHelp userHelp = dao.selectOne(lqw);
|
||||
if (ObjectUtil.isNull(userHelp)) {
|
||||
return Boolean.FALSE;
|
||||
}
|
||||
User user = userService.getById(bargainFrontRequest.getBargainUserUid());
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
return null;
|
||||
}
|
||||
Map<String, String> map = CollUtil.newHashMap();
|
||||
map.put("avatar", Optional.ofNullable(user.getAvatar()).orElse(""));
|
||||
map.put("nickname", Optional.ofNullable(user.getNickname()).orElse(""));
|
||||
return map;
|
||||
return Boolean.TRUE;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取该砍价商品用户的帮砍次数
|
||||
* @param bargainId 砍价商品id
|
||||
* @param uid 用户uid
|
||||
* @param bargainUserIdList 用户参与砍价活动id数组
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
public Integer getHelpCountByBargainIdAndUidInBUserId(Integer bargainId, Integer uid, List<Integer> bargainUserIdList) {
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.select(StoreBargainUserHelp::getId);
|
||||
lqw.eq(StoreBargainUserHelp::getBargainId, bargainId);
|
||||
lqw.eq(StoreBargainUserHelp::getUid, uid);
|
||||
lqw.notIn(StoreBargainUserHelp::getBargainUserId, bargainUserIdList);
|
||||
return dao.selectCount(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -444,7 +367,7 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
|
||||
BigDecimal subtract = price.subtract(minPrice);// 可砍价金额(总)
|
||||
|
||||
BigDecimal bargainPrice = ZERO;
|
||||
BigDecimal bargainPrice;
|
||||
double retainPrice;// 需要保留的金额
|
||||
// 没有砍过
|
||||
if (helpCount == 0) {
|
||||
@@ -491,9 +414,9 @@ public class StoreBargainUserHelpServiceImpl extends ServiceImpl<StoreBargainUse
|
||||
/**
|
||||
* 获取用户帮砍次数
|
||||
* 用户对商品砍了几次(不包含自己)
|
||||
* @param uid
|
||||
* @param bargainId
|
||||
* @return
|
||||
* @param uid 用户uid
|
||||
* @param bargainId 砍价商品id
|
||||
* @return Integer
|
||||
*/
|
||||
private Integer getUserHelpNum(Integer uid, Integer bargainId, List<Integer> tempUserIdList) {
|
||||
LambdaQueryWrapper<StoreBargainUserHelp> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
@@ -5,24 +5,33 @@ import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.CommonPage;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.BargainConstants;
|
||||
import com.constants.Constants;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.utils.CrmebUtil;
|
||||
import com.utils.DateUtil;
|
||||
import com.utils.vo.dateLimitUtilVo;
|
||||
import com.zbkj.crmeb.bargain.dao.StoreBargainUserDao;
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargain;
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargainUser;
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargainUserHelp;
|
||||
import com.zbkj.crmeb.bargain.request.StoreBargainUserSearchRequest;
|
||||
import com.zbkj.crmeb.bargain.response.StoreBargainUserResponse;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainService;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainUserHelpService;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainUserService;
|
||||
import com.zbkj.crmeb.front.request.BargainFrontRequest;
|
||||
import com.zbkj.crmeb.front.response.BargainRecordResponse;
|
||||
import com.zbkj.crmeb.front.response.BargainUserInfoResponse;
|
||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.store.service.StoreOrderService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
@@ -30,6 +39,8 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@@ -60,12 +71,14 @@ public class StoreBargainUserServiceImpl extends ServiceImpl<StoreBargainUserDao
|
||||
@Autowired
|
||||
private StoreBargainUserHelpService storeBargainUserHelpService;
|
||||
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页展示砍价参与用户列表
|
||||
* @param request 请求参数
|
||||
* @param pageParamRequest 分页类参数
|
||||
* @since 2020-11-12
|
||||
* @return List<StoreBargainUser>
|
||||
*/
|
||||
@Override
|
||||
@@ -111,7 +124,7 @@ public class StoreBargainUserServiceImpl extends ServiceImpl<StoreBargainUserDao
|
||||
/**
|
||||
* 获取砍价用户列表
|
||||
* @param bargainId 砍价商品ID
|
||||
* @return
|
||||
* @return List<StoreBargainUser>
|
||||
*/
|
||||
@Override
|
||||
public List<StoreBargainUser> getListByBargainId(Integer bargainId) {
|
||||
@@ -121,24 +134,11 @@ public class StoreBargainUserServiceImpl extends ServiceImpl<StoreBargainUserDao
|
||||
return dao.selectList(qw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取砍价商品参与人数
|
||||
* @param bargainId
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Long getCountByBargainId(Integer bargainId) {
|
||||
QueryWrapper<StoreBargainUser> qw = new QueryWrapper<>();
|
||||
qw.select("id");
|
||||
qw.eq("bargain_id", bargainId).eq("is_del", false);
|
||||
return dao.selectCount(qw).longValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过砍价商品ID + 用户uid 获取用户砍价商品信息
|
||||
* @param bargainId
|
||||
* @param uid
|
||||
* @return
|
||||
* @param bargainId 砍价商品编号
|
||||
* @param uid 参与用户uid
|
||||
* @return StoreBargainUser
|
||||
*/
|
||||
@Override
|
||||
public StoreBargainUser getByBargainIdAndUid(Integer bargainId, Integer uid) {
|
||||
@@ -156,9 +156,9 @@ public class StoreBargainUserServiceImpl extends ServiceImpl<StoreBargainUserDao
|
||||
|
||||
/**
|
||||
* 通过砍价商品ID + 用户uid 获取用户砍价中砍价商品信息
|
||||
* @param bargainId
|
||||
* @param uid
|
||||
* @return
|
||||
* @param bargainId 砍价商品编号
|
||||
* @param uid 参与用户uid
|
||||
* @return StoreBargainUser
|
||||
*/
|
||||
@Override
|
||||
public StoreBargainUser getByBargainIdAndUidAndPink(Integer bargainId, Integer uid) {
|
||||
@@ -177,9 +177,9 @@ public class StoreBargainUserServiceImpl extends ServiceImpl<StoreBargainUserDao
|
||||
|
||||
/**
|
||||
* 通过砍价商品ID + 用户uid 获取用户砍价中砍价商品信息
|
||||
* @param bargainId
|
||||
* @param uid
|
||||
* @return
|
||||
* @param bargainId 砍价商品编号
|
||||
* @param uid 参与用户uid
|
||||
* @return StoreBargainUser
|
||||
*/
|
||||
@Override
|
||||
public List<StoreBargainUser> getListByBargainIdAndUid(Integer bargainId, Integer uid) {
|
||||
@@ -190,36 +190,458 @@ public class StoreBargainUserServiceImpl extends ServiceImpl<StoreBargainUserDao
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断是否参与活动
|
||||
* @param bargainId
|
||||
* @param uid
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public Boolean isExistByBargainIdAndUid(Integer bargainId, Integer uid) {
|
||||
LambdaQueryWrapper<StoreBargainUser> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StoreBargainUser::getBargainId, bargainId);
|
||||
lqw.eq(StoreBargainUser::getUid, uid);
|
||||
lqw.eq(StoreBargainUser::getIsDel, false);
|
||||
Integer count = dao.selectCount(lqw);
|
||||
if (count > 0) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品用户根据实体查询
|
||||
* @param bargainUser
|
||||
* @return
|
||||
* @param bargainUser 砍价活动
|
||||
* @return List<StoreBargainUser>
|
||||
*/
|
||||
@Override
|
||||
public List<StoreBargainUser> getByEntity(StoreBargainUser bargainUser) {
|
||||
LambdaQueryWrapper<StoreBargainUser> lqw = new LambdaQueryWrapper<>();
|
||||
LambdaQueryWrapper<StoreBargainUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.setEntity(bargainUser);
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取砍价成功列表Header
|
||||
*/
|
||||
@Override
|
||||
public List<StoreBargainUser> getHeaderList() {
|
||||
LambdaQueryWrapper<StoreBargainUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StoreBargainUser::getStatus, 3);
|
||||
lqw.eq(StoreBargainUser::getIsDel, false);
|
||||
lqw.groupBy(StoreBargainUser::getUid);
|
||||
lqw.orderByDesc(StoreBargainUser::getId);
|
||||
lqw.last(" limit 10");
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户砍价信息
|
||||
* @param bargainFrontRequest 请求参数
|
||||
* @return BargainUserInfoResponse
|
||||
*/
|
||||
@Override
|
||||
public BargainUserInfoResponse getBargainUserInfo(BargainFrontRequest bargainFrontRequest) {
|
||||
if (ObjectUtil.isNull(bargainFrontRequest.getBargainUserId()) || bargainFrontRequest.getBargainUserId()<= 0) { // 获取自己的砍价信息
|
||||
return oneselfBargainActivity(bargainFrontRequest);
|
||||
}
|
||||
return otherBargainActivity(bargainFrontRequest);
|
||||
}
|
||||
|
||||
/**
|
||||
* 其他途径进入砍价活动
|
||||
* @param bargainFrontRequest 请求参数
|
||||
* @return BargainUserInfoResponse
|
||||
*/
|
||||
private BargainUserInfoResponse otherBargainActivity(BargainFrontRequest bargainFrontRequest) {
|
||||
User user = userService.getInfoException();
|
||||
// 获取砍价商品信息
|
||||
StoreBargain storeBargain = storeBargainService.getById(bargainFrontRequest.getBargainId());
|
||||
if (ObjectUtil.isNull(storeBargain) || storeBargain.getIsDel()) {
|
||||
throw new CrmebException("未找到对应砍价商品信息");
|
||||
}
|
||||
if (!storeBargain.getStatus()) {
|
||||
throw new CrmebException("砍价商品已下架");
|
||||
}
|
||||
if (storeBargain.getStock() <= 0 || storeBargain.getQuota() <= 0) {
|
||||
throw new CrmebException("砍价商品已售罄");
|
||||
}
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
if (storeBargain.getStopTime() < currentTimeMillis) {
|
||||
throw new CrmebException("活动已结束");
|
||||
}
|
||||
StoreBargainUser bargainUser = getById(bargainFrontRequest.getBargainUserId());
|
||||
if (ObjectUtil.isNull(bargainUser)) {
|
||||
throw new CrmebException("用户砍价活动未找到");
|
||||
}
|
||||
if (bargainUser.getIsDel()) {
|
||||
throw new CrmebException("用户砍价活动已取消");
|
||||
}
|
||||
if (bargainUser.getStatus().equals(2)) {
|
||||
throw new CrmebException("砍价活动已过期");
|
||||
}
|
||||
// 判断是否是自己的砍价活动
|
||||
BargainUserInfoResponse infoResponse = new BargainUserInfoResponse();
|
||||
int bargainStatus;// 砍价状态
|
||||
int percent;// 砍价百分比
|
||||
if (bargainUser.getUid().equals(user.getUid())) {// 自己的砍价活动
|
||||
if (bargainUser.getStatus().equals(3)) {// 砍价已完成
|
||||
// 判断是否生成订单
|
||||
StoreOrder bargainOrder = storeOrderService.getByBargainOrder(bargainUser.getBargainId(), bargainUser.getId());
|
||||
if (ObjectUtil.isNotNull(bargainOrder)) {// 有订单
|
||||
// 判断是否支付
|
||||
if (!bargainOrder.getPaid()) {// 未支付
|
||||
bargainStatus = 8;// 砍价已生成订单未支付
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = BigDecimal.ZERO;// 剩余金额
|
||||
percent = 100;
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(bargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(bargainUser.getId());
|
||||
return infoResponse;
|
||||
}
|
||||
// 已支付
|
||||
bargainStatus = 9;// 砍价订单已支付
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = BigDecimal.ZERO;// 剩余金额
|
||||
percent = 100;
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(bargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(bargainUser.getId());
|
||||
return infoResponse;
|
||||
}
|
||||
// 无订单
|
||||
bargainStatus = 4;// 砍价已完成
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = BigDecimal.ZERO;// 剩余金额
|
||||
percent = 100;
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(bargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(bargainUser.getId());
|
||||
return infoResponse;
|
||||
}
|
||||
bargainStatus = 3;// 砍价中
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = bargainUser.getBargainPrice().subtract(storeBargain.getMinPrice()).subtract(alreadyPrice);// 剩余金额
|
||||
percent = CrmebUtil.percentInstanceIntVal(alreadyPrice, alreadyPrice.add(surplusPrice));
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(bargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(bargainUser.getId());
|
||||
return infoResponse;
|
||||
}
|
||||
// 其他人的砍价活动
|
||||
if (bargainUser.getStatus().equals(3)) {
|
||||
bargainStatus = 4;// 砍价已完成
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = BigDecimal.ZERO;// 剩余金额
|
||||
percent = 100;
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(bargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(bargainUser.getId());
|
||||
User tempUser = userService.getById(bargainUser.getUid());
|
||||
infoResponse.setStoreBargainUserName(tempUser.getNickname());
|
||||
infoResponse.setStoreBargainUserAvatar(tempUser.getAvatar());
|
||||
return infoResponse;
|
||||
}
|
||||
// 是否帮ta砍过
|
||||
Boolean isHelp = storeBargainUserHelpService.getIsHelp(bargainUser.getId(), user.getUid());
|
||||
if (isHelp) { // 帮砍过
|
||||
bargainStatus = 6;// 已帮砍
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = bargainUser.getBargainPrice().subtract(storeBargain.getMinPrice()).subtract(alreadyPrice);// 剩余金额
|
||||
percent = CrmebUtil.percentInstanceIntVal(alreadyPrice, alreadyPrice.add(surplusPrice));
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(bargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(bargainUser.getId());
|
||||
User tempUser = userService.getById(bargainUser.getUid());
|
||||
infoResponse.setStoreBargainUserName(tempUser.getNickname());
|
||||
infoResponse.setStoreBargainUserAvatar(tempUser.getAvatar());
|
||||
return infoResponse;
|
||||
}
|
||||
// 获取该砍价商品用户的帮砍次数
|
||||
Integer helpNum = getHelpNumByBargainIdAndUid(bargainFrontRequest.getBargainId(), user.getUid());
|
||||
if (storeBargain.getBargainNum() <= helpNum) {
|
||||
bargainStatus = 7;// 帮砍次数已满
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = bargainUser.getBargainPrice().subtract(storeBargain.getMinPrice()).subtract(alreadyPrice);// 剩余金额
|
||||
percent = CrmebUtil.percentInstanceIntVal(alreadyPrice, alreadyPrice.add(surplusPrice));
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(bargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(bargainUser.getId());
|
||||
User tempUser = userService.getById(bargainUser.getUid());
|
||||
infoResponse.setStoreBargainUserName(tempUser.getNickname());
|
||||
infoResponse.setStoreBargainUserAvatar(tempUser.getAvatar());
|
||||
return infoResponse;
|
||||
}
|
||||
// 没有帮砍过
|
||||
bargainStatus = 5;// 可以帮砍
|
||||
BigDecimal alreadyPrice = bargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = bargainUser.getBargainPrice().subtract(storeBargain.getMinPrice()).subtract(alreadyPrice);// 剩余金额
|
||||
percent = CrmebUtil.percentInstanceIntVal(alreadyPrice, alreadyPrice.add(surplusPrice));
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(bargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(bargainUser.getId());
|
||||
User tempUser = userService.getById(bargainUser.getUid());
|
||||
infoResponse.setStoreBargainUserName(tempUser.getNickname());
|
||||
infoResponse.setStoreBargainUserAvatar(tempUser.getAvatar());
|
||||
return infoResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取好友助力列表
|
||||
* @param bargainUserId 砍价活动id
|
||||
* @return List<StoreBargainUserHelp>
|
||||
*/
|
||||
private List<StoreBargainUserHelp> getHelpList(Integer bargainUserId) {
|
||||
List<StoreBargainUserHelp> helpList = storeBargainUserHelpService.getHelpListByBargainUserId(bargainUserId);
|
||||
helpList.forEach(e -> {
|
||||
User helpUser = userService.getById(e.getUid());
|
||||
e.setNickname(helpUser.getNickname());
|
||||
e.setAvatar(helpUser.getAvatar());
|
||||
e.setAddTimeStr(cn.hutool.core.date.DateUtil.date(e.getAddTime()).toString());
|
||||
});
|
||||
return helpList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 自己的砍价活动
|
||||
* @param bargainFrontRequest 请求参数
|
||||
* @return BargainUserInfoResponse
|
||||
*/
|
||||
private BargainUserInfoResponse oneselfBargainActivity(BargainFrontRequest bargainFrontRequest) {
|
||||
User user = userService.getInfoException();
|
||||
// 获取砍价商品信息
|
||||
StoreBargain storeBargain = storeBargainService.getById(bargainFrontRequest.getBargainId());
|
||||
if (ObjectUtil.isNull(storeBargain) || storeBargain.getIsDel()) {
|
||||
throw new CrmebException("未找到对应砍价商品信息");
|
||||
}
|
||||
if (!storeBargain.getStatus()) {
|
||||
throw new CrmebException("砍价商品已下架");
|
||||
}
|
||||
if (storeBargain.getStock() <= 0 || storeBargain.getQuota() <= 0) {
|
||||
throw new CrmebException("砍价商品已售罄");
|
||||
}
|
||||
long currentTimeMillis = System.currentTimeMillis();
|
||||
if (storeBargain.getStopTime() < currentTimeMillis) {
|
||||
throw new CrmebException("活动已结束");
|
||||
}
|
||||
|
||||
BargainUserInfoResponse infoResponse = new BargainUserInfoResponse();
|
||||
// 查看是否有正在砍价的信息
|
||||
StoreBargainUser storeBargainUser = getLastByIdAndUid(bargainFrontRequest.getBargainId(), user.getUid());
|
||||
int percent = 0;// 砍价百分比
|
||||
int bargainStatus = 1;// 砍价状态:1-可以参与砍价
|
||||
if (ObjectUtil.isNull(storeBargainUser)) {// 没有参与该商品的砍价活动
|
||||
BigDecimal alreadyPrice = BigDecimal.ZERO;// 已砍金额
|
||||
BigDecimal surplusPrice = storeBargain.getPrice().subtract(storeBargain.getMinPrice());// 剩余金额
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
return infoResponse;
|
||||
}
|
||||
if (storeBargainUser.getStatus().equals(2)) {// 活动结束,砍价未完成
|
||||
throw new CrmebException("未在活动期内完成砍价");
|
||||
}
|
||||
// 参与过该商品的砍价
|
||||
if (storeBargainUser.getIsDel()) { // 已取消
|
||||
// 获取用户参与过的次数
|
||||
Integer bargainCount = getCountByBargainIdAndUid(bargainFrontRequest.getBargainId(), user.getUid());
|
||||
if (storeBargain.getNum() >= bargainCount) {
|
||||
bargainStatus = 2;// 参与次数已满
|
||||
BigDecimal alreadyPrice = BigDecimal.ZERO;// 已砍金额
|
||||
BigDecimal surplusPrice = storeBargain.getPrice().subtract(storeBargain.getMinPrice());// 剩余金额
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
return infoResponse;
|
||||
}
|
||||
// 还可以参与
|
||||
BigDecimal alreadyPrice = BigDecimal.ZERO;// 已砍金额
|
||||
BigDecimal surplusPrice = storeBargain.getPrice().subtract(storeBargain.getMinPrice());// 剩余金额
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
return infoResponse;
|
||||
}
|
||||
if (storeBargainUser.getStatus().equals(3)) {// 砍价已完成
|
||||
// 判断是否生成订单
|
||||
StoreOrder bargainOrder = storeOrderService.getByBargainOrder(storeBargainUser.getBargainId(), storeBargainUser.getId());
|
||||
if (ObjectUtil.isNotNull(bargainOrder)) {// 有订单
|
||||
// 判断是否支付
|
||||
if (!bargainOrder.getPaid()) {// 未支付
|
||||
bargainStatus = 8;// 砍价已生成订单未支付
|
||||
BigDecimal alreadyPrice = storeBargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = BigDecimal.ZERO;// 剩余金额
|
||||
percent = 100;
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(storeBargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(storeBargainUser.getId());
|
||||
return infoResponse;
|
||||
}
|
||||
// 已支付,看起新的活动
|
||||
// 获取用户参与过的次数
|
||||
Integer bargainCount = getCountByBargainIdAndUid(bargainFrontRequest.getBargainId(), user.getUid());
|
||||
if (storeBargain.getNum() <= bargainCount) {
|
||||
bargainStatus = 2;// 参与次数已满
|
||||
BigDecimal alreadyPrice = BigDecimal.ZERO;// 已砍金额
|
||||
BigDecimal surplusPrice = storeBargain.getPrice().subtract(storeBargain.getMinPrice());// 剩余金额
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
return infoResponse;
|
||||
}
|
||||
// 还可以参与
|
||||
BigDecimal alreadyPrice = BigDecimal.ZERO;// 已砍金额
|
||||
BigDecimal surplusPrice = storeBargain.getPrice().subtract(storeBargain.getMinPrice());// 剩余金额
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
return infoResponse;
|
||||
}
|
||||
// 没有订单
|
||||
bargainStatus = 4;// 砍价已完成
|
||||
BigDecimal alreadyPrice = storeBargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = BigDecimal.ZERO;// 剩余金额
|
||||
percent = 100;
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(storeBargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(storeBargainUser.getId());
|
||||
return infoResponse;
|
||||
}
|
||||
// 有尚未砍完的活动
|
||||
bargainStatus = 3;// 砍价中
|
||||
BigDecimal alreadyPrice = storeBargainUser.getPrice();// 已砍金额
|
||||
BigDecimal surplusPrice = storeBargainUser.getBargainPrice().subtract(storeBargain.getMinPrice()).subtract(alreadyPrice);// 剩余金额
|
||||
percent = CrmebUtil.percentInstanceIntVal(alreadyPrice, alreadyPrice.add(surplusPrice));
|
||||
infoResponse.setBargainStatus(bargainStatus);
|
||||
infoResponse.setAlreadyPrice(alreadyPrice);
|
||||
infoResponse.setSurplusPrice(surplusPrice);
|
||||
infoResponse.setBargainPercent(percent);
|
||||
// 获取好友助力列表
|
||||
infoResponse.setUserHelpList(getHelpList(storeBargainUser.getId()));
|
||||
infoResponse.setStoreBargainUserId(storeBargainUser.getId());
|
||||
return infoResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最后一条砍价信息
|
||||
* @return StoreBargainUser
|
||||
*/
|
||||
private StoreBargainUser getLastByIdAndUid(Integer id, Integer uid) {
|
||||
LambdaQueryWrapper<StoreBargainUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StoreBargainUser::getBargainId, id);
|
||||
lqw.eq(StoreBargainUser::getUid, uid);
|
||||
lqw.orderByDesc(StoreBargainUser::getId);
|
||||
lqw.last(" limit 1");
|
||||
return dao.selectOne(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价记录
|
||||
* @return PageInfo<BargainRecordResponse>
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<BargainRecordResponse> getRecordList(PageParamRequest pageParamRequest) {
|
||||
Integer userId = userService.getUserIdException();
|
||||
Page<Object> startPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<StoreBargainUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StoreBargainUser::getUid, userId);
|
||||
lqw.orderByDesc(StoreBargainUser::getId);
|
||||
List<StoreBargainUser> bargainUserList = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(bargainUserList)) {
|
||||
return new PageInfo<>();
|
||||
}
|
||||
List<Integer> bargainIdList = bargainUserList.stream().map(StoreBargainUser::getBargainId).distinct().collect(Collectors.toList());
|
||||
HashMap<Integer, StoreBargain> bargainMap = storeBargainService.getMapInId(bargainIdList);
|
||||
List<BargainRecordResponse> responseList = bargainUserList.stream().map(e -> {
|
||||
BargainRecordResponse recordResponse = new BargainRecordResponse();
|
||||
StoreBargain storeBargain = bargainMap.get(e.getBargainId());
|
||||
BeanUtils.copyProperties(storeBargain, recordResponse);
|
||||
recordResponse.setBargainUserId(e.getId());
|
||||
recordResponse.setStatus(e.getStatus());
|
||||
recordResponse.setIsDel(e.getIsDel());
|
||||
recordResponse.setIsOrder(false);
|
||||
recordResponse.setIsPay(false);
|
||||
if (!e.getIsDel() && e.getStatus().equals(3)) {
|
||||
// 查询是否有订单
|
||||
StoreOrder bargainOrder = storeOrderService.getByBargainOrder(e.getBargainId(), e.getId());
|
||||
if (ObjectUtil.isNotNull(bargainOrder)) {
|
||||
recordResponse.setIsOrder(true);
|
||||
if (bargainOrder.getIsDel()) {
|
||||
recordResponse.setIsDel(true);
|
||||
} else if (bargainOrder.getPaid()) {
|
||||
recordResponse.setIsPay(true);
|
||||
} else {
|
||||
recordResponse.setOrderNo(bargainOrder.getOrderId());
|
||||
}
|
||||
}
|
||||
}
|
||||
// 剩余金额
|
||||
BigDecimal surplusPrice;
|
||||
if (e.getStatus().equals(3)) {
|
||||
surplusPrice = e.getBargainPriceMin();
|
||||
} else {
|
||||
surplusPrice = e.getBargainPriceMin().add(e.getBargainPrice()).subtract(e.getPrice());
|
||||
}
|
||||
recordResponse.setSurplusPrice(surplusPrice);
|
||||
return recordResponse;
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return CommonPage.copyPageInfo(startPage, responseList);
|
||||
}
|
||||
|
||||
private Integer getHelpNumByBargainIdAndUid(Integer bargainId, Integer uid) {
|
||||
// 查看是否有正在砍价的信息
|
||||
LambdaQueryWrapper<StoreBargainUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.select(StoreBargainUser::getId);
|
||||
lqw.eq(StoreBargainUser::getBargainId, bargainId);
|
||||
lqw.eq(StoreBargainUser::getUid, uid);
|
||||
List<StoreBargainUser> bargainUserList = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(bargainUserList)) {
|
||||
return 0;
|
||||
}
|
||||
List<Integer> bargainUserIdList = bargainUserList.stream().map(StoreBargainUser::getId).collect(Collectors.toList());
|
||||
return storeBargainUserHelpService.getHelpCountByBargainIdAndUidInBUserId(bargainId, uid, bargainUserIdList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户参与砍价活动的次数(成功)
|
||||
* @param bargainId 砍价商品id
|
||||
* @param uid 用户uid
|
||||
* @return 用户参与砍价活动的次数(成功)
|
||||
*/
|
||||
private Integer getCountByBargainIdAndUid(Integer bargainId, Integer uid) {
|
||||
LambdaQueryWrapper<StoreBargainUser> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(StoreBargainUser::getBargainId, bargainId);
|
||||
lqw.eq(StoreBargainUser::getUid, uid);
|
||||
lqw.eq(StoreBargainUser::getIsDel, false);
|
||||
lqw.eq(StoreBargainUser::getStatus, 3);
|
||||
return dao.selectCount(lqw);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -16,6 +16,7 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.*;
|
||||
|
||||
@@ -52,4 +52,10 @@ public interface CategoryService extends IService<Category> {
|
||||
* 新增分类表
|
||||
*/
|
||||
Boolean create(CategoryRequest categoryRequest);
|
||||
|
||||
/**
|
||||
* 获取文章分类列表
|
||||
* @return List<Category>
|
||||
*/
|
||||
List<Category> findArticleCategoryList();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.CategoryConstants;
|
||||
import com.constants.Constants;
|
||||
import com.exception.CrmebException;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.utils.CrmebUtil;
|
||||
@@ -409,5 +410,20 @@ public class CategoryServiceImpl extends ServiceImpl<CategoryDao, Category> impl
|
||||
category.setExtra(systemAttachmentService.clearPrefix(category.getExtra()));
|
||||
return save(category);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取文章分类列表
|
||||
* @return List<Category>
|
||||
*/
|
||||
@Override
|
||||
public List<Category> findArticleCategoryList() {
|
||||
LambdaQueryWrapper<Category> lambdaQueryWrapper = Wrappers.lambdaQuery();
|
||||
lambdaQueryWrapper.select(Category::getId, Category::getName);
|
||||
lambdaQueryWrapper.eq(Category::getType, Constants.CATEGORY_TYPE_ARTICLE);
|
||||
lambdaQueryWrapper.eq(Category::getStatus, true);
|
||||
lambdaQueryWrapper.orderByDesc(Category::getSort);
|
||||
lambdaQueryWrapper.orderByAsc(Category::getId);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package com.zbkj.crmeb.combination.model;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableName;
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
@@ -139,4 +141,8 @@ public class StoreCombination implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "虚拟成团百分比")
|
||||
private Integer virtualRation;
|
||||
|
||||
@ApiModelProperty(value = "限量百分比")
|
||||
@TableField(exist = false)
|
||||
private Integer quotaPercent;
|
||||
}
|
||||
|
||||
@@ -8,12 +8,9 @@ import com.zbkj.crmeb.combination.request.StoreCombinationRequest;
|
||||
import com.zbkj.crmeb.combination.request.StoreCombinationSearchRequest;
|
||||
import com.zbkj.crmeb.combination.request.StorePinkRequest;
|
||||
import com.zbkj.crmeb.combination.response.StoreCombinationResponse;
|
||||
import com.zbkj.crmeb.front.response.CombinationDetailResponse;
|
||||
import com.zbkj.crmeb.front.response.GoPinkResponse;
|
||||
import com.zbkj.crmeb.store.model.StoreOrder;
|
||||
import com.zbkj.crmeb.front.response.*;
|
||||
import com.zbkj.crmeb.store.request.StoreProductStockRequest;
|
||||
import com.zbkj.crmeb.store.response.StoreProductResponse;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -72,7 +69,7 @@ public interface StoreCombinationService extends IService<StoreCombination> {
|
||||
/**
|
||||
* H5拼团商品列表
|
||||
*/
|
||||
PageInfo<StoreCombination> getH5List(PageParamRequest pageParamRequest);
|
||||
List<StoreCombinationH5Response> getH5List(PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* H5拼团商品详情
|
||||
@@ -101,16 +98,6 @@ public interface StoreCombinationService extends IService<StoreCombination> {
|
||||
*/
|
||||
List<StoreCombination> getByEntity(StoreCombination storeCombination);
|
||||
|
||||
/**
|
||||
* 扣减库存加销量
|
||||
* @param num 商品数量
|
||||
* @param attrValueId 拼团商品规格
|
||||
* @param productId 主商品id
|
||||
* @param user 购买用户
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean decProductStock(StoreOrder storeOrder, Integer num, Integer attrValueId, Integer productId, User user);
|
||||
|
||||
/**
|
||||
* 添加库存
|
||||
*/
|
||||
@@ -146,4 +133,16 @@ public interface StoreCombinationService extends IService<StoreCombination> {
|
||||
* @param type 类型:add—添加,sub—扣减
|
||||
*/
|
||||
Boolean operationStock(Integer id, Integer num, String type);
|
||||
|
||||
/**
|
||||
* 拼团首页数据
|
||||
* @return CombinationIndexResponse
|
||||
*/
|
||||
CombinationIndexResponse getIndexInfo();
|
||||
|
||||
/**
|
||||
* 拼团列表header
|
||||
* @return CombinationHeaderResponse
|
||||
*/
|
||||
CombinationHeaderResponse getHeader();
|
||||
}
|
||||
@@ -85,4 +85,22 @@ public interface StorePinkService extends IService<StorePink> {
|
||||
* @return
|
||||
*/
|
||||
StorePink getByOrderId(String orderId);
|
||||
|
||||
/**
|
||||
* 获取最后3个拼团信息(不同用户)
|
||||
* @return List
|
||||
*/
|
||||
List<StorePink> findSizePink(Integer size);
|
||||
|
||||
/**
|
||||
* 获取拼团参与总人数
|
||||
* @return Integer
|
||||
*/
|
||||
Integer getTotalPeople();
|
||||
|
||||
/**
|
||||
* 获取拼团详情
|
||||
* @return StorePink
|
||||
*/
|
||||
StorePink getByUidAndKid(Integer uid, Integer kid);
|
||||
}
|
||||
@@ -1,14 +1,13 @@
|
||||
package com.zbkj.crmeb.combination.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.parser.Feature;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.CommonPage;
|
||||
import com.common.PageParamRequest;
|
||||
@@ -17,6 +16,7 @@ import com.exception.CrmebException;
|
||||
import com.github.pagehelper.Page;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.utils.CrmebUtil;
|
||||
import com.utils.DateUtil;
|
||||
import com.utils.RedisUtil;
|
||||
import com.zbkj.crmeb.combination.dao.StoreCombinationDao;
|
||||
@@ -25,14 +25,12 @@ import com.zbkj.crmeb.combination.model.StorePink;
|
||||
import com.zbkj.crmeb.combination.request.StoreCombinationRequest;
|
||||
import com.zbkj.crmeb.combination.request.StoreCombinationSearchRequest;
|
||||
import com.zbkj.crmeb.combination.request.StorePinkRequest;
|
||||
import com.zbkj.crmeb.combination.response.StoreCombinationInfoResponse;
|
||||
import com.zbkj.crmeb.combination.response.StoreCombinationResponse;
|
||||
import com.zbkj.crmeb.combination.response.StorePinkResponse;
|
||||
import com.zbkj.crmeb.combination.service.StoreCombinationService;
|
||||
import com.zbkj.crmeb.combination.service.StorePinkService;
|
||||
import com.zbkj.crmeb.front.request.OrderRefundApplyRequest;
|
||||
import com.zbkj.crmeb.front.response.CombinationDetailResponse;
|
||||
import com.zbkj.crmeb.front.response.GoPinkResponse;
|
||||
import com.zbkj.crmeb.front.response.*;
|
||||
import com.zbkj.crmeb.front.service.OrderService;
|
||||
import com.zbkj.crmeb.store.model.*;
|
||||
import com.zbkj.crmeb.store.request.StoreProductAttrValueRequest;
|
||||
@@ -42,6 +40,7 @@ import com.zbkj.crmeb.store.response.StoreProductResponse;
|
||||
import com.zbkj.crmeb.store.service.*;
|
||||
import com.zbkj.crmeb.store.utilService.ProductUtils;
|
||||
import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
||||
import com.zbkj.crmeb.system.service.SystemGroupDataService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -97,9 +96,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
@Autowired
|
||||
private StoreProductDescriptionService storeProductDescriptionService;
|
||||
|
||||
@Autowired
|
||||
private StoreProductReplyService storeProductReplyService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@@ -119,7 +115,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
private RedisUtil redisUtil;
|
||||
|
||||
@Autowired
|
||||
private TransactionTemplate transactionTemplate;
|
||||
private SystemGroupDataService systemGroupDataService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(StoreCombinationServiceImpl.class);
|
||||
|
||||
@@ -129,8 +125,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
* @param request 请求参数
|
||||
* @param pageParamRequest 分页类参数
|
||||
* @return List<StoreCombination>
|
||||
* @author HZW
|
||||
* @since 2020-11-13
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<StoreCombinationResponse> getList(StoreCombinationSearchRequest request, PageParamRequest pageParamRequest) {
|
||||
@@ -177,8 +171,8 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
/**
|
||||
* 新增拼团商品
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
* @param request 新增请求参数
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -312,8 +306,8 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
/**
|
||||
* 编辑拼团商品
|
||||
*
|
||||
* @param request
|
||||
* @return
|
||||
* @param request 编辑请求参数
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
@@ -432,10 +426,14 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
|
||||
boolean specType = false;
|
||||
StoreProductAttr proPram = new StoreProductAttr();
|
||||
spaPram.setProductId(id).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
proPram.setProductId(storeCombination.getProductId()).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
List<StoreProductAttr> proAttrs = storeProductAttrService.getByEntity(proPram);
|
||||
if (proAttrs.size() > 1) {
|
||||
specType = true;
|
||||
} else if (proAttrs.size() == 1) {
|
||||
if (!proAttrs.get(0).getAttrValues().equals("默认")) {
|
||||
specType = true;
|
||||
}
|
||||
}
|
||||
storeProductResponse.setSpecType(specType);
|
||||
|
||||
@@ -536,10 +534,11 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
* H5拼团商品列表
|
||||
*/
|
||||
@Override
|
||||
public PageInfo<StoreCombination> getH5List(PageParamRequest pageParamRequest) {
|
||||
Page<StoreCombination> combinationPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
|
||||
LambdaQueryWrapper<StoreCombination> lqw = new LambdaQueryWrapper<>();
|
||||
public List<StoreCombinationH5Response> getH5List(PageParamRequest pageParamRequest) {
|
||||
PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<StoreCombination> lqw = Wrappers.lambdaQuery();
|
||||
lqw.select(StoreCombination::getId ,StoreCombination::getProductId ,StoreCombination::getImage ,StoreCombination::getTitle
|
||||
,StoreCombination::getPeople ,StoreCombination::getOtPrice ,StoreCombination::getPrice ,StoreCombination::getStock);
|
||||
lqw.eq(StoreCombination::getIsDel, false);
|
||||
lqw.eq(StoreCombination::getIsShow, true);
|
||||
long millis = System.currentTimeMillis();
|
||||
@@ -548,54 +547,95 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
lqw.orderByDesc(StoreCombination::getSort, StoreCombination::getId);
|
||||
List<StoreCombination> combinationList = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(combinationList)) {
|
||||
return CommonPage.copyPageInfo(combinationPage, CollUtil.newArrayList());
|
||||
return CollUtil.newArrayList();
|
||||
}
|
||||
return CommonPage.copyPageInfo(combinationPage, combinationList);
|
||||
List<StoreCombinationH5Response> responseList = combinationList.stream().map(e -> {
|
||||
StoreCombinationH5Response response = new StoreCombinationH5Response();
|
||||
BeanUtils.copyProperties(e, response);
|
||||
return response;
|
||||
}).collect(Collectors.toList());
|
||||
return responseList;
|
||||
}
|
||||
|
||||
/**
|
||||
* H5拼团商品详情
|
||||
*
|
||||
* @param comId 拼团商品编号
|
||||
* pindAll 拼团团长ID列表
|
||||
* pink 拼团列表(团长列表)
|
||||
* pink_ok_list 拼团列表(成功拼团团长列表)
|
||||
* pink_ok_sum 拼团完成的商品总件数
|
||||
* reply 评论列表
|
||||
* replyChance 好评率
|
||||
* replyCount 评论数量
|
||||
* @return CombinationDetailResponse
|
||||
*/
|
||||
@Override
|
||||
public CombinationDetailResponse getH5Detail(Integer comId) {
|
||||
CombinationDetailResponse detailResponse = new CombinationDetailResponse();
|
||||
StoreCombination storeCombination = getById(comId);
|
||||
if (ObjectUtil.isNull(storeCombination) || storeCombination.getIsDel()) {
|
||||
throw new CrmebException("对应拼团商品不存在");
|
||||
}
|
||||
StoreCombinationInfoResponse infoResponse = new StoreCombinationInfoResponse();
|
||||
BeanUtils.copyProperties(storeCombination, infoResponse);
|
||||
// 设置点赞和收藏
|
||||
User user = userService.getInfo();
|
||||
if (ObjectUtil.isNotNull(user) && ObjectUtil.isNotNull(user.getUid())) {
|
||||
infoResponse.setUserLike(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), storeCombination.getProductId(), true).size() > 0);
|
||||
infoResponse.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), storeCombination.getProductId(), false).size() > 0);
|
||||
} else {
|
||||
infoResponse.setUserLike(false);
|
||||
infoResponse.setUserCollect(false);
|
||||
if (!storeCombination.getIsShow()) {
|
||||
throw new CrmebException("拼团商品已下架");
|
||||
}
|
||||
StoreProduct product = storeProductService.getById(storeCombination.getProductId());
|
||||
infoResponse.setProductPrice(product.getPrice());
|
||||
infoResponse.setTotal(product.getSales() + product.getFicti());
|
||||
CombinationDetailH5Response infoResponse = new CombinationDetailH5Response();
|
||||
BeanUtils.copyProperties(storeCombination, infoResponse);
|
||||
infoResponse.setStoreName(storeCombination.getTitle());
|
||||
infoResponse.setSliderImage(storeCombination.getImages());
|
||||
infoResponse.setStoreInfo(storeCombination.getInfo());
|
||||
// 详情
|
||||
StoreProductDescription sd = storeProductDescriptionService.getOne(
|
||||
new LambdaQueryWrapper<StoreProductDescription>()
|
||||
.eq(StoreProductDescription::getProductId, comId)
|
||||
.eq(StoreProductDescription::getType, Constants.PRODUCT_TYPE_PINGTUAN));
|
||||
if (null != sd) {
|
||||
infoResponse.setContent(null == sd.getDescription() ? "" : sd.getDescription());
|
||||
if (ObjectUtil.isNotNull(sd)) {
|
||||
infoResponse.setContent(ObjectUtil.isNull(sd.getDescription()) ? "" : sd.getDescription());
|
||||
}
|
||||
|
||||
// 获取主商品信息
|
||||
StoreProduct storeProduct = storeProductService.getById(storeCombination.getProductId());
|
||||
// 拼团销量 = 原商品销量(包含虚拟销量)
|
||||
infoResponse.setSales(storeProduct.getSales());
|
||||
infoResponse.setFicti(storeProduct.getFicti());
|
||||
detailResponse.setStoreCombination(infoResponse);
|
||||
|
||||
// 获取拼团商品规格
|
||||
StoreProductAttr spaPram = new StoreProductAttr();
|
||||
spaPram.setProductId(comId).setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
List<StoreProductAttr> attrList = storeProductAttrService.getByEntity(spaPram);
|
||||
// 根据制式设置attr属性
|
||||
List<ProductAttrResponse> skuAttr = getSkuAttr(attrList);
|
||||
detailResponse.setProductAttr(skuAttr);
|
||||
|
||||
// 根据制式设置sku属性
|
||||
HashMap<String, Object> skuMap = CollUtil.newHashMap();
|
||||
// 获取主商品sku
|
||||
StoreProductAttrValue spavPram = new StoreProductAttrValue();
|
||||
spavPram.setProductId(storeCombination.getProductId()).setType(Constants.PRODUCT_TYPE_NORMAL);
|
||||
List<StoreProductAttrValue> storeProductAttrValues = storeProductAttrValueService.getByEntity(spavPram);
|
||||
// 获取拼团商品sku
|
||||
StoreProductAttrValue spavPram1 = new StoreProductAttrValue();
|
||||
spavPram1.setProductId(storeCombination.getId()).setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
List<StoreProductAttrValue> combinationAttrValues = storeProductAttrValueService.getByEntity(spavPram1);
|
||||
|
||||
for (StoreProductAttrValue productAttrValue : storeProductAttrValues) {
|
||||
StoreProductAttrValueResponse atr = new StoreProductAttrValueResponse();
|
||||
List<StoreProductAttrValue> valueList = combinationAttrValues.stream().filter(e -> productAttrValue.getSuk().equals(e.getSuk())).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(valueList)) {
|
||||
BeanUtils.copyProperties(productAttrValue, atr);
|
||||
} else {
|
||||
BeanUtils.copyProperties(valueList.get(0), atr);
|
||||
}
|
||||
if (ObjectUtil.isNull(atr.getQuota())) {
|
||||
atr.setQuota(0);
|
||||
}
|
||||
skuMap.put(atr.getSuk(), atr);
|
||||
}
|
||||
detailResponse.setProductValue(skuMap);
|
||||
|
||||
// 设置点赞和收藏
|
||||
User user = userService.getInfo();
|
||||
if (ObjectUtil.isNotNull(user) && ObjectUtil.isNotNull(user.getUid())) {
|
||||
detailResponse.setUserCollect(storeProductRelationService.getLikeOrCollectByUser(user.getUid(), storeCombination.getProductId(), false).size() > 0);
|
||||
} else {
|
||||
detailResponse.setUserCollect(false);
|
||||
}
|
||||
|
||||
CombinationDetailResponse detailResponse = new CombinationDetailResponse();
|
||||
detailResponse.setStoreInfo(infoResponse);
|
||||
detailResponse.setPinkOkSum(0);
|
||||
// 拼团团长列表
|
||||
List<StorePink> headList = storePinkService.getListByCidAndKid(storeCombination.getId(), 0);
|
||||
@@ -612,7 +652,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
// 拼团成功部分
|
||||
List<StorePinkResponse> okList = headPinkList.stream().filter(i -> i.getStatus().equals(2)).collect(Collectors.toList());
|
||||
if (ObjectUtil.isNotEmpty(okList)) {
|
||||
//拼团完成的商品总件数
|
||||
// 拼团完成的商品总件数
|
||||
List<StorePink> pinkOkList = CollUtil.newArrayList();
|
||||
okList.forEach(e -> {
|
||||
List<StorePink> list = storePinkService.getListByCidAndKid(e.getCid(), e.getId());
|
||||
@@ -643,8 +683,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
}
|
||||
return filter;
|
||||
}).collect(Collectors.toList());
|
||||
// 拼团团长ID列表
|
||||
List<Integer> pindAll = pinkingList.stream().map(StorePinkResponse::getId).collect(Collectors.toList());
|
||||
// 获取还剩几人成团
|
||||
pinkingList.forEach(i -> {
|
||||
Integer countPeople = storePinkService.getCountByKid(i.getId());
|
||||
@@ -652,69 +690,40 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
i.setCount(i.getPeople() - countPeople);
|
||||
});
|
||||
|
||||
detailResponse.setPindAll(pindAll);
|
||||
|
||||
// 所有团长列表
|
||||
detailResponse.setPink(pinkingList);
|
||||
detailResponse.setPinkList(pinkingList);
|
||||
}
|
||||
|
||||
// 评论部分
|
||||
Integer replyChance = 100;
|
||||
Integer replyCount = 0;
|
||||
// 获取商品所有评论列表
|
||||
List<StoreProductReply> replyList = storeProductReplyService.getAllByPidAndType(storeCombination.getProductId(), Constants.STORE_REPLY_TYPE_PINTUAN);
|
||||
if (CollUtil.isNotEmpty(replyList)) {
|
||||
replyCount = replyList.size();
|
||||
// 好评列表
|
||||
List<StoreProductReply> goodReplyList = replyList.stream().filter(i -> i.getProductScore().equals(4) || i.getProductScore().equals(5)).collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(goodReplyList)) {
|
||||
replyChance = 0;
|
||||
} else {
|
||||
replyChance = (goodReplyList.size() / replyCount) * 100;
|
||||
}
|
||||
}
|
||||
detailResponse.setReply(replyList);
|
||||
detailResponse.setReplyChance(replyChance);
|
||||
detailResponse.setReplyCount(replyCount);
|
||||
|
||||
// sku部分
|
||||
detailResponse.setSpecType(false);
|
||||
StoreProductAttr spavAttr = new StoreProductAttr();
|
||||
spavAttr.setProductId(storeCombination.getId());
|
||||
spavAttr.setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
List<StoreProductAttr> attrList = storeProductAttrService.getByEntity(spavAttr);
|
||||
setSkuAttr(attrList, detailResponse);
|
||||
if (CollUtil.isNotEmpty(attrList) && attrList.size() > 1) {
|
||||
detailResponse.setSpecType(true);
|
||||
}
|
||||
|
||||
// 单属性时讲attrValueId 赋值给外层方便前端使用
|
||||
if (!detailResponse.getSpecType()) {
|
||||
detailResponse.setAloneAttrValueId(attrList.get(0).getId());
|
||||
}
|
||||
|
||||
StoreProductAttrValue spavValue = new StoreProductAttrValue();
|
||||
spavValue.setProductId(storeCombination.getId());
|
||||
spavValue.setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
List<StoreProductAttrValue> valueList = storeProductAttrValueService.getByEntity(spavValue);
|
||||
|
||||
// H5 端用于生成skuList
|
||||
List<StoreProductAttrValueResponse> sPAVResponses = new ArrayList<>();
|
||||
|
||||
for (StoreProductAttrValue storeProductAttrValue : valueList) {
|
||||
StoreProductAttrValueResponse atr = new StoreProductAttrValueResponse();
|
||||
BeanUtils.copyProperties(storeProductAttrValue, atr);
|
||||
sPAVResponses.add(atr);
|
||||
}
|
||||
HashMap<String, Object> skuMap = new HashMap<>();
|
||||
for (StoreProductAttrValueResponse attrValue : sPAVResponses) {
|
||||
skuMap.put(attrValue.getSuk(), attrValue);
|
||||
}
|
||||
detailResponse.setProductValue(skuMap);
|
||||
|
||||
return detailResponse;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取秒杀规格(公共转换)
|
||||
* @param attrList 秒杀规格列表
|
||||
* @return List<ProductAttrResponse>
|
||||
*/
|
||||
private List<ProductAttrResponse> getSkuAttr(List<StoreProductAttr> attrList) {
|
||||
List<ProductAttrResponse> attrResponseList = new ArrayList<>();
|
||||
for (StoreProductAttr attr : attrList) {
|
||||
ProductAttrResponse attrResponse = new ProductAttrResponse();
|
||||
attrResponse.setProductId(attr.getProductId());
|
||||
attrResponse.setAttrName(attr.getAttrName());
|
||||
attrResponse.setType(attr.getType());
|
||||
List<String> attrValues = new ArrayList<>();
|
||||
String trimAttr = attr.getAttrValues()
|
||||
.replace("[","")
|
||||
.replace("]","");
|
||||
if(attr.getAttrValues().contains(",")){
|
||||
attrValues = Arrays.asList(trimAttr.split(","));
|
||||
}else{
|
||||
attrValues.add(trimAttr);
|
||||
}
|
||||
attrResponse.setAttrValues(attrValues);
|
||||
attrResponseList.add(attrResponse);
|
||||
}
|
||||
return attrResponseList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去拼团
|
||||
*
|
||||
@@ -743,7 +752,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
User user = userService.getInfo();
|
||||
|
||||
GoPinkResponse goPinkResponse = new GoPinkResponse();
|
||||
List<StorePink> pinkList = new ArrayList<>();
|
||||
List<StorePink> pinkList;
|
||||
if (teamPink.getKId().equals(0)) {
|
||||
pinkList = storePinkService.getListByCidAndKid(teamPink.getCid(), teamPink.getId());
|
||||
} else {
|
||||
@@ -806,6 +815,12 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
goPinkResponse.setIsOk(isOk);
|
||||
goPinkResponse.setPinkBool(pinkBool);
|
||||
goPinkResponse.setUserBool(userBool);
|
||||
if (userBool == 1) {
|
||||
if (!teamPink.getUid().equals(user.getUid())) {
|
||||
StorePink itemPink = storePinkService.getByUidAndKid(user.getUid(), teamPink.getId());
|
||||
goPinkResponse.setCurrentPinkOrder(itemPink.getOrderId());
|
||||
}
|
||||
}
|
||||
goPinkResponse.setPinkAll(pinkResponseList);
|
||||
goPinkResponse.setPinkT(storePinkResponse);
|
||||
goPinkResponse.setUserInfo(user);
|
||||
@@ -924,9 +939,7 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
StorePink newHeadPink = pinkList.get(pinkList.size() - 1);
|
||||
newHeadPink.setKId(0);
|
||||
pinkList.remove(pinkList.size() - 1);
|
||||
pinkList.forEach(i -> {
|
||||
i.setKId(newHeadPink.getId());
|
||||
});
|
||||
pinkList.forEach(i -> i.setKId(newHeadPink.getId()));
|
||||
pinkList.add(newHeadPink);
|
||||
storePinkService.updateBatchById(pinkList);
|
||||
}
|
||||
@@ -945,100 +958,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 扣减库存加销量
|
||||
*
|
||||
* @param num 商品数量
|
||||
* @param attrValueId 拼团商品规格
|
||||
* @param productId 主商品id
|
||||
* @param user 购买用户
|
||||
* @return Boolean
|
||||
*/
|
||||
@Override
|
||||
public Boolean decProductStock(StoreOrder storeOrder, Integer num, Integer attrValueId, Integer productId, User user) {
|
||||
// 判断拼团团长是否存在
|
||||
StorePink headPink = new StorePink();
|
||||
if (storeOrder.getPinkId() > 0) {
|
||||
headPink = storePinkService.getById(storeOrder.getPinkId());
|
||||
if (ObjectUtil.isNull(headPink) || headPink.getIsRefund().equals(true) || headPink.getStatus() == 3) {
|
||||
throw new CrmebException("找不到对应的拼团团队信息");
|
||||
}
|
||||
}
|
||||
|
||||
// 拼团商品本身库存扣减
|
||||
StoreProductAttrValue spavPram = new StoreProductAttrValue();
|
||||
spavPram.setProductId(storeOrder.getCombinationId());
|
||||
spavPram.setType(Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
spavPram.setId(attrValueId);
|
||||
List<StoreProductAttrValue> attrvalues = storeProductAttrValueService.getByEntity(spavPram);
|
||||
if (CollUtil.isEmpty(attrvalues)) throw new CrmebException("未找到相关商品属性信息");
|
||||
StoreProductAttrValue combinationAttrValue = attrvalues.get(0);
|
||||
// 对应的主商品sku
|
||||
List<StoreProductAttrValue> currentProAttrValues = storeProductAttrValueService.getListByProductId(productId);
|
||||
List<StoreProductAttrValue> existAttrValues = currentProAttrValues.stream().filter(e ->
|
||||
e.getSuk().equals(combinationAttrValue.getSuk()) && e.getType().equals(Constants.PRODUCT_TYPE_NORMAL))
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(existAttrValues)) throw new CrmebException("未找到扣减库存的商品");
|
||||
StoreCombination storeCombination = getById(storeOrder.getCombinationId());
|
||||
// 拼团商品表扣减库存加销量
|
||||
LambdaUpdateWrapper<StoreCombination> lqwuper = new LambdaUpdateWrapper<>();
|
||||
lqwuper.set(StoreCombination::getStock, storeCombination.getStock() - num);
|
||||
lqwuper.set(StoreCombination::getSales, storeCombination.getSales() + num);
|
||||
lqwuper.set(StoreCombination::getQuota, storeCombination.getQuota() - num);
|
||||
lqwuper.eq(StoreCombination::getId, storeOrder.getCombinationId());
|
||||
lqwuper.apply(StrUtil.format(" (stock - {} >= 0) ", num));
|
||||
|
||||
// 生成拼团表数据
|
||||
StorePink storePink = new StorePink();
|
||||
storePink.setUid(user.getUid());
|
||||
storePink.setAvatar(user.getAvatar());
|
||||
storePink.setNickname(user.getNickname());
|
||||
storePink.setOrderId(storeOrder.getOrderId());
|
||||
storePink.setOrderIdKey(storeOrder.getId());
|
||||
storePink.setTotalNum(storeOrder.getTotalNum());
|
||||
storePink.setTotalPrice(storeOrder.getTotalPrice());
|
||||
storePink.setCid(storeCombination.getId());
|
||||
storePink.setPid(storeCombination.getProductId());
|
||||
storePink.setPeople(storeCombination.getPeople());
|
||||
storePink.setPrice(storeCombination.getPrice());
|
||||
Integer effectiveTime = storeCombination.getEffectiveTime();// 有效小时数
|
||||
DateTime dateTime = cn.hutool.core.date.DateUtil.date();
|
||||
storePink.setAddTime(dateTime.getTime());
|
||||
if (ObjectUtil.isNotNull(storeOrder.getPinkId()) && storeOrder.getPinkId() > 0) {
|
||||
storePink.setStopTime(headPink.getStopTime());
|
||||
} else {
|
||||
DateTime hourTime = cn.hutool.core.date.DateUtil.offsetHour(dateTime, effectiveTime);
|
||||
long stopTime = hourTime.getTime();
|
||||
if (stopTime > storeCombination.getStopTime()) {
|
||||
stopTime = storeCombination.getStopTime();
|
||||
}
|
||||
storePink.setStopTime(stopTime);
|
||||
}
|
||||
storePink.setKId(Optional.ofNullable(storeOrder.getPinkId()).orElse(0));
|
||||
storePink.setIsTpl(false);
|
||||
storePink.setIsRefund(false);
|
||||
storePink.setStatus(1);
|
||||
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
// 拼团规格扣减
|
||||
storeProductAttrValueService.decProductAttrStock(storeOrder.getCombinationId(), attrValueId, num, Constants.PRODUCT_TYPE_PINGTUAN);
|
||||
// 主商品扣减
|
||||
storeProductService.decProductStock(productId, num, existAttrValues.get(0).getId(), Constants.PRODUCT_TYPE_NORMAL);
|
||||
// 拼团商品扣减
|
||||
update(lqwuper);
|
||||
|
||||
storePinkService.save(storePink);
|
||||
|
||||
// 如果是开团,需要更新订单数据
|
||||
if (storePink.getKId() == 0) {
|
||||
storeOrder.setPinkId(storePink.getId());
|
||||
storeOrderService.updateById(storeOrder);
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
return execute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加库存
|
||||
*/
|
||||
@@ -1148,10 +1067,85 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
updateWrapper.setSql(StrUtil.format("sales = sales + {}", num));
|
||||
updateWrapper.setSql(StrUtil.format("quota = quota - {}", num));
|
||||
// 扣减时加乐观锁保证库存不为负
|
||||
updateWrapper.last(StrUtil.format(" and (stock - {} >= 0)", num));
|
||||
updateWrapper.last(StrUtil.format(" and (quota - {} >= 0)", num));
|
||||
}
|
||||
updateWrapper.eq("id", id);
|
||||
return update(updateWrapper);
|
||||
boolean update = update(updateWrapper);
|
||||
if (!update) {
|
||||
throw new CrmebException("更新拼团商品库存失败,商品id = " + id);
|
||||
}
|
||||
return update;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团首页数据
|
||||
* 拼团数据 + 拼团商品6个
|
||||
* 3个用户头像(最多)
|
||||
* 拼团参与总人数
|
||||
* @return CombinationIndexResponse
|
||||
*/
|
||||
@Override
|
||||
public CombinationIndexResponse getIndexInfo() {
|
||||
// 获取最近的3单拼团订单
|
||||
List<StorePink> tempPinkList = storePinkService.findSizePink(3);
|
||||
List<String> avatarList = CollUtil.newArrayList();
|
||||
if (CollUtil.isNotEmpty(tempPinkList)) {
|
||||
// 获取这三个用户头像
|
||||
avatarList = tempPinkList.stream().map(StorePink::getAvatar).collect(Collectors.toList());
|
||||
}
|
||||
// 获取拼团参与总人数
|
||||
Integer totalPeople = storePinkService.getTotalPeople();
|
||||
|
||||
// 获取6个拼团商品
|
||||
LambdaQueryWrapper<StoreCombination> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StoreCombination::getIsDel, false);
|
||||
lqw.eq(StoreCombination::getIsShow, true);
|
||||
lqw.ge(StoreCombination::getStock, 0);
|
||||
long millis = System.currentTimeMillis();
|
||||
lqw.le(StoreCombination::getStartTime, millis);
|
||||
lqw.ge(StoreCombination::getStopTime, millis);
|
||||
lqw.orderByDesc(StoreCombination::getSort, StoreCombination::getId);
|
||||
lqw.last(" limit 6");
|
||||
List<StoreCombination> combinationList = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(combinationList)) {
|
||||
return null;
|
||||
}
|
||||
combinationList.forEach(e -> {
|
||||
int percentIntVal = CrmebUtil.percentInstanceIntVal(e.getQuota(), e.getQuotaShow());
|
||||
e.setQuotaPercent(percentIntVal);
|
||||
});
|
||||
|
||||
CombinationIndexResponse response = new CombinationIndexResponse();
|
||||
response.setAvatarList(avatarList);
|
||||
response.setTotalPeople(totalPeople);
|
||||
response.setProductList(combinationList);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团列表header
|
||||
* @return CombinationHeaderResponse
|
||||
*/
|
||||
@Override
|
||||
public CombinationHeaderResponse getHeader() {
|
||||
// 获取最近的3单拼团订单
|
||||
List<StorePink> tempPinkList = storePinkService.findSizePink(7);
|
||||
List<String> avatarList = CollUtil.newArrayList();
|
||||
if (CollUtil.isNotEmpty(tempPinkList)) {
|
||||
// 获取这三个用户头像
|
||||
avatarList = tempPinkList.stream().map(StorePink::getAvatar).collect(Collectors.toList());
|
||||
}
|
||||
// 获取拼团参与总人数
|
||||
Integer totalPeople = storePinkService.getTotalPeople();
|
||||
|
||||
// 获取拼团列表banner
|
||||
List<HashMap<String, Object>> bannerList = systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_COMBINATION_LIST_BANNNER);
|
||||
|
||||
CombinationHeaderResponse response = new CombinationHeaderResponse();
|
||||
response.setAvatarList(avatarList);
|
||||
response.setTotalPeople(totalPeople);
|
||||
response.setBannerList(bannerList);
|
||||
return response;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1286,39 +1280,6 @@ public class StoreCombinationServiceImpl extends ServiceImpl<StoreCombinationDao
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置制式结构给attr属性
|
||||
*/
|
||||
private void setSkuAttr(List<StoreProductAttr> attrList, CombinationDetailResponse detailResponse) {
|
||||
List<HashMap<String, Object>> attrMapList = new ArrayList<>();
|
||||
for (StoreProductAttr attr : attrList) {
|
||||
HashMap<String, Object> attrMap = new HashMap<>();
|
||||
attrMap.put("productId", attr.getProductId());
|
||||
attrMap.put("attrName", attr.getAttrName());
|
||||
// attrMap.put("type",attr.getType());
|
||||
List<String> attrValues = new ArrayList<>();
|
||||
String trimAttr = attr.getAttrValues()
|
||||
.replace("[", "")
|
||||
.replace("]", "");
|
||||
if (attr.getAttrValues().contains(",")) {
|
||||
attrValues = Arrays.asList(trimAttr.split(","));
|
||||
} else {
|
||||
attrValues.add(trimAttr);
|
||||
}
|
||||
attrMap.put("attrValues", attrValues);
|
||||
|
||||
List<HashMap<String, Object>> attrValueMapList = new ArrayList<>();
|
||||
for (String attrValue : attrValues) {
|
||||
HashMap<String, Object> attrValueMap = new HashMap<>();
|
||||
attrValueMap.put("attr", attrValue);
|
||||
attrValueMapList.add(attrValueMap);
|
||||
}
|
||||
attrMap.put("attrValue", attrValueMapList);
|
||||
attrMapList.add(attrMap);
|
||||
}
|
||||
detailResponse.setProductAttr(attrMapList);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取制式结构给attr属性
|
||||
*/
|
||||
|
||||
@@ -273,13 +273,9 @@ public class StorePinkServiceImpl extends ServiceImpl<StorePinkDao, StorePink> i
|
||||
MyRecord record = new MyRecord();
|
||||
record.set("orderNo", storeOrder.getOrderId());
|
||||
record.set("proName", storeCombination.getTitle());
|
||||
record.set("payType", storeOrder.getPayType());
|
||||
record.set("isChannel", storeOrder.getIsChannel());
|
||||
pushMessageOrder(record, tempUser);
|
||||
// map.put(Constants.WE_CHAT_TEMP_KEY_FIRST, "恭喜您拼团成功!我们将尽快为您发货。");
|
||||
// map.put("keyword1", storeOrder.getOrderId());
|
||||
// map.put("keyword2", storeCombination.getTitle());
|
||||
// map.put(Constants.WE_CHAT_TEMP_KEY_END, "感谢你的使用!");
|
||||
//
|
||||
// templateMessageService.push(Constants.WE_CHAT_TEMP_KEY_COMBINATION_SUCCESS, map, storeOrder.getUid(), Constants.PAY_TYPE_WE_CHAT_FROM_PUBLIC);
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -290,13 +286,17 @@ public class StorePinkServiceImpl extends ServiceImpl<StorePinkDao, StorePink> i
|
||||
* @param user 拼团用户
|
||||
*/
|
||||
private void pushMessageOrder(MyRecord record, User user) {
|
||||
if (user.getUserType().equals(UserConstants.USER_TYPE_H5)) {
|
||||
return;
|
||||
if (!record.getStr("payType").equals(Constants.PAY_TYPE_WE_CHAT)) {
|
||||
return ;
|
||||
}
|
||||
if (record.getInt("isChannel").equals(2)) {
|
||||
return ;
|
||||
}
|
||||
|
||||
UserToken userToken;
|
||||
HashMap<String, String> temMap = new HashMap<>();
|
||||
// 公众号
|
||||
if (user.getUserType().equals(UserConstants.USER_TYPE_WECHAT)) {
|
||||
if (record.getInt("isChannel").equals(Constants.ORDER_PAY_CHANNEL_PUBLIC)) {
|
||||
userToken = userTokenService.getTokenByUserId(user.getUid(), UserConstants.USER_TOKEN_TYPE_WECHAT);
|
||||
if (ObjectUtil.isNull(userToken)) {
|
||||
return ;
|
||||
@@ -356,6 +356,45 @@ public class StorePinkServiceImpl extends ServiceImpl<StorePinkDao, StorePink> i
|
||||
return dao.selectOne(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取最后3个拼团信息(不同用户)
|
||||
* @return List
|
||||
*/
|
||||
@Override
|
||||
public List<StorePink> findSizePink(Integer size) {
|
||||
LambdaQueryWrapper<StorePink> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StorePink::getIsRefund, false);
|
||||
lqw.in(StorePink::getStatus, 1, 2);
|
||||
lqw.groupBy(StorePink::getUid);
|
||||
lqw.orderByDesc(StorePink::getId);
|
||||
lqw.last(" limit " + size);
|
||||
return dao.selectList(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拼团参与总人数
|
||||
* @return Integer
|
||||
*/
|
||||
@Override
|
||||
public Integer getTotalPeople() {
|
||||
LambdaQueryWrapper<StorePink> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StorePink::getIsRefund, false);
|
||||
lqw.in(StorePink::getStatus, 1, 2);
|
||||
return dao.selectCount(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取拼团详情
|
||||
* @return StorePink
|
||||
*/
|
||||
@Override
|
||||
public StorePink getByUidAndKid(Integer uid, Integer kid) {
|
||||
LambdaQueryWrapper<StorePink> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(StorePink::getUid, uid);
|
||||
lqw.in(StorePink::getKId, kid);
|
||||
return dao.selectOne(lqw);
|
||||
}
|
||||
|
||||
private Integer getCountByKidAndCid(Integer cid, Integer kid) {
|
||||
LambdaQueryWrapper<StorePink> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.select(StorePink::getId);
|
||||
|
||||
@@ -111,12 +111,19 @@ public class WebConfig implements WebMvcConfigurer {
|
||||
excludePathPatterns("/api/front/user/service/**").
|
||||
excludePathPatterns("/api/front/logistics").
|
||||
excludePathPatterns("/api/front/groom/list/**").
|
||||
excludePathPatterns("/api/front/index").
|
||||
// excludePathPatterns("/api/front/index").
|
||||
excludePathPatterns("/api/front/config").
|
||||
excludePathPatterns("/api/front/category").
|
||||
excludePathPatterns("/api/front/seckill/*").
|
||||
excludePathPatterns("/api/front/seckill/list/*").
|
||||
excludePathPatterns("/api/front/seckill/detail/*").
|
||||
excludePathPatterns("/api/front/ios/*").
|
||||
excludePathPatterns("/api/front/ios/register/binding/phone").
|
||||
excludePathPatterns("api/front/combination/index").
|
||||
excludePathPatterns("api/front/seckill/index").
|
||||
excludePathPatterns("api/front/bargain/index").
|
||||
excludePathPatterns("api/front/combination/index").
|
||||
excludePathPatterns("api/front/index/product/*").
|
||||
// excludePathPatterns("/api/front/cart/count").
|
||||
excludePathPatterns("/swagger-resources/**", "/webjars/**", "/v2/**", "/swagger-ui.html/**");
|
||||
}
|
||||
|
||||
@@ -66,8 +66,13 @@ public interface ExpressService extends IService<Express> {
|
||||
/**
|
||||
* 查询快递公司
|
||||
* @param code 快递公司编号
|
||||
* @return
|
||||
* @return Express
|
||||
*/
|
||||
Express getByCode(String code);
|
||||
|
||||
/**
|
||||
* 通过物流公司名称获取
|
||||
* @param name 物流公司名称
|
||||
*/
|
||||
Express getByName(String name);
|
||||
}
|
||||
|
||||
@@ -70,7 +70,6 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
|
||||
if(StrUtil.isNotBlank(request.getKeywords())){
|
||||
lambdaQueryWrapper.like(Express::getCode, request.getKeywords()).or().like(Express::getName, request.getKeywords());
|
||||
}
|
||||
|
||||
lambdaQueryWrapper.orderByDesc(Express::getSort, Express::getId);
|
||||
return dao.selectList(lambdaQueryWrapper);
|
||||
}
|
||||
@@ -180,6 +179,18 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
|
||||
return dao.selectOne(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过物流公司名称获取
|
||||
* @param name 物流公司名称
|
||||
*/
|
||||
@Override
|
||||
public Express getByName(String name) {
|
||||
LambdaQueryWrapper<Express> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(Express::getName, name);
|
||||
lqw.last(" limit 1");
|
||||
return dao.selectOne(lqw);
|
||||
}
|
||||
|
||||
/**
|
||||
* 从平台获取物流公司
|
||||
* 并存入数据库
|
||||
@@ -202,7 +213,7 @@ public class ExpressServiceImpl extends ServiceImpl<ExpressDao, Express> impleme
|
||||
List<String> codeList = getAllCode();
|
||||
jsonArray.forEach(temp -> {
|
||||
JSONObject object = (JSONObject) temp;
|
||||
if (StrUtil.isBlank(object.getString("code")) || !codeList.contains(object.getString("code"))) {
|
||||
if (StrUtil.isNotBlank(object.getString("code")) && !codeList.contains(object.getString("code"))) {
|
||||
Express express = new Express();
|
||||
express.setName(Optional.ofNullable(object.getString("name")).orElse(""));
|
||||
express.setCode(Optional.ofNullable(object.getString("code")).orElse(""));
|
||||
|
||||
@@ -36,9 +36,9 @@ public class UserRechargeSearchRequest implements Serializable {
|
||||
@ApiModelProperty(value = "搜索关键字")
|
||||
private String keywords;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "today,yesterday,lately7,lately30,month,year,/yyyy-MM-dd hh:mm:ss,yyyy-MM-dd hh:mm:ss/")
|
||||
private String dateLimit;
|
||||
|
||||
|
||||
@ApiModelProperty(value = "用户uid")
|
||||
private Integer uid;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,14 @@ public interface UserRechargeService extends IService<UserRecharge> {
|
||||
/**
|
||||
* 充值退款
|
||||
* @param request 退款参数
|
||||
* @return
|
||||
* @return Boolean
|
||||
*/
|
||||
Boolean refund(UserRechargeRefundRequest request);
|
||||
|
||||
/**
|
||||
* 获取用户累计充值金额
|
||||
* @param uid 用户uid
|
||||
* @return BigDecimal
|
||||
*/
|
||||
BigDecimal getTotalRechargePrice(Integer uid);
|
||||
}
|
||||
|
||||
@@ -250,7 +250,7 @@ public class UserExtractServiceImpl extends ServiceImpl<UserExtractDao, UserExtr
|
||||
wechatSendMessageForMinService.sendCashMessage(cash,userId);
|
||||
save(userExtract);
|
||||
// 扣除用户总金额
|
||||
return userService.upadteBrokeragePrice(user, toBeWithdrawn.subtract(request.getExtractPrice()));
|
||||
return userService.updateBrokeragePrice(user, toBeWithdrawn.subtract(request.getExtractPrice()));
|
||||
}
|
||||
|
||||
|
||||
@@ -362,6 +362,7 @@ public class UserExtractServiceImpl extends ServiceImpl<UserExtractDao, UserExtr
|
||||
|
||||
Boolean execute = false;
|
||||
|
||||
userExtract.setUpdateTime(cn.hutool.core.date.DateUtil.date());
|
||||
// 拒绝
|
||||
if (status == -1) {//未通过时恢复用户总金额
|
||||
userExtract.setFailMsg(backMessage);
|
||||
@@ -431,6 +432,7 @@ public class UserExtractServiceImpl extends ServiceImpl<UserExtractDao, UserExtr
|
||||
|
||||
private List<UserExtract> getListByMonth(Integer userId, String date) {
|
||||
QueryWrapper<UserExtract> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("id", "extract_price", "status", "create_time", "update_time");
|
||||
queryWrapper.eq("uid", userId);
|
||||
queryWrapper.apply(StrUtil.format(" left(create_time, 7) = '{}'", date));
|
||||
queryWrapper.orderByDesc("create_time");
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.zbkj.crmeb.finance.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageHelper;
|
||||
@@ -8,8 +9,10 @@ import com.zbkj.crmeb.finance.dao.UserFundsMonitorDao;
|
||||
import com.zbkj.crmeb.finance.model.UserFundsMonitor;
|
||||
import com.zbkj.crmeb.finance.request.FundsMonitorUserSearchRequest;
|
||||
import com.zbkj.crmeb.finance.service.UserFundsMonitorService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.model.UserBrokerageRecord;
|
||||
import com.zbkj.crmeb.user.service.UserBrokerageRecordService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -39,6 +42,9 @@ public class UserFundsMonitorServiceImpl extends ServiceImpl<UserFundsMonitorDao
|
||||
@Autowired
|
||||
private UserBrokerageRecordService userBrokerageRecordService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 佣金列表
|
||||
* @author Mr.Zhang
|
||||
@@ -62,6 +68,12 @@ public class UserFundsMonitorServiceImpl extends ServiceImpl<UserFundsMonitorDao
|
||||
}
|
||||
map.put("sort", sort);
|
||||
List<UserFundsMonitor> monitorList = dao.getFundsMonitor(map);
|
||||
monitorList.forEach(e -> {
|
||||
if (e.getSpreadUid() > 0) {
|
||||
User spreadUser = userService.getById(e.getSpreadUid());
|
||||
e.setSpreadName(spreadUser.getNickname());
|
||||
}
|
||||
});
|
||||
return monitorList;
|
||||
}
|
||||
|
||||
|
||||
@@ -4,6 +4,8 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.common.CommonPage;
|
||||
import com.common.PageParamRequest;
|
||||
@@ -95,9 +97,11 @@ public class UserRechargeServiceImpl extends ServiceImpl<UserRechargeDao, UserRe
|
||||
dateLimitUtilVo dateLimit = DateUtil.getDateLimit(request.getDateLimit());
|
||||
//带 UserExtract 类的多条件查询
|
||||
LambdaQueryWrapper<UserRecharge> lambdaQueryWrapper = new LambdaQueryWrapper<>();
|
||||
if (ObjectUtil.isNotNull(request.getUid()) && request.getUid() > 0) {
|
||||
lambdaQueryWrapper.eq(UserRecharge::getUid, request.getUid());
|
||||
}
|
||||
if(!StringUtils.isBlank(request.getKeywords())){
|
||||
lambdaQueryWrapper.and(i -> i.
|
||||
or().like(UserRecharge::getUid, request.getKeywords()+""). //充值用户UID
|
||||
or().like(UserRecharge::getOrderId, request.getKeywords()) //订单号
|
||||
);
|
||||
}
|
||||
@@ -116,6 +120,7 @@ public class UserRechargeServiceImpl extends ServiceImpl<UserRechargeDao, UserRe
|
||||
|
||||
lambdaQueryWrapper.between(UserRecharge::getCreateTime, dateLimit.getStartTime(), dateLimit.getEndTime());
|
||||
}
|
||||
lambdaQueryWrapper.orderByDesc(UserRecharge::getId);
|
||||
List<UserRechargeResponse> responses = new ArrayList<>();
|
||||
List<UserRecharge> userRecharges = dao.selectList(lambdaQueryWrapper);
|
||||
List<Integer> userIds = userRecharges.stream().map(UserRecharge::getUid).collect(Collectors.toList());
|
||||
@@ -277,6 +282,21 @@ public class UserRechargeServiceImpl extends ServiceImpl<UserRechargeDao, UserRe
|
||||
return execute;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户累计充值金额
|
||||
* @param uid 用户uid
|
||||
* @return BigDecimal
|
||||
*/
|
||||
@Override
|
||||
public BigDecimal getTotalRechargePrice(Integer uid) {
|
||||
QueryWrapper<UserRecharge> query = Wrappers.query();
|
||||
query.select("IFNULL(SUM(price), 0) as price, IFNULL(SUM(give_price), 0) as give_price");
|
||||
query.eq("paid", 1);
|
||||
query.eq("uid", uid);
|
||||
UserRecharge userRecharge = dao.selectOne(query);
|
||||
return userRecharge.getPrice().add(userRecharge.getGivePrice());
|
||||
}
|
||||
|
||||
private UserBill getRefundBill(UserRecharge userRecharge, BigDecimal nowMoney, BigDecimal refundPrice) {
|
||||
UserBill userBill = new UserBill();
|
||||
userBill.setUid(userRecharge.getUid());
|
||||
|
||||
@@ -3,11 +3,10 @@ package com.zbkj.crmeb.front.controller;
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
import com.zbkj.crmeb.article.request.ArticleSearchRequest;
|
||||
import com.zbkj.crmeb.article.model.Article;
|
||||
import com.zbkj.crmeb.article.service.ArticleService;
|
||||
import com.zbkj.crmeb.article.vo.ArticleVo;
|
||||
import com.zbkj.crmeb.category.service.CategoryService;
|
||||
import com.zbkj.crmeb.category.model.Category;
|
||||
import com.zbkj.crmeb.front.response.ArticleResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -39,81 +38,52 @@ public class ArticleController {
|
||||
@Autowired
|
||||
private ArticleService articleService;
|
||||
|
||||
@Autowired
|
||||
private CategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 分页列表
|
||||
* @param cid String 搜索条件
|
||||
* @param pageParamRequest 分页参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-18
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list/{cid}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ArticleVo>> getList(@PathVariable(name="cid") String cid,
|
||||
@Validated PageParamRequest pageParamRequest){
|
||||
ArticleSearchRequest request = new ArticleSearchRequest();
|
||||
request.setCid(cid);
|
||||
request.setHide(false);
|
||||
request.setStatus(false);
|
||||
CommonPage<ArticleVo> articleCommonPage = CommonPage.restPage(articleService.getList(request, pageParamRequest));
|
||||
return CommonResult.success(articleCommonPage);
|
||||
public CommonResult<CommonPage<ArticleResponse>> getList(@PathVariable(name="cid") String cid,
|
||||
@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getList(cid, pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门列表
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-18
|
||||
*/
|
||||
@ApiOperation(value = "热门列表")
|
||||
@RequestMapping(value = "/hot/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ArticleVo>> getHotList(){
|
||||
ArticleSearchRequest request = new ArticleSearchRequest();
|
||||
request.setIsHot(true);
|
||||
request.setHide(false);
|
||||
request.setStatus(false);
|
||||
CommonPage<ArticleVo> articleCommonPage = CommonPage.restPage(articleService.getList(request, new PageParamRequest()));
|
||||
return CommonResult.success(articleCommonPage);
|
||||
public CommonResult<CommonPage<ArticleResponse>> getHotList(){
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getHotList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 轮播列表
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-18
|
||||
*/
|
||||
@ApiOperation(value = "轮播列表")
|
||||
@RequestMapping(value = "/banner/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ArticleVo>> getList(){
|
||||
ArticleSearchRequest request = new ArticleSearchRequest();
|
||||
request.setIsBanner(true);
|
||||
request.setHide(false);
|
||||
request.setStatus(false);
|
||||
CommonPage<ArticleVo> articleCommonPage = CommonPage.restPage(articleService.getList(request, new PageParamRequest()));
|
||||
return CommonResult.success(articleCommonPage);
|
||||
public CommonResult<CommonPage<Article>> getList(){
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getBannerList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 分类列表
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-18
|
||||
* 文章分类列表
|
||||
*/
|
||||
@ApiOperation(value = "分类列表")
|
||||
@ApiOperation(value = "文章分类列表")
|
||||
@RequestMapping(value = "/category/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<com.zbkj.crmeb.category.vo.CategoryTreeVo>> categoryList(){
|
||||
return CommonResult.success(CommonPage.restPage(categoryService.getListTree(Constants.CATEGORY_TYPE_ARTICLE, 1,"")));
|
||||
public CommonResult<CommonPage<Category>> categoryList(){
|
||||
return CommonResult.success(CommonPage.restPage(articleService.getCategoryList()));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文章详情
|
||||
* @param id Integer
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-18
|
||||
*/
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/info", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name="id", value="文章ID")
|
||||
public CommonResult<ArticleVo> info(@RequestParam(value = "id") Integer id){
|
||||
public CommonResult<ArticleResponse> info(@RequestParam(value = "id") Integer id){
|
||||
return CommonResult.success(articleService.getVoByFront(id));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.bargain.response.StoreBargainResponse;
|
||||
import com.zbkj.crmeb.bargain.response.StoreBargainUserHelpResponse;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainService;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainUserHelpService;
|
||||
import com.zbkj.crmeb.bargain.service.StoreBargainUserService;
|
||||
import com.zbkj.crmeb.front.request.BargainFrontRequest;
|
||||
import com.zbkj.crmeb.front.response.BargainCountResponse;
|
||||
import com.zbkj.crmeb.front.response.BargainDetailResponse;
|
||||
import com.zbkj.crmeb.front.response.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -17,8 +16,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -42,81 +39,70 @@ public class BargainController {
|
||||
@Autowired
|
||||
private StoreBargainService storeBargainService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainUserService storeBargainUserService;
|
||||
|
||||
@Autowired
|
||||
private StoreBargainUserHelpService storeBargainUserHelpService;
|
||||
|
||||
/**
|
||||
* 砍价首页信息
|
||||
*/
|
||||
@ApiOperation(value = "砍价首页信息")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<BargainIndexResponse> index(){
|
||||
return CommonResult.success(storeBargainService.getIndexInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品列表header
|
||||
*/
|
||||
@ApiOperation(value = "砍价商品列表header")
|
||||
@RequestMapping(value = "/header", method = RequestMethod.GET)
|
||||
public CommonResult<BargainHeaderResponse> header(){
|
||||
return CommonResult.success(storeBargainService.getHeader());
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品列表
|
||||
* @return 砍价商品列表
|
||||
*/
|
||||
@ApiOperation(value = "砍价商品列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<PageInfo<StoreBargainResponse>> list(@ModelAttribute PageParamRequest pageParamRequest){
|
||||
PageInfo<StoreBargainResponse> h5List = storeBargainService.getH5List(pageParamRequest);
|
||||
return CommonResult.success(h5List);
|
||||
public CommonResult<PageInfo<StoreBargainDetailResponse>> list(@ModelAttribute PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(storeBargainService.getH5List(pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取查看、分享、参与人数
|
||||
* @return
|
||||
* 获取用户砍价信息
|
||||
*/
|
||||
@ApiOperation(value = "获取查看、分享、参与人数")
|
||||
@RequestMapping(value = "/share/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, Object>> share(@PathVariable(value = "id") Integer id) {
|
||||
Map<String, Object> map = storeBargainService.getH5Share(id);
|
||||
return CommonResult.success(map);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取帮忙好友砍价数据
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "获取帮忙好友砍价数据")
|
||||
@RequestMapping(value = "/help/count", method = RequestMethod.GET)
|
||||
public CommonResult<BargainCountResponse> count(@ModelAttribute @Validated BargainFrontRequest bargainFrontRequest) {
|
||||
BargainCountResponse bargainCountResponse = storeBargainUserHelpService.getH5CountByBargainId(bargainFrontRequest);
|
||||
return CommonResult.success(bargainCountResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 帮忙好友砍价信息列表
|
||||
* @return 砍价商品列表
|
||||
*/
|
||||
@ApiOperation(value = "帮忙好友砍价信息列表")
|
||||
@RequestMapping(value = "/help/list", method = RequestMethod.GET)
|
||||
public CommonResult<PageInfo<StoreBargainUserHelpResponse>> helpList(@ModelAttribute @Validated BargainFrontRequest bargainFrontRequest, @ModelAttribute PageParamRequest pageParamRequest){
|
||||
PageInfo<StoreBargainUserHelpResponse> list = storeBargainUserHelpService.getHelpList(bargainFrontRequest, pageParamRequest);
|
||||
return CommonResult.success(list);
|
||||
@ApiOperation(value = "获取用户砍价信息")
|
||||
@RequestMapping(value = "/user", method = RequestMethod.GET)
|
||||
public CommonResult<BargainUserInfoResponse> getBargainUserInfo(@ModelAttribute @Validated BargainFrontRequest bargainFrontRequest) {
|
||||
return CommonResult.success(storeBargainUserService.getBargainUserInfo(bargainFrontRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品详情
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "砍价商品详情")
|
||||
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<BargainDetailResponse> detail(@PathVariable(value = "id") Integer id) {
|
||||
BargainDetailResponse h5Detail = storeBargainService.getH5Detail(id);
|
||||
public CommonResult<BargainDetailH5Response> detail(@PathVariable(value = "id") Integer id) {
|
||||
BargainDetailH5Response h5Detail = storeBargainService.getH5Detail(id);
|
||||
return CommonResult.success(h5Detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 开始砍价
|
||||
* @return
|
||||
* 创建砍价活动
|
||||
*/
|
||||
@ApiOperation(value = "开始砍价")
|
||||
@ApiOperation(value = "创建砍价活动")
|
||||
@RequestMapping(value = "/start", method = RequestMethod.POST)
|
||||
public CommonResult<Object> start(@RequestBody @Validated BargainFrontRequest bargainFrontRequest) {
|
||||
Boolean start = storeBargainService.start(bargainFrontRequest);
|
||||
if (start) {
|
||||
return CommonResult.success("参与成功");
|
||||
}
|
||||
return CommonResult.failed("参与失败,请重新参与");
|
||||
public CommonResult<Map<String, Object>> start(@RequestBody @Validated BargainFrontRequest bargainFrontRequest) {
|
||||
return CommonResult.success(storeBargainService.start(bargainFrontRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "砍价")
|
||||
@RequestMapping(value = "/help", method = RequestMethod.POST)
|
||||
@@ -125,12 +111,12 @@ public class BargainController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价发起用户信息
|
||||
* @return
|
||||
* 砍价记录
|
||||
*/
|
||||
@ApiOperation(value = "砍价发起用户信息")
|
||||
@RequestMapping(value = "/start/user", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, String>> startUser(@ModelAttribute @Validated BargainFrontRequest bargainFrontRequest) {
|
||||
return CommonResult.success(storeBargainUserHelpService.startUser(bargainFrontRequest));
|
||||
@ApiOperation(value = "砍价记录")
|
||||
@RequestMapping(value = "/record", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<BargainRecordResponse>> recordList(@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeBargainUserService.getRecordList(pageParamRequest)));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -4,13 +4,15 @@ import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.exception.CrmebException;
|
||||
import com.zbkj.crmeb.front.request.CartNumRequest;
|
||||
import com.zbkj.crmeb.front.request.CartRequest;
|
||||
import com.zbkj.crmeb.front.request.CartResetRequest;
|
||||
import com.zbkj.crmeb.front.response.CartInfoResponse;
|
||||
import com.zbkj.crmeb.store.model.StoreCart;
|
||||
import com.zbkj.crmeb.store.response.StoreCartResponse;
|
||||
import com.zbkj.crmeb.store.service.StoreCartService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
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.commons.lang3.StringUtils;
|
||||
@@ -19,7 +21,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
@@ -46,29 +47,25 @@ public class CartController {
|
||||
@Autowired
|
||||
private StoreCartService storeCartService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 分页显示购物车表
|
||||
* @param pageParamRequest 分页参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-28
|
||||
*/
|
||||
@ApiOperation(value = "分页列表") //配合swagger使用
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreCartResponse>> getList(@RequestParam Boolean isValid, @Validated PageParamRequest pageParamRequest){
|
||||
StoreCart storeCart = new StoreCart();
|
||||
CommonPage<StoreCartResponse> storeCartCommonPage =
|
||||
CommonPage.restPage(storeCartService.getList(pageParamRequest, isValid));
|
||||
return CommonResult.success(storeCartCommonPage);
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="isValid", value="类型,true-有效商品,false-无效商品", required = true),
|
||||
@ApiImplicitParam(name="page", value="页码", required = true),
|
||||
@ApiImplicitParam(name="limit", value="每页数量", required = true)
|
||||
})
|
||||
public CommonResult<CommonPage<CartInfoResponse>> getList(@RequestParam Boolean isValid, @Validated PageParamRequest pageParamRequest){
|
||||
|
||||
CommonPage<CartInfoResponse> restPage = CommonPage.restPage(storeCartService.getList(pageParamRequest, isValid));
|
||||
return CommonResult.success(restPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增购物车表
|
||||
* @param storeCartRequest 新增参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-28
|
||||
*/
|
||||
@ApiOperation(value = "新增")
|
||||
@RequestMapping(value = "/save", method = RequestMethod.POST)
|
||||
@@ -87,9 +84,7 @@ public class CartController {
|
||||
|
||||
/**
|
||||
* 删除购物车表
|
||||
* @param ids List<Integer> edit by stivepeim 2020-7-4
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-28
|
||||
* @param ids 购物车ids
|
||||
*/
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
@@ -105,8 +100,6 @@ public class CartController {
|
||||
* 修改商品数量
|
||||
* @param id integer id
|
||||
* @param number 修改的产品数量
|
||||
* @author Mr.Zhang edit by stivepeim 2020-7-4
|
||||
* @since 2020-05-28
|
||||
*/
|
||||
@ApiOperation(value = "修改")
|
||||
@RequestMapping(value = "/num", method = RequestMethod.POST)
|
||||
@@ -126,16 +119,12 @@ public class CartController {
|
||||
|
||||
|
||||
/**
|
||||
* 数量
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-28
|
||||
* 获取购物车数量
|
||||
*/
|
||||
@ApiOperation(value = "数量")
|
||||
@ApiOperation(value = "获取购物车数量")
|
||||
@RequestMapping(value = "/count", method = RequestMethod.GET)
|
||||
public CommonResult<Map<Object, Object>> count(@RequestParam(value = "numType", defaultValue = "false") boolean numType ){
|
||||
Map<Object, Object> map = new HashMap<>();
|
||||
map.put("count", storeCartService.getUserCount(userService.getUserIdException(), "product", numType));
|
||||
return CommonResult.success(map);
|
||||
public CommonResult<Map<String, Integer>> count(@Validated CartNumRequest request){
|
||||
return CommonResult.success(storeCartService.getUserCount(request));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -28,6 +28,7 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@RequestMapping("api/front/city")
|
||||
@Api(tags = "城市服务")
|
||||
public class CityController {
|
||||
|
||||
@Autowired
|
||||
private SystemCityService systemCityService;
|
||||
|
||||
|
||||
@@ -1,13 +1,13 @@
|
||||
package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.combination.model.StoreCombination;
|
||||
import com.zbkj.crmeb.combination.request.StorePinkRequest;
|
||||
import com.zbkj.crmeb.front.response.CombinationDetailResponse;
|
||||
import com.zbkj.crmeb.combination.service.StoreCombinationService;
|
||||
import com.zbkj.crmeb.front.response.GoPinkResponse;
|
||||
import com.zbkj.crmeb.front.response.*;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -15,8 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 拼团商品
|
||||
* +----------------------------------------------------------------------
|
||||
@@ -38,14 +36,31 @@ public class CombinationController {
|
||||
@Autowired
|
||||
private StoreCombinationService storeCombinationService;
|
||||
|
||||
/**
|
||||
* 拼团首页
|
||||
*/
|
||||
@ApiOperation(value = "拼团首页数据")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<CombinationIndexResponse> index() {
|
||||
return CommonResult.success(storeCombinationService.getIndexInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 拼团商品列表header
|
||||
*/
|
||||
@ApiOperation(value = "拼团商品列表header")
|
||||
@RequestMapping(value = "/header", method = RequestMethod.GET)
|
||||
public CommonResult<CombinationHeaderResponse> header(){
|
||||
return CommonResult.success(storeCombinationService.getHeader());
|
||||
}
|
||||
|
||||
/**
|
||||
* 砍价商品列表
|
||||
*/
|
||||
@ApiOperation(value = "拼团商品列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<PageInfo<StoreCombination>> list(@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
PageInfo<StoreCombination> h5List = storeCombinationService.getH5List(pageParamRequest);
|
||||
return CommonResult.success(h5List);
|
||||
public CommonResult<CommonPage<StoreCombinationH5Response>> list(@ModelAttribute PageParamRequest pageParamRequest) {
|
||||
return CommonResult.success(CommonPage.restPage(storeCombinationService.getH5List(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -2,23 +2,19 @@ package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.utils.CrmebUtil;
|
||||
import com.zbkj.crmeb.marketing.response.StoreCouponFrontResponse;
|
||||
import com.zbkj.crmeb.marketing.response.StoreCouponUserOrder;
|
||||
import com.zbkj.crmeb.marketing.service.StoreCouponService;
|
||||
import com.zbkj.crmeb.marketing.service.StoreCouponUserService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
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.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.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@@ -38,7 +34,6 @@ import java.util.List;
|
||||
@RestController("CouponFrontController")
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "优惠券")
|
||||
|
||||
public class CouponController {
|
||||
|
||||
@Autowired
|
||||
@@ -47,46 +42,33 @@ public class CouponController {
|
||||
@Autowired
|
||||
private StoreCouponUserService storeCouponUserService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页显示优惠券表
|
||||
* @param type 类型,搜索产品指定优惠券
|
||||
* @param type 类型,1-通用,2-商品,3-品类
|
||||
* @param productId 产品id,搜索产品指定优惠券
|
||||
* @param pageParamRequest 分页参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/coupons", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreCouponFrontResponse>> getList(
|
||||
@RequestParam(value = "type", defaultValue = "0") int type,
|
||||
@RequestParam(value = "productId", defaultValue = "0") int productId,
|
||||
@Validated PageParamRequest pageParamRequest){
|
||||
|
||||
if(type == 0){
|
||||
productId = 0;
|
||||
}
|
||||
|
||||
return CommonResult.success(storeCouponService.getListByUser(productId, pageParamRequest, userService.getUserId()));
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="type", value="类型,1-通用,2-商品,3-品类", required = true),
|
||||
@ApiImplicitParam(name="productId", value="产品id"),
|
||||
@ApiImplicitParam(name="page", value="页码", required = true),
|
||||
@ApiImplicitParam(name="limit", value="每页数量", required = true)
|
||||
})
|
||||
public CommonResult<List<StoreCouponFrontResponse>> getList(@RequestParam(value = "type", defaultValue = "0") int type,
|
||||
@RequestParam(value = "productId", defaultValue = "0") int productId, @Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(storeCouponService.getH5List(type, productId, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据购物车id获取可用优惠券
|
||||
* @param cartId 购物车id
|
||||
* @return 优惠券集合
|
||||
*/
|
||||
@ApiOperation(value = "当前购物车可用优惠券")
|
||||
@RequestMapping(value = "coupons/order", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreCouponUserOrder>> getCouponsListByCartId(@RequestParam String cartId){
|
||||
try {
|
||||
CrmebUtil.stringToArrayInt(cartId);
|
||||
} catch (NumberFormatException e) {
|
||||
return CommonResult.success(new ArrayList<StoreCouponUserOrder>());
|
||||
}
|
||||
return CommonResult.success(storeCouponUserService.getListByCartIds(CrmebUtil.stringToArrayInt(cartId)));
|
||||
@ApiOperation(value = "当前订单可用优惠券")
|
||||
@RequestMapping(value = "coupons/order/{preOrderNo}", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreCouponUserOrder>> getCouponsListByPreOrderNo(@PathVariable String preOrderNo){
|
||||
return CommonResult.success(storeCouponUserService.getListByPreOrderNo(preOrderNo));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,18 +1,23 @@
|
||||
package com.zbkj.crmeb.front.controller;
|
||||
|
||||
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
import com.zbkj.crmeb.front.response.IndexInfoResponse;
|
||||
import com.zbkj.crmeb.front.response.IndexProductBannerResponse;
|
||||
import com.zbkj.crmeb.front.response.IndexProductResponse;
|
||||
import com.zbkj.crmeb.front.service.IndexService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -40,8 +45,6 @@ public class IndexController {
|
||||
|
||||
/**
|
||||
* 首页产品的轮播图和产品信息
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-02
|
||||
*/
|
||||
@ApiOperation(value = "首页产品的轮播图和产品信息")
|
||||
@RequestMapping(value = "/groom/list/{type}", method = RequestMethod.GET)
|
||||
@@ -55,8 +58,6 @@ public class IndexController {
|
||||
|
||||
/**
|
||||
* 首页数据
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-02
|
||||
*/
|
||||
@ApiOperation(value = "首页数据")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
@@ -64,10 +65,21 @@ public class IndexController {
|
||||
return CommonResult.success(indexService.getIndexInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 首页商品列表
|
||||
*/
|
||||
@ApiOperation(value = "首页商品列表")
|
||||
@RequestMapping(value = "/index/product/{type}", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "type", value = "类型 【1 精品推荐 2 热门榜单 3首发新品 4促销单品】", dataType = "int", required = true)
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getProductBanner(@PathVariable(value = "type") Integer type, PageParamRequest pageParamRequest){
|
||||
if(type < Constants.INDEX_RECOMMEND_BANNER || type > Constants.INDEX_BENEFIT_BANNER){
|
||||
return CommonResult.validateFailed();
|
||||
}
|
||||
return CommonResult.success(indexService.findIndexProductList(type, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 热门搜索
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
*/
|
||||
@ApiOperation(value = "热门搜索")
|
||||
@RequestMapping(value = "/search/keyword", method = RequestMethod.GET)
|
||||
@@ -77,8 +89,6 @@ public class IndexController {
|
||||
|
||||
/**
|
||||
* 分享配置
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-25
|
||||
*/
|
||||
@ApiOperation(value = "分享配置")
|
||||
@RequestMapping(value = "/share", method = RequestMethod.GET)
|
||||
@@ -86,15 +96,6 @@ public class IndexController {
|
||||
return CommonResult.success(indexService.getShareConfig());
|
||||
}
|
||||
|
||||
/**
|
||||
* 公共配置 云智服
|
||||
* @return 公共配置
|
||||
*/
|
||||
@ApiOperation(value = "公共配置")
|
||||
@RequestMapping(value = "/config", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String,String>> getConfig(){
|
||||
return CommonResult.success(indexService.getCommConfig());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,9 @@ package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import com.common.CheckAdminToken;
|
||||
import com.common.CommonResult;
|
||||
import com.utils.CrmebUtil;
|
||||
import com.utils.ValidateFormUtil;
|
||||
import com.zbkj.crmeb.front.request.LoginMobileRequest;
|
||||
import com.zbkj.crmeb.front.request.LoginRequest;
|
||||
import com.zbkj.crmeb.front.request.RegisterRequest;
|
||||
import com.zbkj.crmeb.front.response.LoginResponse;
|
||||
import com.zbkj.crmeb.front.service.LoginService;
|
||||
import com.zbkj.crmeb.sms.service.SmsService;
|
||||
@@ -17,7 +15,6 @@ import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiImplicitParams;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
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.*;
|
||||
@@ -41,6 +38,7 @@ import javax.servlet.http.HttpServletRequest;
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "用户 -- 登录注册")
|
||||
public class LoginController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@@ -56,20 +54,15 @@ public class LoginController {
|
||||
|
||||
/**
|
||||
* 手机号登录接口
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "手机号登录接口")
|
||||
@RequestMapping(value = "/login/mobile", method = RequestMethod.POST)
|
||||
public CommonResult<LoginResponse> phoneLogin(@RequestBody @Validated LoginMobileRequest loginRequest, HttpServletRequest request) throws Exception {
|
||||
String clientIp = CrmebUtil.getClientIp(request);
|
||||
return CommonResult.success(loginService.phoneLogin(loginRequest, clientIp));
|
||||
public CommonResult<LoginResponse> phoneLogin(@RequestBody @Validated LoginMobileRequest loginRequest) throws Exception {
|
||||
return CommonResult.success(loginService.phoneLogin(loginRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 账号密码登录
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "账号密码登录")
|
||||
@RequestMapping(value = "/login", method = RequestMethod.POST)
|
||||
@@ -80,8 +73,6 @@ public class LoginController {
|
||||
|
||||
/**
|
||||
* 退出登录
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "退出")
|
||||
@RequestMapping(value = "/logout", method = RequestMethod.GET)
|
||||
|
||||
@@ -41,7 +41,6 @@ public class PayController {
|
||||
|
||||
/**
|
||||
* 订单支付
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "订单支付")
|
||||
@RequestMapping(value = "/payment", method = RequestMethod.POST)
|
||||
@@ -54,7 +53,6 @@ public class PayController {
|
||||
* 查询支付结果
|
||||
*
|
||||
* @param orderNo |订单编号|String|必填
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "查询支付结果")
|
||||
@RequestMapping(value = "/queryPayResult", method = RequestMethod.GET)
|
||||
|
||||
@@ -5,13 +5,9 @@ import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.category.vo.CategoryTreeVo;
|
||||
import com.zbkj.crmeb.front.request.IndexStoreProductSearchRequest;
|
||||
import com.zbkj.crmeb.front.request.ProductRequest;
|
||||
import com.zbkj.crmeb.front.response.ProductDetailResponse;
|
||||
import com.zbkj.crmeb.front.response.ProductResponse;
|
||||
import com.zbkj.crmeb.front.response.StoreProductReplayCountResponse;
|
||||
import com.zbkj.crmeb.front.response.*;
|
||||
import com.zbkj.crmeb.front.service.ProductService;
|
||||
import com.zbkj.crmeb.store.response.StoreProductReplyResponse;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -39,27 +35,30 @@ import java.util.List;
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "商品")
|
||||
public class ProductController {
|
||||
|
||||
@Autowired
|
||||
private ProductService productService;
|
||||
|
||||
/**
|
||||
* 热门商品推荐
|
||||
*/
|
||||
@ApiOperation(value = "热门商品推荐")
|
||||
@RequestMapping(value = "/product/hot", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getHotProductList(@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(productService.getHotProductList(pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 为你推荐
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-02
|
||||
* 优选商品推荐
|
||||
*/
|
||||
@ApiOperation(value = "为你推荐")
|
||||
@RequestMapping(value = "/product/hot", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ProductResponse>> getMenuUser(@Validated PageParamRequest pageParamRequest){
|
||||
IndexStoreProductSearchRequest request = new IndexStoreProductSearchRequest();
|
||||
request.setIsHot(true);
|
||||
return CommonResult.success(productService.getIndexProduct(request, pageParamRequest));
|
||||
@ApiOperation(value = "优选商品推荐")
|
||||
@RequestMapping(value = "/product/good", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getGoodProductList(){
|
||||
return CommonResult.success(productService.getGoodProductList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取分类
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
*/
|
||||
@ApiOperation(value = "获取分类")
|
||||
@RequestMapping(value = "/category", method = RequestMethod.GET)
|
||||
@@ -69,35 +68,30 @@ public class ProductController {
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
*/
|
||||
@ApiOperation(value = "商品列表")
|
||||
@RequestMapping(value = "/products", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<ProductResponse>> getList(@Validated ProductRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
public CommonResult<CommonPage<IndexProductResponse>> getList(@Validated ProductRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(productService.getList(request, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
*/
|
||||
@ApiOperation(value = "商品详情")
|
||||
@RequestMapping(value = "/product/detail/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<ProductDetailResponse> getDetail(@PathVariable Integer id){
|
||||
return CommonResult.success(productService.getDetail(id));
|
||||
@ApiImplicitParam(name = "type", value = "normal-正常,video-视频")
|
||||
public CommonResult<ProductDetailResponse> getDetail(@PathVariable Integer id, @RequestParam(value = "type", defaultValue = "normal") String type){
|
||||
return CommonResult.success(productService.getDetail(id, type));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品评论列表
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
*/
|
||||
@ApiOperation(value = "商品评论列表")
|
||||
@RequestMapping(value = "/reply/list/{id}", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "type", value = "评价等级|0=全部,1=好评,2=中评,3=差评", allowableValues = "range[0,1,2,3]")
|
||||
public CommonResult<CommonPage<StoreProductReplyResponse>> getReplyList(
|
||||
public CommonResult<CommonPage<ProductReplyResponse>> getReplyList(
|
||||
@PathVariable Integer id,
|
||||
@RequestParam(value = "type") Integer type,
|
||||
@Validated PageParamRequest pageParamRequest){
|
||||
@@ -106,14 +100,21 @@ public class ProductController {
|
||||
|
||||
/**
|
||||
* 商品评论数量
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-03
|
||||
*/
|
||||
@ApiOperation(value = "商品评论数量")
|
||||
@RequestMapping(value = "/reply/config/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<StoreProductReplayCountResponse> getReplyCount(@PathVariable Integer id){
|
||||
return CommonResult.success(productService.getReplyCount(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情评论
|
||||
*/
|
||||
@ApiOperation(value = "商品详情评论")
|
||||
@RequestMapping(value = "/reply/product/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<ProductDetailReplyResponse> getProductReply(@PathVariable Integer id){
|
||||
return CommonResult.success(productService.getProductReply(id));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -3,11 +3,10 @@ package com.zbkj.crmeb.front.controller;
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.express.model.Express;
|
||||
import com.zbkj.crmeb.front.response.SecKillResponse;
|
||||
import com.zbkj.crmeb.seckill.model.StoreSeckill;
|
||||
import com.zbkj.crmeb.front.response.SeckillIndexResponse;
|
||||
import com.zbkj.crmeb.front.response.StoreSecKillH5Response;
|
||||
import com.zbkj.crmeb.seckill.response.StoreSeckillDetailResponse;
|
||||
import com.zbkj.crmeb.seckill.response.StoreSeckillResponse;
|
||||
import com.zbkj.crmeb.seckill.service.StoreSeckillService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -15,7 +14,6 @@ import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -39,13 +37,23 @@ public class SecKillController {
|
||||
@Autowired
|
||||
StoreSeckillService storeSeckillService;
|
||||
|
||||
/**
|
||||
* 秒杀首页数据
|
||||
* @return 可秒杀配置
|
||||
*/
|
||||
@ApiOperation(value = "秒杀首页数据")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<SeckillIndexResponse> index(){
|
||||
return CommonResult.success(storeSeckillService.getIndexInfo());
|
||||
}
|
||||
|
||||
/**
|
||||
* 秒杀Index
|
||||
* @return 可秒杀配置
|
||||
*/
|
||||
@ApiOperation(value = "秒杀Header")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String,Object>> index(){
|
||||
@RequestMapping(value = "/header", method = RequestMethod.GET)
|
||||
public CommonResult<List<SecKillResponse>> header(){
|
||||
return CommonResult.success(storeSeckillService.getForH5Index());
|
||||
}
|
||||
|
||||
@@ -55,10 +63,8 @@ public class SecKillController {
|
||||
*/
|
||||
@ApiOperation(value = "秒杀列表")
|
||||
@RequestMapping(value = "/list/{timeId}", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreSeckillResponse>> list(@PathVariable("timeId") String timeId, @ModelAttribute PageParamRequest pageParamRequest){
|
||||
CommonPage<StoreSeckillResponse> secKillCommonPage =
|
||||
CommonPage.restPage(storeSeckillService.getKillListByTimeId(timeId,pageParamRequest,true));
|
||||
return CommonResult.success(secKillCommonPage);
|
||||
public CommonResult<CommonPage<StoreSecKillH5Response>> list(@PathVariable("timeId") String timeId, @ModelAttribute PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(storeSeckillService.getKillListByTimeId(timeId, pageParamRequest)));
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.MyRecord;
|
||||
import com.common.PageParamRequest;
|
||||
import com.utils.CrmebUtil;
|
||||
import com.zbkj.crmeb.front.request.*;
|
||||
import com.zbkj.crmeb.front.response.ConfirmOrderResponse;
|
||||
import com.zbkj.crmeb.front.response.*;
|
||||
import com.zbkj.crmeb.front.service.OrderService;
|
||||
import com.zbkj.crmeb.front.vo.OrderAgainVo;
|
||||
import com.zbkj.crmeb.store.request.StoreProductReplyAddRequest;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -17,7 +17,6 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -43,62 +42,40 @@ public class StoreOrderController {
|
||||
private OrderService orderService;
|
||||
|
||||
/**
|
||||
* 根据购物车id确认订单
|
||||
* @param request 购物车id集合
|
||||
* @return 订单确认结果
|
||||
* 预下单
|
||||
*/
|
||||
@ApiOperation(value = "确认订单")
|
||||
@RequestMapping(value = "/confirm", method = RequestMethod.POST)
|
||||
public CommonResult<ConfirmOrderResponse> OrderConForm(@RequestBody @Validated ConfirmOrderRequest request){
|
||||
return CommonResult.success(orderService.confirmOrder(request));
|
||||
@ApiOperation(value = "预下单")
|
||||
@RequestMapping(value = "/pre/order", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> preOrder(@RequestBody @Validated PreOrderRequest request) {
|
||||
MyRecord record = orderService.preOrder(request);
|
||||
return CommonResult.success(record);
|
||||
}
|
||||
|
||||
/**
|
||||
* 生成订单
|
||||
* @param key 订单key或者订单id
|
||||
* @param request 创建订单参数
|
||||
* @return 创建订单后的标识
|
||||
* 加载预下单
|
||||
*/
|
||||
@ApiOperation(value = "生成订单")
|
||||
@RequestMapping(value = "/create/{key}", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> createOrder(@PathVariable String key, @Validated @RequestBody OrderCreateRequest orderRequest, HttpServletRequest request){
|
||||
return CommonResult.success(orderService.createOrder(orderRequest, key));
|
||||
@ApiOperation(value = "加载预下单")
|
||||
@RequestMapping(value = "load/pre/{preOrderNo}", method = RequestMethod.GET)
|
||||
public CommonResult<PreOrderResponse> preOrder(@PathVariable String preOrderNo) {
|
||||
return CommonResult.success(orderService.loadPreOrder(preOrderNo));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据参数计算订单价格
|
||||
* @param key 订单key
|
||||
* @param request 订单参数
|
||||
* @return 价格数据
|
||||
*/
|
||||
@ApiOperation(value = "计算价格")
|
||||
@RequestMapping(value = "/computed/{key}", method = RequestMethod.POST)
|
||||
public CommonResult<Object> computed(@PathVariable String key, @Validated @RequestBody OrderComputedRequest request){
|
||||
return CommonResult.success(orderService.computedOrder(request, key));
|
||||
|
||||
@ApiOperation(value = "计算订单价格")
|
||||
@RequestMapping(value = "/computed/price", method = RequestMethod.POST)
|
||||
public CommonResult<ComputedOrderPriceResponse> computedPrice(@Validated @RequestBody OrderComputedPriceRequest request){
|
||||
return CommonResult.success(orderService.computedOrderPrice(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 重复下单
|
||||
* @param request 下单参数
|
||||
* @return 下单结果
|
||||
* 创建订单
|
||||
*/
|
||||
@ApiOperation(value = "再次下单")
|
||||
@RequestMapping(value = "/again", method = RequestMethod.POST)
|
||||
public CommonResult<Object> orderAgain(@Validated @RequestBody OrderAgainRequest request){
|
||||
return CommonResult.success(orderService.againOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付
|
||||
* @param orderPayRequest 支付参数
|
||||
* @return 支付结果
|
||||
*/
|
||||
@ApiOperation(value = "支付")
|
||||
@RequestMapping(value = "/pay", method = RequestMethod.POST)
|
||||
public CommonResult<Object> pay(@Validated @RequestBody OrderPayRequest orderPayRequest, HttpServletRequest request){
|
||||
String ip = CrmebUtil.getClientIp(request);
|
||||
return CommonResult.success(orderService.payOrder(orderPayRequest,ip));
|
||||
@ApiOperation(value = "创建订单")
|
||||
@RequestMapping(value = "/create", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> createOrder(@Validated @RequestBody CreateOrderRequest orderRequest){
|
||||
return CommonResult.success(orderService.createOrder(orderRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -112,7 +89,7 @@ public class StoreOrderController {
|
||||
@ApiImplicitParams ({
|
||||
@ApiImplicitParam(name = "type", value = "评价等级|0=未支付,1=待发货,2=待收货,3=待评价,4=已完成,-3=售后/退款", required = true)
|
||||
})
|
||||
public CommonResult<List<OrderAgainVo>> orderList(
|
||||
public CommonResult<CommonPage<OrderDetailResponse>> orderList(
|
||||
@RequestParam(name = "type") Integer type,
|
||||
@ModelAttribute PageParamRequest pageRequest){
|
||||
return CommonResult.success(orderService.list(type, pageRequest));
|
||||
@@ -125,7 +102,7 @@ public class StoreOrderController {
|
||||
*/
|
||||
@ApiOperation(value = "订单详情")
|
||||
@RequestMapping(value = "/detail/{orderId}", method = RequestMethod.GET)
|
||||
public CommonResult<Object> orderDetail(@PathVariable String orderId){
|
||||
public CommonResult<StoreOrderDetailResponse> orderDetail(@PathVariable String orderId){
|
||||
return CommonResult.success(orderService.detailOrder(orderId));
|
||||
}
|
||||
|
||||
@@ -135,7 +112,7 @@ public class StoreOrderController {
|
||||
*/
|
||||
@ApiOperation(value = "订单头部数量")
|
||||
@RequestMapping(value = "/data", method = RequestMethod.GET)
|
||||
public CommonResult<Object> orderData(){
|
||||
public CommonResult<OrderDataResponse> orderData(){
|
||||
return CommonResult.success(orderService.orderData());
|
||||
}
|
||||
|
||||
@@ -161,9 +138,6 @@ public class StoreOrderController {
|
||||
@ApiOperation(value = "评价订单")
|
||||
@RequestMapping(value = "/comment", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> comment(@RequestBody @Validated StoreProductReplyAddRequest request){
|
||||
if(null == request.getOid() || request.getOid() < 1){
|
||||
return CommonResult.validateFailed("订单号参数不能为空");
|
||||
}
|
||||
if(orderService.reply(request)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
@@ -199,6 +173,16 @@ public class StoreOrderController {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 申请订单退款
|
||||
* @param orderId 订单编号
|
||||
*/
|
||||
@ApiOperation(value = "订单退款申请")
|
||||
@RequestMapping(value = "/apply/refund/{orderId}", method = RequestMethod.GET)
|
||||
public CommonResult<ApplyRefundOrderInfoResponse> refundApplyOrder(@PathVariable String orderId){
|
||||
return CommonResult.success(orderService.applyRefundOrderInfo(orderId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单退款申请
|
||||
* @param request OrderRefundApplyRequest 订单id
|
||||
@@ -219,7 +203,7 @@ public class StoreOrderController {
|
||||
*/
|
||||
@ApiOperation(value = "订单退款理由")
|
||||
@RequestMapping(value = "/refund/reason", method = RequestMethod.GET)
|
||||
public CommonResult<Object> refundReason(){
|
||||
public CommonResult<List<String>> refundReason(){
|
||||
return CommonResult.success(orderService.getRefundReason());
|
||||
}
|
||||
|
||||
@@ -236,7 +220,7 @@ public class StoreOrderController {
|
||||
|
||||
@ApiOperation(value = "待评价商品信息查询")
|
||||
@RequestMapping(value = "/product", method = RequestMethod.POST)
|
||||
public CommonResult<Object> getOrderProductForReply(@Validated @RequestBody GetProductReply request){
|
||||
public CommonResult<OrderProductReplyResponse> getOrderProductForReply(@Validated @RequestBody GetProductReply request){
|
||||
return CommonResult.success(orderService.getReplyProduct(request));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.zbkj.crmeb.front.request.UserAddressDelRequest;
|
||||
import com.zbkj.crmeb.front.request.UserAddressRequest;
|
||||
import com.zbkj.crmeb.user.model.UserAddress;
|
||||
import com.zbkj.crmeb.user.service.UserAddressService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
@@ -37,31 +36,19 @@ public class UserAddressController {
|
||||
@Autowired
|
||||
private UserAddressService userAddressService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
|
||||
/**
|
||||
* 分页显示用户地址
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserAddress>> getList(PageParamRequest pageParamRequest){
|
||||
// CommonPage<UserAddress> userAddressCommonPage = CommonPage.restPage(userAddressService.getList(pageParamRequest));
|
||||
UserAddress userAddress = new UserAddress();
|
||||
userAddress.setUid(userService.getUserId());
|
||||
userAddress.setIsDel(false);
|
||||
CommonPage<UserAddress> userAddressCommonPage = CommonPage.restPage(userAddressService.getListByUserAddress(userAddress,pageParamRequest));
|
||||
return CommonResult.success(userAddressCommonPage);
|
||||
return CommonResult.success(CommonPage.restPage(userAddressService.getList(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增用户地址
|
||||
* @param request 新增参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "保存")
|
||||
@RequestMapping(value = "/edit", method = RequestMethod.POST)
|
||||
@@ -72,8 +59,6 @@ public class UserAddressController {
|
||||
/**
|
||||
* 删除用户地址
|
||||
* @param request UserAddressDelRequest 参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "删除")
|
||||
@RequestMapping(value = "/del", method = RequestMethod.POST)
|
||||
@@ -86,22 +71,16 @@ public class UserAddressController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 详情
|
||||
* @param id Integer
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
* 地址详情
|
||||
*/
|
||||
@ApiOperation(value = "获取单个地址")
|
||||
@ApiOperation(value = "地址详情")
|
||||
@RequestMapping(value = "/detail/{id}", method = RequestMethod.GET)
|
||||
public CommonResult<UserAddress> info(@PathVariable("id") Integer id){
|
||||
UserAddress userAddress = userAddressService.getById(id);
|
||||
return CommonResult.success(userAddress);
|
||||
return CommonResult.success(userAddressService.getDetail(id));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取默认地址
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "获取默认地址")
|
||||
@RequestMapping(value = "/default", method = RequestMethod.GET)
|
||||
@@ -113,8 +92,6 @@ public class UserAddressController {
|
||||
/**
|
||||
* 设置默认地址
|
||||
* @param request UserAddressDelRequest 参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "设置默认地址")
|
||||
@RequestMapping(value = "/default/set", method = RequestMethod.POST)
|
||||
|
||||
@@ -5,9 +5,8 @@ import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.front.request.UserCollectAllRequest;
|
||||
import com.zbkj.crmeb.front.request.UserCollectRequest;
|
||||
import com.zbkj.crmeb.store.model.StoreProduct;
|
||||
import com.zbkj.crmeb.front.response.UserRelationResponse;
|
||||
import com.zbkj.crmeb.store.model.StoreProductRelation;
|
||||
import com.zbkj.crmeb.store.request.StoreProductRelationSearchRequest;
|
||||
import com.zbkj.crmeb.store.service.StoreProductRelationService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
@@ -45,27 +44,17 @@ public class UserCollectController {
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 获取收藏产品
|
||||
* @param pageParamRequest 分页参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-06
|
||||
* 我的收藏列表
|
||||
*/
|
||||
@ApiOperation(value = "获取收藏产品")
|
||||
@ApiOperation(value = "我的收藏列表")
|
||||
@RequestMapping(value = "/user", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<StoreProduct>> getList(@Validated PageParamRequest pageParamRequest){
|
||||
StoreProductRelationSearchRequest storeProductRelation = new StoreProductRelationSearchRequest();
|
||||
storeProductRelation.setUid(userService.getUserIdException());
|
||||
|
||||
CommonPage<StoreProduct> storeProductCommonPage =
|
||||
CommonPage.restPage(storeProductRelationService.getList(storeProductRelation, pageParamRequest));
|
||||
return CommonResult.success(storeProductCommonPage);
|
||||
public CommonResult<CommonPage<UserRelationResponse>> getList(@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(storeProductRelationService.getUserList(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加收藏产品
|
||||
* @param request StoreProductRelationRequest 新增参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-06
|
||||
*/
|
||||
@ApiOperation(value = "添加收藏产品")
|
||||
@RequestMapping(value = "/add", method = RequestMethod.POST)
|
||||
@@ -83,8 +72,6 @@ public class UserCollectController {
|
||||
/**
|
||||
* 添加收藏产品
|
||||
* @param request UserCollectAllRequest 新增参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-06
|
||||
*/
|
||||
@ApiOperation(value = "批量收藏")
|
||||
@RequestMapping(value = "/all", method = RequestMethod.POST)
|
||||
@@ -98,13 +85,24 @@ public class UserCollectController {
|
||||
|
||||
/**
|
||||
* 取消收藏产品
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-06
|
||||
*/
|
||||
@ApiOperation(value = "取消收藏产品")
|
||||
@RequestMapping(value = "/del", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@RequestBody @Validated UserCollectRequest request){
|
||||
if(storeProductRelationService.delete(request)){
|
||||
@RequestMapping(value = "/delete", method = RequestMethod.POST)
|
||||
public CommonResult<String> delete(@RequestBody String requestJson){
|
||||
if(storeProductRelationService.delete(requestJson)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 取消收藏产品(通过商品)
|
||||
*/
|
||||
@ApiOperation(value = "取消收藏产品(通过商品)")
|
||||
@RequestMapping(value = "/cancel/{proId}", method = RequestMethod.POST)
|
||||
public CommonResult<String> cancel(@PathVariable Integer proId){
|
||||
if(storeProductRelationService.deleteByProId(proId)){
|
||||
return CommonResult.success();
|
||||
}else{
|
||||
return CommonResult.failed();
|
||||
|
||||
@@ -4,11 +4,10 @@ package com.zbkj.crmeb.front.controller;
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.constants.Constants;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.crmeb.finance.request.UserExtractRequest;
|
||||
import com.zbkj.crmeb.front.request.PasswordRequest;
|
||||
import com.zbkj.crmeb.front.request.UserBindingRequest;
|
||||
import com.zbkj.crmeb.front.request.UserBindingPhoneUpdateRequest;
|
||||
import com.zbkj.crmeb.front.request.UserEditRequest;
|
||||
import com.zbkj.crmeb.front.request.UserSpreadPeopleRequest;
|
||||
import com.zbkj.crmeb.front.response.*;
|
||||
@@ -18,6 +17,7 @@ import com.zbkj.crmeb.system.service.SystemAttachmentService;
|
||||
import com.zbkj.crmeb.system.service.SystemGroupDataService;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import com.zbkj.crmeb.user.model.UserBill;
|
||||
import com.zbkj.crmeb.user.model.UserIntegralRecord;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
@@ -49,6 +49,7 @@ import java.util.Map;
|
||||
@RequestMapping("api/front")
|
||||
@Api(tags = "用户 -- 用户中心")
|
||||
public class UserController {
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
@@ -87,36 +88,30 @@ public class UserController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户个人资料
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
* 个人中心-用户信息
|
||||
*/
|
||||
@ApiOperation(value = "获取个人资料")
|
||||
@ApiOperation(value = "个人中心-用户信息")
|
||||
@RequestMapping(value = "/user", method = RequestMethod.GET)
|
||||
public CommonResult<UserCenterResponse> getUserCenter(){
|
||||
return CommonResult.success(userService.getUserCenter());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户个人资料
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
* 换绑手机号校验
|
||||
*/
|
||||
@ApiOperation(value = "当前登录用户信息")
|
||||
@RequestMapping(value = "/userinfo", method = RequestMethod.GET)
|
||||
public CommonResult<User> getInfo(){
|
||||
return CommonResult.success(userService.getUserPromoter());
|
||||
@ApiOperation(value = "换绑手机号校验")
|
||||
@RequestMapping(value = "update/binding/verify", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> updatePhoneVerify(@RequestBody @Validated UserBindingPhoneUpdateRequest request){
|
||||
return CommonResult.success(userService.updatePhoneVerify(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定手机号
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-28
|
||||
*/
|
||||
@ApiOperation(value = "绑定手机号")
|
||||
@RequestMapping(value = "/binding", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> bind(@RequestBody @Validated UserBindingRequest request){
|
||||
return CommonResult.success(userService.bind(request));
|
||||
@ApiOperation(value = "换绑手机号")
|
||||
@RequestMapping(value = "update/binding", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> updatePhone(@RequestBody @Validated UserBindingPhoneUpdateRequest request){
|
||||
return CommonResult.success(userService.updatePhone(request));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -127,17 +122,11 @@ public class UserController {
|
||||
@ApiOperation(value = "获取个人中心菜单")
|
||||
@RequestMapping(value = "/menu/user", method = RequestMethod.GET)
|
||||
public CommonResult<HashMap<String, Object>> getMenuUser(){
|
||||
|
||||
HashMap<String, Object> map = new HashMap<>();
|
||||
map.put("routine_my_menus", systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_USER_CENTER_MENU));
|
||||
map.put("routine_my_banner", systemGroupDataService.getListMapByGid(Constants.GROUP_DATA_ID_USER_CENTER_BANNER));
|
||||
return CommonResult.success(map);
|
||||
return CommonResult.success(systemGroupDataService.getMenuUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广数据接口(昨天的佣金 累计提现金额 当前佣金)
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-08
|
||||
*/
|
||||
@ApiOperation(value = "推广数据接口(昨天的佣金 累计提现金额 当前佣金)")
|
||||
@RequestMapping(value = "/commission", method = RequestMethod.GET)
|
||||
@@ -145,18 +134,6 @@ public class UserController {
|
||||
return CommonResult.success(userCenterService.getCommission());
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 推广佣金明细
|
||||
// * @author Mr.Zhang
|
||||
// * @since 2020-06-08
|
||||
// */
|
||||
// @ApiOperation(value = "推广佣金明细")
|
||||
// @RequestMapping(value = "/spread/commission/{type}", method = RequestMethod.GET)
|
||||
// @ApiImplicitParam(name = "type", value = "类型 佣金类型|0=全部,1=消费,2=充值,3=返佣,4=提现", allowableValues = "range[0,1,2,3,4]", dataType = "int")
|
||||
// public CommonResult<CommonPage<UserSpreadCommissionResponse>> getSpreadCommissionByType(@PathVariable int type, @Validated PageParamRequest pageParamRequest){
|
||||
// return CommonResult.success(CommonPage.restPage(userCenterService.getSpreadCommissionByType(type, pageParamRequest)));
|
||||
// }
|
||||
|
||||
/**
|
||||
* 推广佣金明细
|
||||
*/
|
||||
@@ -194,9 +171,6 @@ public class UserController {
|
||||
|
||||
/**
|
||||
* 提现记录
|
||||
* @author HZW
|
||||
* @since 2020-10-27
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "提现记录")
|
||||
@RequestMapping(value = "/extract/record", method = RequestMethod.GET)
|
||||
@@ -205,28 +179,21 @@ public class UserController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现总金额
|
||||
* @author HZW
|
||||
* @since 2020-10-27
|
||||
* @return
|
||||
* 提现用户信息
|
||||
*/
|
||||
@ApiOperation(value = "提现总金额")
|
||||
@RequestMapping(value = "/extract/totalMoney", method = RequestMethod.GET)
|
||||
public CommonResult<Map<String, BigDecimal>> getTotalMoney(){
|
||||
Map<String, BigDecimal> map = new HashMap<>();
|
||||
map.put("count", userCenterService.getExtractTotalMoney());
|
||||
return CommonResult.success(map);
|
||||
@ApiOperation(value = "提现用户信息")
|
||||
@RequestMapping(value = "/extract/user", method = RequestMethod.GET)
|
||||
public CommonResult<UserExtractCashResponse> getExtractUser(){
|
||||
return CommonResult.success(userCenterService.getExtractUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现银行/提现最低金额
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-06-08
|
||||
* 提现银行
|
||||
*/
|
||||
@ApiOperation(value = "提现银行/提现最低金额")
|
||||
@RequestMapping(value = "/extract/bank", method = RequestMethod.GET)
|
||||
public CommonResult<UserExtractCashResponse> minExtractCash(){
|
||||
return CommonResult.success(userCenterService.minExtractCash());
|
||||
public CommonResult<List<String>> getExtractBank(){
|
||||
return CommonResult.success(userCenterService.getExtractBank());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -236,41 +203,55 @@ public class UserController {
|
||||
*/
|
||||
@ApiOperation(value = "会员等级列表")
|
||||
@RequestMapping(value = "/user/level/grade", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<SystemUserLevel>> getUserLevelList(){
|
||||
return CommonResult.success(CommonPage.restPage(userCenterService.getUserLevelList()));
|
||||
public CommonResult<List<SystemUserLevel>> getUserLevelList(){
|
||||
return CommonResult.success(userCenterService.getUserLevelList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广用户
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
* 推广人统计
|
||||
*/
|
||||
@ApiOperation(value = "推广用户")
|
||||
@ApiOperation(value = "推广人统计")
|
||||
@RequestMapping(value = "/spread/people/count", method = RequestMethod.GET)
|
||||
public CommonResult<UserSpreadPeopleResponse> getSpreadPeopleCount(){
|
||||
return CommonResult.success(userCenterService.getSpreadPeopleCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* 推广人列表
|
||||
*/
|
||||
@ApiOperation(value = "推广人列表")
|
||||
@RequestMapping(value = "/spread/people", method = RequestMethod.GET)
|
||||
public CommonResult<UserSpreadPeopleResponse> getSpreadPeopleList(@Validated UserSpreadPeopleRequest request, @Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(userCenterService.getSpreadPeopleList(request, pageParamRequest));
|
||||
public CommonResult<CommonPage<UserSpreadPeopleItemResponse>> getSpreadPeopleList(@Validated UserSpreadPeopleRequest request, @Validated PageParamRequest pageParamRequest) {
|
||||
List<UserSpreadPeopleItemResponse> spreadPeopleList = userCenterService.getSpreadPeopleList(request, pageParamRequest);
|
||||
CommonPage<UserSpreadPeopleItemResponse> commonPage = CommonPage.restPage(spreadPeopleList);
|
||||
return CommonResult.success(commonPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户积分信息
|
||||
*/
|
||||
@ApiOperation(value = "用户积分信息")
|
||||
@RequestMapping(value = "/integral/user", method = RequestMethod.GET)
|
||||
public CommonResult<IntegralUserResponse> getIntegralUser(){
|
||||
return CommonResult.success(userCenterService.getIntegralUser());
|
||||
}
|
||||
|
||||
/**
|
||||
* 积分记录
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
*/
|
||||
@ApiOperation(value = "积分记录")
|
||||
@RequestMapping(value = "/integral/list", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserBill>> getIntegralList(@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(userCenterService.getUserBillList(Constants.USER_BILL_CATEGORY_INTEGRAL, pageParamRequest)));
|
||||
public CommonResult<CommonPage<UserIntegralRecord>> getIntegralList(@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(userCenterService.getUserIntegralRecordList(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
* 经验记录
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
*/
|
||||
@ApiOperation(value = "经验记录")
|
||||
@RequestMapping(value = "/user/expList", method = RequestMethod.GET)
|
||||
public CommonResult<CommonPage<UserBill>> getExperienceList(@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(userCenterService.getUserBillList(Constants.USER_BILL_CATEGORY_EXPERIENCE, pageParamRequest)));
|
||||
public CommonResult<CommonPage<UserBill>> getExperienceList(@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(CommonPage.restPage(userCenterService.getUserExperienceList(pageParamRequest)));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -300,7 +281,7 @@ public class UserController {
|
||||
* @return List<User>
|
||||
*/
|
||||
@ApiOperation(value = "推广人排行")
|
||||
@RequestMapping(value = "rank", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/rank", method = RequestMethod.GET)
|
||||
public CommonResult<List<User>> getTopSpreadPeopleListByDate(@RequestParam(required = false) String type, @Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(userCenterService.getTopSpreadPeopleListByDate(type, pageParamRequest));
|
||||
}
|
||||
@@ -310,7 +291,7 @@ public class UserController {
|
||||
* @return 优惠券集合
|
||||
*/
|
||||
@ApiOperation(value = "佣金排行")
|
||||
@RequestMapping(value = "brokerage_rank", method = RequestMethod.GET)
|
||||
@RequestMapping(value = "/brokerage_rank", method = RequestMethod.GET)
|
||||
public CommonResult<List<User>> getTopBrokerageListByDate(@RequestParam String type, @Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(userCenterService.getTopBrokerageListByDate(type, pageParamRequest));
|
||||
}
|
||||
@@ -337,14 +318,14 @@ public class UserController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 绑定推广人
|
||||
* 绑定推广关系(登录状态)
|
||||
* @param spreadPid 推广id
|
||||
* @return 绑定结果
|
||||
*/
|
||||
@ApiOperation(value = "绑定推广人")
|
||||
@ApiOperation(value = "绑定推广关系(登录状态)")
|
||||
@RequestMapping(value = "/user/bindSpread", method = RequestMethod.GET)
|
||||
public CommonResult<Boolean> bindsSpread(Integer spreadPid){
|
||||
userService.bindSpread(userService.getInfo(),spreadPid);
|
||||
userService.bindSpread(spreadPid);
|
||||
return CommonResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,23 +1,19 @@
|
||||
package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.front.request.UserCouponReceiveRequest;
|
||||
import com.zbkj.crmeb.marketing.request.StoreCouponUserRequest;
|
||||
import com.zbkj.crmeb.marketing.response.StoreCouponUserResponse;
|
||||
import com.zbkj.crmeb.marketing.service.StoreCouponUserService;
|
||||
import com.zbkj.crmeb.user.service.UserService;
|
||||
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.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 优惠卷控制器
|
||||
@@ -40,18 +36,19 @@ public class UserCouponController {
|
||||
@Autowired
|
||||
private StoreCouponUserService storeCouponUserService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 我的优惠券
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
*/
|
||||
@ApiOperation(value = "我的优惠券")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
public CommonResult<List<StoreCouponUserResponse>> getList(){
|
||||
return CommonResult.success(storeCouponUserService.getListFront(userService.getUserIdException(), new PageParamRequest()));
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name="type", value="类型,usable-可用,unusable-不可用", required = true),
|
||||
@ApiImplicitParam(name="page", value="页码", required = true),
|
||||
@ApiImplicitParam(name="limit", value="每页数量", required = true)
|
||||
})
|
||||
public CommonResult<CommonPage<StoreCouponUserResponse>> getList(@RequestParam(value = "type") String type,
|
||||
@Validated PageParamRequest pageParamRequest){
|
||||
return CommonResult.success(storeCouponUserService.getMyCouponList(type, pageParamRequest));
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -46,8 +46,6 @@ public class UserRechargeController {
|
||||
|
||||
/**
|
||||
* 充值额度选择
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
*/
|
||||
@ApiOperation(value = "充值额度选择")
|
||||
@RequestMapping(value = "/index", method = RequestMethod.GET)
|
||||
@@ -57,14 +55,11 @@ public class UserRechargeController {
|
||||
|
||||
/**
|
||||
* 充值
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
*/
|
||||
@ApiOperation(value = "小程序充值")
|
||||
@RequestMapping(value = "/routine", method = RequestMethod.POST)
|
||||
public CommonResult<Map<String, Object>> routineRecharge(HttpServletRequest httpServletRequest, @RequestBody @Validated UserRechargeRequest request){
|
||||
request.setFromType(Constants.PAY_TYPE_WE_CHAT_FROM_PROGRAM);
|
||||
// UserRechargePaymentResponse responseVo = userCenterService.recharge(request);
|
||||
OrderPayResultResponse recharge = userCenterService.recharge(request);
|
||||
request.setClientIp(CrmebUtil.getClientIp(httpServletRequest));
|
||||
|
||||
@@ -76,9 +71,6 @@ public class UserRechargeController {
|
||||
|
||||
/**
|
||||
* 充值
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "公众号充值")
|
||||
@RequestMapping(value = "/wechat", method = RequestMethod.POST)
|
||||
@@ -88,11 +80,19 @@ public class UserRechargeController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 佣金转入余额
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-18
|
||||
* App充值
|
||||
*/
|
||||
@ApiOperation(value = "余额转入")
|
||||
@ApiOperation(value = "App充值")
|
||||
@RequestMapping(value = "/wechat/app", method = RequestMethod.POST)
|
||||
public CommonResult<OrderPayResultResponse> weChatAppRecharge(HttpServletRequest httpServletRequest, @RequestBody @Validated UserRechargeRequest request){
|
||||
request.setClientIp(CrmebUtil.getClientIp(httpServletRequest));
|
||||
return CommonResult.success(userCenterService.recharge(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 佣金转入余额
|
||||
*/
|
||||
@ApiOperation(value = "佣金转入余额")
|
||||
@RequestMapping(value = "/transferIn", method = RequestMethod.POST)
|
||||
public CommonResult<Boolean> transferIn(@RequestParam(name = "price") BigDecimal price){
|
||||
return CommonResult.success(userCenterService.transferIn(price));
|
||||
@@ -100,7 +100,6 @@ public class UserRechargeController {
|
||||
|
||||
/**
|
||||
* 用户账单记录
|
||||
* @return
|
||||
*/
|
||||
@ApiOperation(value = "用户账单记录")
|
||||
@RequestMapping(value = "/bill/record", method = RequestMethod.GET)
|
||||
|
||||
@@ -3,7 +3,6 @@ package com.zbkj.crmeb.front.controller;
|
||||
import com.common.CommonPage;
|
||||
import com.common.CommonResult;
|
||||
import com.common.PageParamRequest;
|
||||
import com.zbkj.crmeb.front.request.UserSignInfoRequest;
|
||||
import com.zbkj.crmeb.front.response.UserSignInfoResponse;
|
||||
import com.zbkj.crmeb.system.vo.SystemGroupDataSignConfigVo;
|
||||
import com.zbkj.crmeb.user.service.UserSignService;
|
||||
@@ -14,7 +13,6 @@ import io.swagger.annotations.ApiOperation;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
@@ -46,8 +44,6 @@ public class UserSignController {
|
||||
/**
|
||||
* 签到列表
|
||||
* @param pageParamRequest 分页参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-30
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/list", method = RequestMethod.GET)
|
||||
@@ -59,8 +55,6 @@ public class UserSignController {
|
||||
/**
|
||||
* 签到列表,年月纬度
|
||||
* @param pageParamRequest 分页参数
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-30
|
||||
*/
|
||||
@ApiOperation(value = "分页列表")
|
||||
@RequestMapping(value = "/month", method = RequestMethod.GET)
|
||||
@@ -71,8 +65,6 @@ public class UserSignController {
|
||||
|
||||
/**
|
||||
* 配置
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-30
|
||||
*/
|
||||
@ApiOperation(value = "配置")
|
||||
@RequestMapping(value = "/config", method = RequestMethod.GET)
|
||||
@@ -83,8 +75,6 @@ public class UserSignController {
|
||||
|
||||
/**
|
||||
* 查询签到记录表信息
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-30
|
||||
*/
|
||||
@ApiOperation(value = "签到")
|
||||
@RequestMapping(value = "/integral", method = RequestMethod.GET)
|
||||
@@ -94,8 +84,6 @@ public class UserSignController {
|
||||
|
||||
/**
|
||||
* 查询签到记录表信息
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-30
|
||||
*/
|
||||
@ApiOperation(value = "详情")
|
||||
@RequestMapping(value = "/get", method = RequestMethod.GET)
|
||||
@@ -104,14 +92,12 @@ public class UserSignController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询签到记录表信息
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-04-30
|
||||
* 签到用户信息
|
||||
*/
|
||||
@ApiOperation(value = "签到用户信息")
|
||||
@RequestMapping(value = "/user", method = RequestMethod.POST)
|
||||
public CommonResult<UserSignInfoResponse> getUserInfo(@RequestBody @Validated UserSignInfoRequest request){
|
||||
return CommonResult.success(userSignService.getUserInfo(request));
|
||||
public CommonResult<UserSignInfoResponse> getUserInfo(){
|
||||
return CommonResult.success(userSignService.getUserSignInfo());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,15 +1,14 @@
|
||||
package com.zbkj.crmeb.front.controller;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.common.CommonResult;
|
||||
import com.zbkj.crmeb.front.request.RegisterAppWxRequest;
|
||||
import com.zbkj.crmeb.front.request.WxBindingPhoneRequest;
|
||||
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.service.TemplateMessageService;
|
||||
import com.zbkj.crmeb.wechat.service.WeChatService;
|
||||
import com.zbkj.crmeb.wechat.service.WechatProgramMyTempService;
|
||||
import io.swagger.annotations.Api;
|
||||
import io.swagger.annotations.ApiImplicitParam;
|
||||
import io.swagger.annotations.ApiOperation;
|
||||
@@ -50,23 +49,6 @@ public class WeChatController {
|
||||
@Autowired
|
||||
private TemplateMessageService templateMessageService;
|
||||
|
||||
@Autowired
|
||||
private WechatProgramMyTempService wechatProgramMyTempService;
|
||||
|
||||
/**
|
||||
* 获取授权页面跳转地址
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-25
|
||||
*/
|
||||
@ApiOperation(value = "获取授权页面跳转地址")
|
||||
@RequestMapping(value = "/authorize/get", method = RequestMethod.GET)
|
||||
public CommonResult<Object> get(){
|
||||
log.info("获取微信授权页面跳转地址");
|
||||
String authorizeUrl = weChatService.getAuthorizeUrl();
|
||||
log.info("授权地址:"+authorizeUrl);
|
||||
return CommonResult.success(authorizeUrl);
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过微信code登录
|
||||
* @author Mr.Zhang
|
||||
@@ -76,7 +58,6 @@ public class WeChatController {
|
||||
@RequestMapping(value = "/authorize/login", method = RequestMethod.GET)
|
||||
public CommonResult<LoginResponse> login(@RequestParam(value = "spread_spid", defaultValue = "0", required = false) Integer spreadUid,
|
||||
@RequestParam(value = "code") String code){
|
||||
log.info(StrUtil.format("微信登录公共号授权登录:spreadUid={},code={}",spreadUid,code));
|
||||
return CommonResult.success(userCenterService.weChatAuthorizeLogin(code, spreadUid));
|
||||
}
|
||||
|
||||
@@ -85,25 +66,32 @@ public class WeChatController {
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-25
|
||||
*/
|
||||
|
||||
@ApiOperation(value = "微信登录小程序授权登录")
|
||||
@RequestMapping(value = "/authorize/program/login", method = RequestMethod.POST)
|
||||
public CommonResult<LoginResponse> programLogin(@RequestParam String code, @RequestBody @Validated RegisterThirdUserRequest request){
|
||||
log.info(StrUtil.format("微信小程序授权登录:code={},request={}",code, JSON.toJSONString(request)));
|
||||
return CommonResult.success(userCenterService.weChatAuthorizeProgramLogin(code, request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 微信注册绑定手机号
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-25
|
||||
*/
|
||||
@ApiOperation(value = "微信注册绑定手机号")
|
||||
@RequestMapping(value = "/register/binding/phone", method = RequestMethod.POST)
|
||||
public CommonResult<LoginResponse> registerBindingPhone(@RequestBody @Validated WxBindingPhoneRequest request){
|
||||
return CommonResult.success(userCenterService.registerBindingPhone(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取微信公众号js配置
|
||||
* @author Mr.Zhang
|
||||
* @since 2020-05-25
|
||||
*/
|
||||
@ApiOperation(value = "获取微信js配置")
|
||||
@ApiOperation(value = "获取微信公众号js配置")
|
||||
@RequestMapping(value = "/config", method = RequestMethod.GET)
|
||||
@ApiImplicitParam(name = "url", value = "页面地址url")
|
||||
public CommonResult<Object> configJs(@RequestParam(value = "url") String url){
|
||||
log.info("获取微信js配置:url:"+url);
|
||||
return CommonResult.success(weChatService.getJsSdkConfig(url));
|
||||
}
|
||||
|
||||
|
||||
@@ -30,5 +30,9 @@ public class BargainFrontRequest {
|
||||
@NotNull(message = "砍价商品编号不能为空")
|
||||
private Integer bargainId;
|
||||
|
||||
@ApiModelProperty(value = "用户砍价活动ID")
|
||||
private Integer bargainUserId;
|
||||
|
||||
@ApiModelProperty(value = "用户砍价活动Uid")
|
||||
private Integer bargainUserUid;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.Max;
|
||||
import javax.validation.constraints.Min;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 购物车数量请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="CartRequest对象", description="购物车数量请求对象")
|
||||
public class CartNumRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -1186533756329913311L;
|
||||
|
||||
@ApiModelProperty(value = "数量类型:total-商品数量,sum-购物数量", required = true)
|
||||
@NotNull(message = "数量类型不能为空")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "商品类型:true-有效商品,false-无效商品", required = true)
|
||||
@NotNull(message = "商品类型不能为空")
|
||||
private Boolean numType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 创建订单请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="CreateOrderRequest对象", description="创建订单请求对象")
|
||||
public class CreateOrderRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -6133994384185333872L;
|
||||
|
||||
@ApiModelProperty(value = "预下单订单号")
|
||||
@NotBlank(message = "预下单订单号不能为空")
|
||||
private String preOrderNo;
|
||||
|
||||
@ApiModelProperty(value = "快递类型: 1-快递配送,2-到店自提")
|
||||
@NotNull(message = "快递类型不能为空")
|
||||
private Integer shippingType;
|
||||
|
||||
@ApiModelProperty(value = "收货地址id")
|
||||
private Integer addressId;
|
||||
|
||||
@ApiModelProperty(value = "优惠券编号")
|
||||
private Integer couponId;
|
||||
|
||||
@ApiModelProperty(value = "支付类型:weixin-微信支付,yue-余额支付")
|
||||
@NotBlank(message = "支付类型不能为空")
|
||||
private String payType;
|
||||
|
||||
@ApiModelProperty(value = "支付渠道:weixinh5-微信H5支付,public-公众号支付,routine-小程序支付,weixinAppIos-微信appios支付,weixinAppAndroid-微信app安卓支付")
|
||||
@NotBlank(message = "支付渠道不能为空")
|
||||
private String payChannel;
|
||||
|
||||
@ApiModelProperty(value = "是否使用积分")
|
||||
@NotNull(message = "是否使用积分不能为空")
|
||||
private Boolean useIntegral;
|
||||
|
||||
@ApiModelProperty(value = "订单备注")
|
||||
private String mark;
|
||||
|
||||
// 以下为到店自提参数
|
||||
|
||||
@ApiModelProperty(value = "自提点id")
|
||||
private Integer storeId;
|
||||
|
||||
@ApiModelProperty(value = "真实名称")
|
||||
private String realName;
|
||||
|
||||
@ApiModelProperty(value = "手机号码")
|
||||
private String phone;
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 微信绑定手机号请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="IosBindingPhoneRequest", description="Ios绑定手机号请求对象")
|
||||
public class IosBindingPhoneRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "验证码", required = true)
|
||||
private String captcha;
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import com.constants.RegularConstants;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
|
||||
/**
|
||||
* ios登录请求体
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="IosLoginRequest对象", description="ios登录请求体")
|
||||
public class IosLoginRequest {
|
||||
|
||||
@ApiModelProperty(value = "iosToken", required = true)
|
||||
// @NotBlank(message = "identityToken不能为空")
|
||||
private String identityToken;
|
||||
|
||||
@ApiModelProperty(value = "App服务商唯一用户标识", required = true)
|
||||
@NotBlank(message = "openId不能为空")
|
||||
private String openId;
|
||||
|
||||
@ApiModelProperty(value = "Ios用户电子邮箱")
|
||||
// @NotBlank(message = "email不能为空")
|
||||
private String email;
|
||||
}
|
||||
@@ -33,18 +33,17 @@ public class LoginMobileRequest implements Serializable {
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@Pattern(regexp = RegularConstants.PHONE, message = "手机号码格式错误")
|
||||
@NotBlank
|
||||
@JsonProperty(value = "account")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "验证码", required = true)
|
||||
@Pattern(regexp = RegularConstants.SMS_VALIDATE_CODE_NUM, message = "验证码格式错误,验证码必须为6位数字")
|
||||
@JsonProperty(value = "captcha")
|
||||
private String validateCode;
|
||||
private String captcha;
|
||||
|
||||
@ApiModelProperty(value = "推广人id")
|
||||
private Integer spread;
|
||||
@JsonProperty(value = "spread_spid")
|
||||
private Integer spreadPid;
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
|
||||
@@ -32,6 +33,7 @@ public class LoginRequest implements Serializable {
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true, example = "18888888")
|
||||
@NotBlank(message = "手机号不能为空")
|
||||
@Pattern(regexp = RegularConstants.PHONE, message = "手机号码格式错误")
|
||||
@JsonProperty(value = "account")
|
||||
private String phone;
|
||||
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.NotNull;
|
||||
|
||||
/**
|
||||
* 计算订单价格请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="OrderComputedPriceRequest对象", description="计算订单价格请求对象")
|
||||
public class OrderComputedPriceRequest {
|
||||
|
||||
@ApiModelProperty(value = "预下单订单号")
|
||||
@NotBlank(message = "预下单订单号不能为空")
|
||||
private String preOrderNo;
|
||||
|
||||
@ApiModelProperty(value = "地址id")
|
||||
private Integer addressId;
|
||||
|
||||
@ApiModelProperty(value = "优惠券id")
|
||||
private Integer couponId;
|
||||
|
||||
@ApiModelProperty(value = "快递类型: 1-快递配送,2-到店自提")
|
||||
@NotNull(message = "快递类型不能为空")
|
||||
private Integer shippingType;
|
||||
|
||||
@ApiModelProperty(value = "是否使用积分")
|
||||
@NotNull(message = "是否使用积分不能为空")
|
||||
private Boolean useIntegral;
|
||||
|
||||
}
|
||||
@@ -45,7 +45,7 @@ public class OrderCreateRequest {
|
||||
@ApiModelProperty(value = "支付类型:weixin-微信支付,yue-余额支付,offline-线下支付,alipay-支付包支付")
|
||||
private String payType;
|
||||
|
||||
@ApiModelProperty(value = "支付渠道:weixinh5-微信H5支付,public-公众号支付,routine-小程序支付")
|
||||
@ApiModelProperty(value = "支付渠道:weixinh5-微信H5支付,public-公众号支付,routine-小程序支付,weixinAppIos-微信appios支付,weixinAppAndroid-微信app安卓支付")
|
||||
private String payChannel;
|
||||
|
||||
@ApiModelProperty(value = "是否使用积分")
|
||||
|
||||
@@ -38,10 +38,13 @@ public class OrderPayRequest {
|
||||
@NotNull(message = "支付类型不能为空")
|
||||
private String payType;
|
||||
|
||||
@ApiModelProperty(value = "支付渠道:weixinh5-微信H5支付,public-公众号支付,routine-小程序支付")
|
||||
@ApiModelProperty(value = "支付渠道:weixinh5-微信H5支付,public-公众号支付,routine-小程序支付,weixinAppIos-微信appios支付,weixinAppAndroid-微信app安卓支付")
|
||||
@NotNull(message = "支付渠道不能为空")
|
||||
private String payChannel;
|
||||
|
||||
@ApiModelProperty(value = "支付平台")
|
||||
private String from;
|
||||
|
||||
@ApiModelProperty(value = "下单时小程序的场景值")
|
||||
private Integer scene;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
/**
|
||||
* 预下单详情请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="PreOrderRequest对象", description="预下单详情请求对象")
|
||||
public class PreOrderDetailRequest {
|
||||
|
||||
@ApiModelProperty(value = "购物车编号,购物车预下单时必填")
|
||||
private Long shoppingCartId;
|
||||
|
||||
@ApiModelProperty(value = "商品id(立即购买必填)")
|
||||
private Integer productId;
|
||||
|
||||
@ApiModelProperty(value = "商品规格属性id(立即购买、活动购买必填)")
|
||||
private Integer attrValueId;
|
||||
|
||||
@ApiModelProperty(value = "商品数量(立即购买、活动购买必填)")
|
||||
private Integer productNum;
|
||||
|
||||
@ApiModelProperty(value = "订单编号(再次购买必填)")
|
||||
private String orderNo;
|
||||
|
||||
@ApiModelProperty(value = "砍价商品id")
|
||||
private Integer bargainId = 0;
|
||||
|
||||
@ApiModelProperty(value = "用户砍价活动id")
|
||||
private Integer bargainUserId = 0;
|
||||
|
||||
@ApiModelProperty(value = "拼团商品id")
|
||||
private Integer combinationId = 0;
|
||||
|
||||
@ApiModelProperty(value = "拼团团长id")
|
||||
private Integer pinkId = 0;
|
||||
|
||||
@ApiModelProperty(value = "秒杀商品id")
|
||||
private Integer seckillId = 0;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 预下单请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="PreOrderRequest对象", description="预下单请求对象")
|
||||
public class PreOrderRequest {
|
||||
|
||||
@ApiModelProperty(value = "预下单类型(“shoppingCart”:购物车下单,“buyNow”:立即购买,”again“: 再次购买,”video“: 视频号商品下单)")
|
||||
@NotBlank(message = "预下单类型不能为空")
|
||||
private String preOrderType;
|
||||
|
||||
@ApiModelProperty(value = "订单详情列表")
|
||||
private List<PreOrderDetailRequest> orderDetails;
|
||||
|
||||
}
|
||||
@@ -26,6 +26,8 @@ import java.io.Serializable;
|
||||
@ApiModel(value="ProductRequest对象", description="商品搜索")
|
||||
public class ProductRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3481659942630712958L;
|
||||
|
||||
@ApiModelProperty(value = "搜索关键字")
|
||||
private String keyword;
|
||||
|
||||
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import com.constants.RegularConstants;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* App微信注册/登录请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="RegisterAppWxRequest对象", description="App微信注册/登录请求对象")
|
||||
public class RegisterAppWxRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "用户openId")
|
||||
private String openId;
|
||||
|
||||
@ApiModelProperty(value = "用户unionId")
|
||||
private String unionId;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称", required = true)
|
||||
private String nickName;
|
||||
|
||||
@ApiModelProperty(value = "性别:0未知,1-男,2-女", required = true)
|
||||
private String gender;
|
||||
|
||||
@ApiModelProperty(value = "用户个人资料填写的省份")
|
||||
private String province;
|
||||
|
||||
@ApiModelProperty(value = "普通用户个人资料填写的城市")
|
||||
private String city;
|
||||
|
||||
@ApiModelProperty(value = "国家,如中国为CN")
|
||||
private String country;
|
||||
|
||||
@ApiModelProperty(value = "微信App用户头像", required = true)
|
||||
private String avatarUrl;
|
||||
|
||||
@ApiModelProperty(value = "微信App类型:iosWx-苹果微信,androidWx-安卓微信", required = true)
|
||||
private String type;
|
||||
|
||||
}
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import com.constants.RegularConstants;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
@@ -12,7 +11,7 @@ import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 用户地址表
|
||||
* 换绑手机号请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
@@ -26,20 +25,16 @@ import java.io.Serializable;
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="UserBindingRequest对象", description="绑定手机号")
|
||||
public class UserBindingRequest implements Serializable {
|
||||
@ApiModel(value="UserBindingPhoneUpdateRequest", description="换绑手机号请求对象")
|
||||
public class UserBindingPhoneUpdateRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
@Pattern(regexp = RegularConstants.PHONE, message = "手机号码格式错误")
|
||||
@JsonProperty(value = "account")
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "验证码", required = true)
|
||||
@Pattern(regexp = RegularConstants.SMS_VALIDATE_CODE_NUM, message = "验证码格式错误,验证码必须为6位数字")
|
||||
@JsonProperty(value = "captcha")
|
||||
private String validateCode;
|
||||
|
||||
|
||||
private String captcha;
|
||||
}
|
||||
@@ -43,7 +43,7 @@ public class UserRechargeRequest implements Serializable {
|
||||
@ApiModelProperty(value = "支付方式| weixin = 微信,alipay = 支付宝")
|
||||
private String payType = "weixin";
|
||||
|
||||
@ApiModelProperty(value = "来源 | public = 微信公众号, weixinh5 =微信H5支付, routine = 小程序")
|
||||
@ApiModelProperty(value = "来源 | public = 微信公众号, weixinh5 =微信H5支付, routine = 小程序,weixinAppIos-微信appios支付,weixinAppAndroid-微信app安卓支付")
|
||||
@JsonProperty(value = "from")
|
||||
private String fromType;
|
||||
|
||||
|
||||
@@ -33,7 +33,7 @@ public class UserSpreadPeopleRequest implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "推荐人类型|0=一级|1=二级", allowableValues = "range[0,1]")
|
||||
@Range(min = 0, max = 1, message = "推荐人类型必须在 0(一级),1(二级) 中选择")
|
||||
private int grade = 0;
|
||||
private Integer grade = 0;
|
||||
|
||||
@ApiModelProperty(value = "搜索关键字")
|
||||
private String keyword;
|
||||
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.zbkj.crmeb.front.request;
|
||||
|
||||
import com.constants.RegularConstants;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.Value;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Pattern;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 微信绑定手机号请求对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="WxBindingPhoneRequest", description="微信绑定手机号请求对象")
|
||||
public class WxBindingPhoneRequest implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "手机号", required = true)
|
||||
private String phone;
|
||||
|
||||
@ApiModelProperty(value = "验证码", required = true)
|
||||
private String captcha;
|
||||
|
||||
@ApiModelProperty(value = "类型:public-公众号,routine-小程序,iosWx-苹果微信,androidWx-安卓微信, ios-ios登录")
|
||||
@NotBlank(message = "类型不能为空")
|
||||
private String type;
|
||||
|
||||
@ApiModelProperty(value = "新用户登录时返回的key")
|
||||
@NotBlank(message = "key不能为空")
|
||||
private String key;
|
||||
|
||||
@ApiModelProperty(value = "小程序获取手机号加密数据")
|
||||
private String encryptedData;
|
||||
|
||||
@ApiModelProperty(value = "加密算法的初始向量")
|
||||
private String iv;
|
||||
|
||||
@ApiModelProperty(value = "小程序code")
|
||||
private String code;
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 申请退款订单响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="ApplyRefundOrderInfoResponse对象", description="申请退款订单响应对象")
|
||||
public class ApplyRefundOrderInfoResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 1387727608277207652L;
|
||||
|
||||
@ApiModelProperty(value = "订单id")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "订单编号")
|
||||
private String orderId;
|
||||
|
||||
@ApiModelProperty(value = "支付状态")
|
||||
private Boolean paid;
|
||||
|
||||
@ApiModelProperty(value = "支付金额")
|
||||
private BigDecimal payPrice;
|
||||
|
||||
@ApiModelProperty(value = "订单商品总数")
|
||||
private Integer totalNum;
|
||||
|
||||
@ApiModelProperty(value = "订单详情对象列表")
|
||||
private List<OrderInfoResponse> orderInfoList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 文章响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="ArticleResponse对象", description="文章响应对象")
|
||||
public class ArticleResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -4585094537501770138L;
|
||||
|
||||
@ApiModelProperty(value = "文章管理ID")
|
||||
@TableId(value = "id", type = IdType.AUTO)
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "文章标题")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "文章作者")
|
||||
private String author;
|
||||
|
||||
@ApiModelProperty(value = "文章图片 前端用")
|
||||
private String imageInput;
|
||||
|
||||
@ApiModelProperty(value = "文章简介")
|
||||
private String synopsis;
|
||||
|
||||
@ApiModelProperty(value = "浏览次数")
|
||||
private String visit;
|
||||
|
||||
@ApiModelProperty(value = "文章内容")
|
||||
private String content;
|
||||
|
||||
@ApiModelProperty(value = "创建时间")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd",timezone="GMT+8")
|
||||
private Date createTime;
|
||||
}
|
||||
@@ -0,0 +1,86 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 砍价商品详情响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="BargainDetailH5Response对象", description="砍价商品详情响应对象")
|
||||
public class BargainDetailH5Response implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4177599369617161973L;
|
||||
|
||||
@ApiModelProperty(value = "砍价商品ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "关联商品ID")
|
||||
private Integer productId;
|
||||
|
||||
@ApiModelProperty(value = "砍价活动名称")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "砍价活动图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "单位名称")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "销量")
|
||||
private Integer sales;
|
||||
|
||||
@ApiModelProperty(value = "砍价开启时间")
|
||||
private Long startTime;
|
||||
|
||||
@ApiModelProperty(value = "砍价结束时间")
|
||||
private Long stopTime;
|
||||
|
||||
@ApiModelProperty(value = "砍价金额")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "砍价商品最低价")
|
||||
private BigDecimal minPrice;
|
||||
|
||||
@ApiModelProperty(value = "购买数量限制")
|
||||
// 单个活动每个用户发起砍价次数限制
|
||||
private Integer num;
|
||||
|
||||
@ApiModelProperty(value = "砍价活动简介")
|
||||
private String info;
|
||||
|
||||
// @ApiModelProperty(value = "砍价规则")
|
||||
// private String rule;
|
||||
|
||||
@ApiModelProperty(value = "限购总数")
|
||||
private Integer quota;
|
||||
|
||||
@ApiModelProperty(value = "限量总数显示")
|
||||
private Integer quotaShow;
|
||||
|
||||
@ApiModelProperty(value = "商品规格sku")
|
||||
private String sku;
|
||||
|
||||
@ApiModelProperty(value = "商品规格属性id")
|
||||
private Integer attrValueId;
|
||||
|
||||
@ApiModelProperty(value = "商品详情")
|
||||
private String content;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.zbkj.crmeb.store.response.StoreProductResponse;
|
||||
import com.zbkj.crmeb.user.model.User;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 砍价商品列表header响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="BargainHeaderResponse对象", description="砍价商品列表header响应对象")
|
||||
public class BargainHeaderResponse {
|
||||
|
||||
@ApiModelProperty(value = "参与砍价总人数")
|
||||
private Integer bargainTotal;
|
||||
|
||||
@ApiModelProperty(value = "砍价成功列表(默认7条)")
|
||||
private List<HashMap<String, Object>> bargainSuccessList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargain;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 砍价首页响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="BargainIndexResponse对象", description="砍价首页响应对象")
|
||||
public class BargainIndexResponse {
|
||||
|
||||
@ApiModelProperty(value = "拼团商品列表")
|
||||
private List<StoreBargain> productList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 砍价记录响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="BargainRecordResponse对象", description="砍价记录响应对象")
|
||||
public class BargainRecordResponse {
|
||||
|
||||
@ApiModelProperty(value = "砍价商品ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "关联商品ID")
|
||||
private Integer productId;
|
||||
|
||||
@ApiModelProperty(value = "砍价活动名称")
|
||||
private String title;
|
||||
|
||||
@ApiModelProperty(value = "砍价活动图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "砍价结束时间")
|
||||
private Long stopTime;
|
||||
|
||||
@ApiModelProperty(value = "用户砍价活动id")
|
||||
private Integer bargainUserId;
|
||||
|
||||
@ApiModelProperty(value = "剩余金额")
|
||||
private BigDecimal surplusPrice;
|
||||
|
||||
@ApiModelProperty(value = "状态 1参与中 2 活动结束参与失败 3活动结束参与成功")
|
||||
private Integer status;
|
||||
|
||||
@ApiModelProperty(value = "是否取消")
|
||||
private Boolean isDel;
|
||||
|
||||
@ApiModelProperty(value = "是否生成订单")
|
||||
private Boolean isOrder;
|
||||
|
||||
@ApiModelProperty(value = "是否支付")
|
||||
private Boolean isPay;
|
||||
|
||||
@ApiModelProperty(value = "订单号")
|
||||
private String orderNo;
|
||||
}
|
||||
@@ -0,0 +1,104 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargainUser;
|
||||
import com.zbkj.crmeb.bargain.model.StoreBargainUserHelp;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 砍价用户详情响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="BargainUserInfoResponse对象", description="砍价用户详情响应对象")
|
||||
public class BargainUserInfoResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 4177599369617161973L;
|
||||
|
||||
@ApiModelProperty(value = "当前用户砍价状态:1-可以参与砍价,2-参与次数已满,3-砍价中,4-已完成,5-可以帮砍,6-已帮砍,7-帮砍次数已满,8-已生成订单未支付,9-已支付")
|
||||
private Integer bargainStatus;
|
||||
|
||||
@ApiModelProperty(value = "已砍金额")
|
||||
private BigDecimal alreadyPrice;
|
||||
|
||||
@ApiModelProperty(value = "剩余金额")
|
||||
private BigDecimal surplusPrice;
|
||||
|
||||
@ApiModelProperty(value = "砍价百分比")
|
||||
private Integer bargainPercent;
|
||||
|
||||
// @ApiModelProperty(value = "砍价活动图片")
|
||||
// private String image;
|
||||
//
|
||||
// @ApiModelProperty(value = "单位名称")
|
||||
// private String unitName;
|
||||
//
|
||||
// @ApiModelProperty(value = "销量")
|
||||
// private Integer sales;
|
||||
//
|
||||
// @ApiModelProperty(value = "砍价开启时间")
|
||||
// private Long startTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "砍价结束时间")
|
||||
// private Long stopTime;
|
||||
//
|
||||
// @ApiModelProperty(value = "砍价金额")
|
||||
// private BigDecimal price;
|
||||
//
|
||||
// @ApiModelProperty(value = "砍价商品最低价")
|
||||
// private BigDecimal minPrice;
|
||||
|
||||
// @ApiModelProperty(value = "购买数量限制")
|
||||
// // 单个活动每个用户发起砍价次数限制
|
||||
// private Integer num;
|
||||
|
||||
// @ApiModelProperty(value = "砍价活动简介")
|
||||
// private String info;
|
||||
|
||||
// @ApiModelProperty(value = "砍价规则")
|
||||
// private String rule;
|
||||
|
||||
// @ApiModelProperty(value = "限购总数")
|
||||
// private Integer quota;
|
||||
//
|
||||
// @ApiModelProperty(value = "限量总数显示")
|
||||
// private Integer quotaShow;
|
||||
//
|
||||
// @ApiModelProperty(value = "商品规格sku")
|
||||
// private String sku;
|
||||
//
|
||||
// @ApiModelProperty(value = "商品规格属性id")
|
||||
// private Integer attrValueId;
|
||||
|
||||
// @ApiModelProperty(value = "商品详情")
|
||||
// private String content;
|
||||
|
||||
@ApiModelProperty(value = "用户帮砍列表")
|
||||
private List<StoreBargainUserHelp> userHelpList;
|
||||
|
||||
@ApiModelProperty(value = "用户砍价活动id")
|
||||
private Integer storeBargainUserId;
|
||||
|
||||
@ApiModelProperty(value = "用户砍价活动昵称")
|
||||
private String storeBargainUserName;
|
||||
|
||||
@ApiModelProperty(value = "用户砍价活动头像")
|
||||
private String storeBargainUserAvatar;
|
||||
}
|
||||
@@ -0,0 +1,70 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableField;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import com.zbkj.crmeb.store.model.StoreProductAttrValue;
|
||||
import com.zbkj.crmeb.store.response.StoreProductCartProductInfoResponse;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 购物车详情响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="CartInfoResponse对象", description="购物车详情响应对象")
|
||||
public class CartInfoResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 3558884699193209193L;
|
||||
|
||||
@ApiModelProperty(value = "购物车表ID")
|
||||
private Long id;
|
||||
|
||||
@ApiModelProperty(value = "商品ID")
|
||||
private Integer productId;
|
||||
|
||||
@ApiModelProperty(value = "商品属性")
|
||||
private String productAttrUnique;
|
||||
|
||||
@ApiModelProperty(value = "商品数量")
|
||||
private Integer cartNum;
|
||||
|
||||
@ApiModelProperty(value = "商品图片")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "商品名称")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty(value = "商品规格id")
|
||||
private Integer attrId;
|
||||
|
||||
@ApiModelProperty(value = "商品属性索引值 (attr_value|attr_value[|....])")
|
||||
private String suk;
|
||||
|
||||
@ApiModelProperty(value = "sku价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "商品是否有效")
|
||||
private Boolean attrStatus;
|
||||
|
||||
@ApiModelProperty(value = "sku库存")
|
||||
private Integer stock;
|
||||
}
|
||||
@@ -0,0 +1,82 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType;
|
||||
import com.baomidou.mybatisplus.annotation.TableId;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 拼团商品移动端对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="CombinationDetailH5Response对象", description="拼团商品移动端对象")
|
||||
public class CombinationDetailH5Response implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = -885733985825623484L;
|
||||
|
||||
@ApiModelProperty(value = "拼团商品ID")
|
||||
private Integer id;
|
||||
|
||||
@ApiModelProperty(value = "商品id")
|
||||
private Integer productId;
|
||||
|
||||
@ApiModelProperty(value = "推荐图")
|
||||
private String image;
|
||||
|
||||
@ApiModelProperty(value = "轮播图")
|
||||
private String sliderImage;
|
||||
|
||||
@ApiModelProperty(value = "活动标题")
|
||||
private String storeName;
|
||||
|
||||
@ApiModelProperty(value = "参团人数")
|
||||
private Integer people;
|
||||
|
||||
@ApiModelProperty(value = "简介")
|
||||
private String storeInfo;
|
||||
|
||||
@ApiModelProperty(value = "价格")
|
||||
private BigDecimal price;
|
||||
|
||||
@ApiModelProperty(value = "销量")
|
||||
private Integer sales;
|
||||
|
||||
@ApiModelProperty(value = "单位名")
|
||||
private String unitName;
|
||||
|
||||
@ApiModelProperty(value = "限购总数")
|
||||
private Integer quota;
|
||||
|
||||
@ApiModelProperty(value = "限量总数显示")
|
||||
private Integer quotaShow;
|
||||
|
||||
@ApiModelProperty(value = "原价")
|
||||
private BigDecimal otPrice;
|
||||
|
||||
@ApiModelProperty(value = "每个订单可购买数量")
|
||||
private Integer onceNum;
|
||||
|
||||
@ApiModelProperty(value = "虚拟销量")
|
||||
private Integer ficti;
|
||||
|
||||
@ApiModelProperty(value = "商品详情")
|
||||
private String content;
|
||||
}
|
||||
@@ -33,11 +33,8 @@ public class CombinationDetailResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID=1L;
|
||||
|
||||
@ApiModelProperty(value = "拼团团长ID列表")
|
||||
private List<Integer> pindAll;
|
||||
|
||||
@ApiModelProperty(value = "拼团列表")
|
||||
private List<StorePinkResponse> pink;
|
||||
private List<StorePinkResponse> pinkList;
|
||||
|
||||
@ApiModelProperty(value = "拼团成功列表")
|
||||
private List<StorePinkResponse> pinkOkList;
|
||||
@@ -46,27 +43,14 @@ public class CombinationDetailResponse implements Serializable {
|
||||
private Integer pinkOkSum;
|
||||
|
||||
@ApiModelProperty(value = "拼团商品信息")
|
||||
private StoreCombinationInfoResponse storeInfo;
|
||||
|
||||
@ApiModelProperty(value = "回复")
|
||||
private List<StoreProductReply> reply;
|
||||
|
||||
@ApiModelProperty(value = "好评率")
|
||||
private Integer replyChance;
|
||||
|
||||
@ApiModelProperty(value = "评论数量")
|
||||
private Integer replyCount;
|
||||
private CombinationDetailH5Response storeCombination;
|
||||
|
||||
@ApiModelProperty(value = "商品规格")
|
||||
private List<HashMap<String,Object>> productAttr;
|
||||
private List<ProductAttrResponse> productAttr;
|
||||
|
||||
@ApiModelProperty(value = "商品规格值")
|
||||
// private List<StoreProductAttrValue> productValue;
|
||||
private HashMap<String,Object> productValue;
|
||||
|
||||
@ApiModelProperty(value = "商品单双规格")
|
||||
private Boolean specType;
|
||||
|
||||
@ApiModelProperty(value = "拼团单属性AttrValueId")
|
||||
private Integer aloneAttrValueId;
|
||||
@ApiModelProperty(value = "收藏标识")
|
||||
private Boolean userCollect;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,38 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 拼团商品列表header响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="CombinationHeaderResponse对象", description="拼团商品列表header响应对象")
|
||||
public class CombinationHeaderResponse {
|
||||
|
||||
@ApiModelProperty(value = "拼团7位用户头像")
|
||||
private List<String> avatarList;
|
||||
|
||||
@ApiModelProperty(value = "拼团总人数")
|
||||
private Integer totalPeople;
|
||||
|
||||
@ApiModelProperty(value = "拼团banner数组")
|
||||
private List<HashMap<String, Object>> bannerList;
|
||||
}
|
||||
@@ -0,0 +1,39 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.zbkj.crmeb.combination.model.StoreCombination;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 拼团首页响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="CombinationIndexResponse对象", description="拼团首页响应对象")
|
||||
public class CombinationIndexResponse {
|
||||
|
||||
@ApiModelProperty(value = "拼团3位用户头像")
|
||||
private List<String> avatarList;
|
||||
|
||||
@ApiModelProperty(value = "拼团总人数")
|
||||
private Integer totalPeople;
|
||||
|
||||
@ApiModelProperty(value = "拼团商品列表")
|
||||
private List<StoreCombination> productList;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.zbkj.crmeb.front.response;
|
||||
|
||||
import com.zbkj.crmeb.front.vo.OrderInfoVo;
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import io.swagger.models.auth.In;
|
||||
import lombok.Data;
|
||||
import lombok.EqualsAndHashCode;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 计算订单价格响应对象
|
||||
* +----------------------------------------------------------------------
|
||||
* | CRMEB [ CRMEB赋能开发者,助力企业发展 ]
|
||||
* +----------------------------------------------------------------------
|
||||
* | Copyright (c) 2016~2020 https://www.crmeb.com All rights reserved.
|
||||
* +----------------------------------------------------------------------
|
||||
* | Licensed CRMEB并不是自由软件,未经许可不能去掉CRMEB相关版权
|
||||
* +----------------------------------------------------------------------
|
||||
* | Author: CRMEB Team <admin@crmeb.com>
|
||||
* +----------------------------------------------------------------------
|
||||
*/
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = false)
|
||||
@Accessors(chain = true)
|
||||
@ApiModel(value="ComputedOrderPriceResponse对象", description="计算订单价格响应对象")
|
||||
public class ComputedOrderPriceResponse implements Serializable {
|
||||
|
||||
private static final long serialVersionUID = 7282892323898493847L;
|
||||
|
||||
@ApiModelProperty(value = "优惠券优惠金额")
|
||||
private BigDecimal couponFee;
|
||||
|
||||
@ApiModelProperty(value = "积分抵扣金额")
|
||||
private BigDecimal deductionPrice;
|
||||
|
||||
@ApiModelProperty(value = "运费金额")
|
||||
private BigDecimal freightFee;
|
||||
|
||||
@ApiModelProperty(value = "实际支付金额")
|
||||
private BigDecimal payFee;
|
||||
|
||||
@ApiModelProperty(value = "商品总金额")
|
||||
private BigDecimal proTotalFee;
|
||||
|
||||
@ApiModelProperty(value = "剩余积分")
|
||||
private Integer surplusIntegral;
|
||||
|
||||
@ApiModelProperty(value = "是否使用积分")
|
||||
private Boolean useIntegral;
|
||||
|
||||
@ApiModelProperty(value = "使用的积分")
|
||||
private Integer usedIntegral;
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user