Merge branch 'feature/marketing-integral-log' into hapr191
Keep backend-adminend/src/api/integral.js (integralListApi) after resolve rename/delete vs hapr191 deletion. Made-with: Cursor
This commit is contained in:
BIN
backend/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
BIN
backend/.mvn/wrapper/maven-wrapper.jar
vendored
Normal file
Binary file not shown.
2
backend/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
2
backend/.mvn/wrapper/maven-wrapper.properties
vendored
Normal file
@@ -0,0 +1,2 @@
|
||||
distributionUrl=https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/3.6.3/apache-maven-3.6.3-bin.zip
|
||||
wrapperUrl=https://repo.maven.apache.org/maven2/io/takari/maven-wrapper/0.5.6/maven-wrapper-0.5.6.jar
|
||||
@@ -148,6 +148,8 @@ public class WebSecurityConfig extends WebSecurityConfigurerAdapter {
|
||||
.antMatchers("/api/admin/store/product/copy/**").permitAll()
|
||||
.antMatchers("/api/admin/merchandise/select").permitAll()
|
||||
.antMatchers("/api/admin/merchandise/update").permitAll()
|
||||
// 积分模块外部免认证只读接口(供 /integral-external/* 页面调用)
|
||||
.antMatchers("/api/external/integral/**").permitAll()
|
||||
// 除上面外的所有请求全部需要鉴权认证
|
||||
.anyRequest().authenticated()
|
||||
.and()
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.zbkj.admin.controller;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.zbkj.common.page.CommonPage;
|
||||
import com.zbkj.common.request.*;
|
||||
import com.zbkj.common.response.StoreOrderDetailResponse;
|
||||
import com.zbkj.common.response.UserIntegralRecordResponse;
|
||||
import com.zbkj.common.response.UserResponse;
|
||||
import com.zbkj.common.result.CommonResult;
|
||||
import com.zbkj.service.service.StoreOrderService;
|
||||
import com.zbkj.service.service.UserIntegralRecordService;
|
||||
import com.zbkj.service.service.UserService;
|
||||
import io.swagger.annotations.Api;
|
||||
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.*;
|
||||
|
||||
/**
|
||||
* 积分模块外部免认证接口 Controller
|
||||
* 供管理后台外部页面(/integral-external/*)调用,跳过登录验证。
|
||||
* 所有接口仅提供只读查询能力,不包含任何写操作。
|
||||
*
|
||||
* 安全说明:此 Controller 映射路径已在 WebSecurityConfig 中配置为 permitAll。
|
||||
* 建议生产环境配合 IP 白名单或反向代理层访问控制使用。
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
@RequestMapping("api/external/integral")
|
||||
@Api(tags = "积分外部免认证接口")
|
||||
public class ExternalIntegralController {
|
||||
|
||||
@Autowired
|
||||
private UserIntegralRecordService integralRecordService;
|
||||
|
||||
@Autowired
|
||||
private StoreOrderService storeOrderService;
|
||||
|
||||
@Autowired
|
||||
private UserService userService;
|
||||
|
||||
/**
|
||||
* 积分明细分页列表(免认证)
|
||||
* 复用 UserIntegralRecordService.findAdminList,与 /admin/user/integral/list 逻辑完全一致。
|
||||
*
|
||||
* @param request 搜索条件(dateLimit / keywords / uid)
|
||||
* @param pageParamRequest 分页参数(page / limit)
|
||||
*/
|
||||
@ApiOperation(value = "积分明细分页列表(免认证)")
|
||||
@RequestMapping(value = "/log/list", method = RequestMethod.POST)
|
||||
public CommonResult<CommonPage<UserIntegralRecordResponse>> getIntegralLogList(
|
||||
@RequestBody @Validated AdminIntegralSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserIntegralRecordResponse> restPage =
|
||||
CommonPage.restPage(integralRecordService.findAdminList(request, pageParamRequest));
|
||||
return CommonResult.success(restPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 订单分页列表(免认证)
|
||||
* 复用 StoreOrderService.getAdminList,与 /admin/store/order/list 逻辑完全一致。
|
||||
*
|
||||
* @param request 搜索条件(status / dateLimit / orderNo / type)
|
||||
* @param pageParamRequest 分页参数(page / limit)
|
||||
*/
|
||||
@ApiOperation(value = "订单分页列表(免认证)")
|
||||
@GetMapping(value = "/order/list")
|
||||
public CommonResult<CommonPage<StoreOrderDetailResponse>> getOrderList(
|
||||
@Validated StoreOrderSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<StoreOrderDetailResponse> restPage =
|
||||
storeOrderService.getAdminList(request, pageParamRequest);
|
||||
return CommonResult.success(restPage);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户分页列表(免认证)
|
||||
* 复用 UserService.getList,与 /admin/user/list 逻辑完全一致。
|
||||
*
|
||||
* @param request 搜索条件(keywords / dateLimit 等)
|
||||
* @param pageParamRequest 分页参数(page / limit)
|
||||
*/
|
||||
@ApiOperation(value = "用户分页列表(免认证)")
|
||||
@GetMapping(value = "/user/list")
|
||||
public CommonResult<CommonPage<UserResponse>> getUserList(
|
||||
@ModelAttribute @Validated UserSearchRequest request,
|
||||
@Validated PageParamRequest pageParamRequest) {
|
||||
CommonPage<UserResponse> restPage =
|
||||
CommonPage.restPage(userService.getList(request, pageParamRequest));
|
||||
if (CollUtil.isNotEmpty(restPage.getList())) {
|
||||
userService.fillWaSelfBonus(restPage.getList());
|
||||
}
|
||||
return CommonResult.success(restPage);
|
||||
}
|
||||
}
|
||||
@@ -14,42 +14,42 @@ package com.zbkj.common.constants;
|
||||
*/
|
||||
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 = "订单退款";
|
||||
}
|
||||
|
||||
@@ -37,4 +37,10 @@ public class AdminIntegralSearchRequest implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "用户名称(昵称,模糊匹配)")
|
||||
private String nickName;
|
||||
|
||||
@ApiModelProperty(value = "用户手机号(模糊匹配)")
|
||||
private String phone;
|
||||
}
|
||||
|
||||
@@ -123,4 +123,16 @@ public class StoreOrderDetailResponse implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "物流状态/出库状态:0-未出库,1-已出库")
|
||||
private Integer deliveryStatus;
|
||||
|
||||
@ApiModelProperty(value = "用户id")
|
||||
private Integer uid;
|
||||
|
||||
@ApiModelProperty(value = "用户手机号")
|
||||
private String userPhone;
|
||||
|
||||
@ApiModelProperty(value = "用户昵称")
|
||||
private String nickname;
|
||||
|
||||
@ApiModelProperty(value = "使用积分")
|
||||
private Integer useIntegral;
|
||||
}
|
||||
|
||||
@@ -92,6 +92,9 @@ public class UserResponse {
|
||||
@ApiModelProperty(value = "用户剩余积分(支持小数点后3位)")
|
||||
private BigDecimal integral;
|
||||
|
||||
@ApiModelProperty(value = "个人奖金(寄卖 wa_users.self_bonus,与 uid 对应 wa_users.id)")
|
||||
private BigDecimal selfBonus;
|
||||
|
||||
@ApiModelProperty(value = "用户剩余经验")
|
||||
private Integer experience;
|
||||
|
||||
|
||||
@@ -33,6 +33,11 @@ public interface UserService extends IService<User> {
|
||||
*/
|
||||
PageInfo<UserResponse> getList(UserSearchRequest request, PageParamRequest pageParamRequest);
|
||||
|
||||
/**
|
||||
* 按 eb_user.uid = wa_users.id 批量填充寄卖个人奖金(wa_users.self_bonus)
|
||||
*/
|
||||
void fillWaSelfBonus(List<UserResponse> users);
|
||||
|
||||
/**
|
||||
* 操作积分、余额
|
||||
*/
|
||||
@@ -260,6 +265,13 @@ public interface UserService extends IService<User> {
|
||||
*/
|
||||
List<Integer> findIdListLikeName(String nikeName);
|
||||
|
||||
/**
|
||||
* 根据手机号模糊匹配用户,返回 uid 集合
|
||||
* @param phone 手机号关键字
|
||||
* @return uid 列表
|
||||
*/
|
||||
List<Integer> findIdListLikePhone(String phone);
|
||||
|
||||
/**
|
||||
* 清除对应的用户等级
|
||||
* @param levelId 等级id
|
||||
|
||||
@@ -168,10 +168,11 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
public CommonPage<StoreOrderDetailResponse> getAdminList(StoreOrderSearchRequest request, PageParamRequest pageParamRequest) {
|
||||
Page<Object> startPage = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
QueryWrapper<StoreOrder> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.select("id", "order_id", "uid", "real_name", "pay_price", "pay_type", "create_time", "status", "refund_status"
|
||||
queryWrapper.select("id", "order_id", "uid", "real_name", "user_phone", "pay_price", "pay_type", "create_time", "status", "refund_status"
|
||||
, "refund_reason_wap_img", "refund_reason_wap_explain", "refund_reason_wap", "refund_reason", "refund_reason_time"
|
||||
, "is_del", "combination_id", "pink_id", "seckill_id", "bargain_id", "verify_code", "remark", "paid", "is_system_del"
|
||||
, "shipping_type", "type", "is_alter_price", "pro_total_price", "is_alter_price", "coupon_price", "delivery_status");
|
||||
, "shipping_type", "type", "is_alter_price", "pro_total_price", "is_alter_price", "coupon_price", "delivery_status"
|
||||
, "use_integral");
|
||||
if (StrUtil.isNotBlank(request.getOrderNo())) {
|
||||
queryWrapper.eq("order_id", request.getOrderNo());
|
||||
}
|
||||
@@ -302,17 +303,19 @@ public class StoreOrderServiceImpl extends ServiceImpl<StoreOrderDao, StoreOrder
|
||||
|
||||
//获取订单详情map
|
||||
HashMap<Integer, List<StoreOrderInfoOldVo>> orderInfoList = StoreOrderInfoService.getMapInId(orderIdList);
|
||||
//
|
||||
// //根据用户获取信息
|
||||
// List<Integer> userIdList = orderList.stream().map(StoreOrder::getUid).distinct().collect(Collectors.toList());
|
||||
// //订单用户信息
|
||||
// HashMap<Integer, User> userList = userService.getMapListInUid(userIdList);
|
||||
|
||||
List<Integer> userIdList = orderList.stream().map(StoreOrder::getUid).filter(Objects::nonNull).distinct().collect(Collectors.toList());
|
||||
HashMap<Integer, User> userMap = CollUtil.isEmpty(userIdList) ? new HashMap<>() : userService.getMapListInUid(userIdList);
|
||||
|
||||
for (StoreOrder storeOrder : orderList) {
|
||||
StoreOrderDetailResponse storeOrderItemResponse = new StoreOrderDetailResponse();
|
||||
BeanUtils.copyProperties(storeOrder, storeOrderItemResponse);
|
||||
|
||||
storeOrderItemResponse.setProductList(orderInfoList.get(storeOrder.getId()));
|
||||
User buyer = userMap.get(storeOrder.getUid());
|
||||
if (ObjectUtil.isNotNull(buyer)) {
|
||||
storeOrderItemResponse.setNickname(buyer.getNickname());
|
||||
}
|
||||
|
||||
//订单状态
|
||||
storeOrderItemResponse.setStatusStr(getStatus(storeOrder));
|
||||
|
||||
@@ -33,7 +33,10 @@ import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@@ -73,22 +76,18 @@ public class UserIntegralRecordServiceImpl extends ServiceImpl<UserIntegralRecor
|
||||
LambdaQueryWrapper<UserIntegralRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(UserIntegralRecord::getUid, uid);
|
||||
lqw.eq(UserIntegralRecord::getLinkId, orderNo);
|
||||
lqw.in(UserIntegralRecord::getStatus, IntegralRecordConstants.INTEGRAL_RECORD_STATUS_CREATE, IntegralRecordConstants.INTEGRAL_RECORD_STATUS_FROZEN, IntegralRecordConstants.INTEGRAL_RECORD_STATUS_COMPLETE);
|
||||
lqw.in(UserIntegralRecord::getStatus, IntegralRecordConstants.INTEGRAL_RECORD_STATUS_CREATE,
|
||||
IntegralRecordConstants.INTEGRAL_RECORD_STATUS_FROZEN,
|
||||
IntegralRecordConstants.INTEGRAL_RECORD_STATUS_COMPLETE);
|
||||
List<UserIntegralRecord> recordList = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(recordList)) {
|
||||
return recordList;
|
||||
}
|
||||
for (int i = 0; i < recordList.size();) {
|
||||
UserIntegralRecord record = recordList.get(i);
|
||||
if (record.getType().equals(IntegralRecordConstants.INTEGRAL_RECORD_TYPE_ADD)) {
|
||||
if (record.getStatus().equals(IntegralRecordConstants.INTEGRAL_RECORD_STATUS_COMPLETE)) {
|
||||
recordList.remove(i);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
i++;
|
||||
}
|
||||
return recordList;
|
||||
// 过滤掉已完成的增加类型记录
|
||||
return recordList.stream()
|
||||
.filter(record -> !(record.getType().equals(IntegralRecordConstants.INTEGRAL_RECORD_TYPE_ADD)
|
||||
&& record.getStatus().equals(IntegralRecordConstants.INTEGRAL_RECORD_STATUS_COMPLETE)))
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -101,26 +100,45 @@ public class UserIntegralRecordServiceImpl extends ServiceImpl<UserIntegralRecor
|
||||
if (CollUtil.isEmpty(thawList)) {
|
||||
return;
|
||||
}
|
||||
for (UserIntegralRecord record : thawList) {
|
||||
// 查询对应的用户
|
||||
User user = userService.getById(record.getUid());
|
||||
|
||||
// 按用户分组,批量处理
|
||||
Map<Integer, List<UserIntegralRecord>> userRecordMap = thawList.stream()
|
||||
.collect(Collectors.groupingBy(UserIntegralRecord::getUid));
|
||||
|
||||
for (Map.Entry<Integer, List<UserIntegralRecord>> entry : userRecordMap.entrySet()) {
|
||||
Integer uid = entry.getKey();
|
||||
List<UserIntegralRecord> userRecords = entry.getValue();
|
||||
|
||||
User user = userService.getById(uid);
|
||||
if (ObjectUtil.isNull(user)) {
|
||||
continue ;
|
||||
logger.warn("积分解冻—用户不存在,uid = {}", uid);
|
||||
continue;
|
||||
}
|
||||
record.setStatus(IntegralRecordConstants.INTEGRAL_RECORD_STATUS_COMPLETE);
|
||||
// 计算积分余额
|
||||
Integer balance = (user.getIntegral() != null ? user.getIntegral() : BigDecimal.ZERO).add(record.getIntegral()).intValue();
|
||||
record.setBalance(balance);
|
||||
record.setUpdateTime(cn.hutool.core.date.DateUtil.date());
|
||||
|
||||
// 解冻
|
||||
|
||||
// 批量事务处理同一用户的积分解冻
|
||||
Boolean execute = transactionTemplate.execute(e -> {
|
||||
updateById(record);
|
||||
userService.operationIntegral(record.getUid(), record.getIntegral(), user.getIntegral(), "add");
|
||||
BigDecimal currentIntegral = user.getIntegral();
|
||||
for (UserIntegralRecord record : userRecords) {
|
||||
record.setStatus(IntegralRecordConstants.INTEGRAL_RECORD_STATUS_COMPLETE);
|
||||
// 计算积分余额
|
||||
Integer balance = (currentIntegral != null ? currentIntegral : BigDecimal.ZERO)
|
||||
.add(record.getIntegral()).intValue();
|
||||
record.setBalance(balance);
|
||||
record.setUpdateTime(cn.hutool.core.date.DateUtil.date());
|
||||
updateById(record);
|
||||
|
||||
// 更新用户积分
|
||||
userService.operationIntegral(uid, record.getIntegral(), currentIntegral, "add");
|
||||
currentIntegral = BigDecimal.valueOf(balance); // 更新当前积分供下一条记录计算
|
||||
}
|
||||
return Boolean.TRUE;
|
||||
});
|
||||
|
||||
if (!execute) {
|
||||
logger.error(StrUtil.format("积分解冻处理—解冻出错,记录id = {}", record.getId()));
|
||||
logger.error(StrUtil.format("积分解冻处理—批量解冻出错,用户uid = {},记录数 = {}",
|
||||
uid, userRecords.size()));
|
||||
} else {
|
||||
logger.info("积分解冻成功—用户uid = {},解冻记录数 = {}", uid, userRecords.size());
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -136,19 +154,48 @@ public class UserIntegralRecordServiceImpl extends ServiceImpl<UserIntegralRecor
|
||||
Page<UserIntegralRecordResponse> page = PageHelper.startPage(pageParamRequest.getPage(), pageParamRequest.getLimit());
|
||||
LambdaQueryWrapper<UserIntegralRecord> lqw = Wrappers.lambdaQuery();
|
||||
lqw.select(UserIntegralRecord::getId, UserIntegralRecord::getTitle, UserIntegralRecord::getBalance, UserIntegralRecord::getIntegral,
|
||||
UserIntegralRecord::getMark, UserIntegralRecord::getUid, UserIntegralRecord::getUpdateTime);
|
||||
UserIntegralRecord::getMark, UserIntegralRecord::getUid, UserIntegralRecord::getUpdateTime,
|
||||
UserIntegralRecord::getType, UserIntegralRecord::getLinkType, UserIntegralRecord::getStatus, UserIntegralRecord::getCreateTime);
|
||||
lqw.eq(UserIntegralRecord::getStatus, IntegralRecordConstants.INTEGRAL_RECORD_STATUS_COMPLETE);
|
||||
if (ObjectUtil.isNotNull(request.getUid())) {
|
||||
lqw.eq(UserIntegralRecord::getUid, request.getUid());
|
||||
}
|
||||
if (StrUtil.isNotBlank(request.getKeywords())) {
|
||||
List<Integer> idList = userService.findIdListLikeName(request.getKeywords());
|
||||
if (CollUtil.isNotEmpty(idList)) {
|
||||
lqw.in(UserIntegralRecord::getUid, idList);
|
||||
} else {
|
||||
|
||||
String nameKey = StrUtil.isNotBlank(request.getNickName()) ? request.getNickName() : request.getKeywords();
|
||||
List<Integer> nameUidList = null;
|
||||
if (StrUtil.isNotBlank(nameKey)) {
|
||||
nameUidList = userService.findIdListLikeName(nameKey);
|
||||
if (CollUtil.isEmpty(nameUidList)) {
|
||||
return CommonPage.copyPageInfo(page, CollUtil.newArrayList());
|
||||
}
|
||||
}
|
||||
List<Integer> phoneUidList = null;
|
||||
if (StrUtil.isNotBlank(request.getPhone())) {
|
||||
phoneUidList = userService.findIdListLikePhone(request.getPhone());
|
||||
if (CollUtil.isEmpty(phoneUidList)) {
|
||||
return CommonPage.copyPageInfo(page, CollUtil.newArrayList());
|
||||
}
|
||||
}
|
||||
List<Integer> mergedUids = null;
|
||||
if (nameUidList != null) {
|
||||
mergedUids = new ArrayList<>(nameUidList);
|
||||
}
|
||||
if (phoneUidList != null) {
|
||||
if (mergedUids == null) {
|
||||
mergedUids = new ArrayList<>(phoneUidList);
|
||||
} else {
|
||||
mergedUids.retainAll(new HashSet<>(phoneUidList));
|
||||
if (mergedUids.isEmpty()) {
|
||||
return CommonPage.copyPageInfo(page, CollUtil.newArrayList());
|
||||
}
|
||||
}
|
||||
}
|
||||
if (ObjectUtil.isNotNull(request.getUid())) {
|
||||
if (mergedUids != null && !mergedUids.contains(request.getUid())) {
|
||||
return CommonPage.copyPageInfo(page, CollUtil.newArrayList());
|
||||
}
|
||||
lqw.eq(UserIntegralRecord::getUid, request.getUid());
|
||||
} else if (mergedUids != null) {
|
||||
lqw.in(UserIntegralRecord::getUid, mergedUids);
|
||||
}
|
||||
|
||||
//时间范围
|
||||
if (StrUtil.isNotBlank(request.getDateLimit())) {
|
||||
DateLimitUtilVo dateLimit = CrmebDateUtil.getDateLimit(request.getDateLimit());
|
||||
@@ -161,6 +208,7 @@ public class UserIntegralRecordServiceImpl extends ServiceImpl<UserIntegralRecor
|
||||
lqw.between(UserIntegralRecord::getUpdateTime, dateLimit.getStartTime(), dateLimit.getEndTime());
|
||||
}
|
||||
lqw.orderByDesc(UserIntegralRecord::getUpdateTime);
|
||||
lqw.orderByDesc(UserIntegralRecord::getId);
|
||||
List<UserIntegralRecord> list = dao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(list)) {
|
||||
return CommonPage.copyPageInfo(page, CollUtil.newArrayList());
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import com.zbkj.common.constants.*;
|
||||
import com.zbkj.common.exception.CrmebException;
|
||||
import com.zbkj.common.model.consignment.WaUsers;
|
||||
import com.zbkj.common.model.coupon.StoreCoupon;
|
||||
import com.zbkj.common.model.coupon.StoreCouponUser;
|
||||
import com.zbkj.common.model.order.StoreOrder;
|
||||
@@ -28,6 +29,7 @@ import com.zbkj.common.token.FrontTokenComponent;
|
||||
import com.zbkj.common.utils.*;
|
||||
import com.zbkj.common.vo.DateLimitUtilVo;
|
||||
import com.zbkj.service.dao.UserDao;
|
||||
import com.zbkj.service.dao.consignment.WaUsersDao;
|
||||
import com.zbkj.service.service.*;
|
||||
import org.apache.commons.codec.digest.DigestUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
@@ -58,6 +60,9 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
@Resource
|
||||
private UserDao userDao;
|
||||
|
||||
@Resource
|
||||
private WaUsersDao waUsersDao;
|
||||
|
||||
@Autowired
|
||||
private UserBillService userBillService;
|
||||
|
||||
@@ -223,6 +228,33 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
return CommonPage.copyPageInfo(pageUser, userResponses);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void fillWaSelfBonus(List<UserResponse> users) {
|
||||
if (CollUtil.isEmpty(users)) {
|
||||
return;
|
||||
}
|
||||
List<Integer> uids = users.stream()
|
||||
.map(UserResponse::getUid)
|
||||
.filter(Objects::nonNull)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
if (CollUtil.isEmpty(uids)) {
|
||||
return;
|
||||
}
|
||||
List<WaUsers> waUsers = waUsersDao.selectBatchIds(uids);
|
||||
if (CollUtil.isEmpty(waUsers)) {
|
||||
return;
|
||||
}
|
||||
Map<Integer, BigDecimal> idToBonus = waUsers.stream()
|
||||
.filter(w -> w.getId() != null)
|
||||
.collect(Collectors.toMap(WaUsers::getId, WaUsers::getSelfBonus, (a, b) -> a));
|
||||
for (UserResponse ur : users) {
|
||||
if (ur.getUid() != null && idToBonus.containsKey(ur.getUid())) {
|
||||
ur.setSelfBonus(idToBonus.get(ur.getUid()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 操作积分、余额
|
||||
*/
|
||||
@@ -1586,6 +1618,18 @@ public class UserServiceImpl extends ServiceImpl<UserDao, User> implements UserS
|
||||
return userList.stream().map(User::getUid).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Integer> findIdListLikePhone(String phone) {
|
||||
LambdaQueryWrapper<User> lqw = Wrappers.lambdaQuery();
|
||||
lqw.select(User::getUid);
|
||||
lqw.like(User::getPhone, phone);
|
||||
List<User> userList = userDao.selectList(lqw);
|
||||
if (CollUtil.isEmpty(userList)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
return userList.stream().map(User::getUid).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
/**
|
||||
* 清除对应的用户等级
|
||||
* @param levelId 等级id
|
||||
|
||||
Reference in New Issue
Block a user