|
|
@@ -1,11 +1,27 @@
|
|
|
package com.kxs.user.biz.service.impl;
|
|
|
|
|
|
+import cn.hutool.core.bean.BeanUtil;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
+import com.kxs.common.core.util.TotalDateUtil;
|
|
|
+import com.kxs.common.security.util.SecurityUtils;
|
|
|
+import com.kxs.user.api.model.KxsUserProfitLkb;
|
|
|
+import com.kxs.user.api.model.KxsUserProfitZlb;
|
|
|
+import com.kxs.user.api.vo.kxsapp.userAccount.UserProfitListVO;
|
|
|
+import com.kxs.user.biz.constant.enums.UserProfitTypeEnum;
|
|
|
+import com.kxs.user.biz.mapper.KxsUserProfitLkbMapper;
|
|
|
import com.kxs.user.biz.mapper.KxsUserProfitMapper;
|
|
|
import com.kxs.user.api.model.KxsUserProfit;
|
|
|
+import com.kxs.user.biz.mapper.KxsUserProfitZlbMapper;
|
|
|
import com.kxs.user.biz.service.KxsUserProfitService;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
+import java.time.LocalDate;
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
/**
|
|
|
* 用户分润表pos(KxsUserProfit)表服务实现类
|
|
|
*
|
|
|
@@ -13,7 +29,69 @@ import org.springframework.stereotype.Service;
|
|
|
* @since 2024-07-22 11:44:59
|
|
|
*/
|
|
|
@Service("kxsUserProfitService")
|
|
|
+@RequiredArgsConstructor
|
|
|
public class KxsUserProfitServiceImpl extends ServiceImpl<KxsUserProfitMapper, KxsUserProfit> implements KxsUserProfitService {
|
|
|
|
|
|
+ private final KxsUserProfitZlbMapper kxsUserProfitZlbMapper;
|
|
|
+
|
|
|
+ private final KxsUserProfitLkbMapper kxsUserProfitLkbMapper;
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Integer profitFlag() {
|
|
|
+
|
|
|
+ Integer nowMonth = TotalDateUtil.getMonthNumber(LocalDate.now().minusMonths(1));
|
|
|
+ long count = count(Wrappers.<KxsUserProfit>lambdaQuery().eq(KxsUserProfit::getProfitMonth, nowMonth)
|
|
|
+ .eq(KxsUserProfit::getUserId, SecurityUtils.getUser().getId())
|
|
|
+ .eq(KxsUserProfit::getStatus, UserProfitTypeEnum.NO_PROFIT.getType()));
|
|
|
+
|
|
|
+ return count > 0 ? 1 : 0;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public List<UserProfitListVO> profitList() {
|
|
|
+
|
|
|
+ Long userId = SecurityUtils.getUser().getId();
|
|
|
+ Integer nowMonth = TotalDateUtil.getMonthNumber(LocalDate.now().minusMonths(1));
|
|
|
+
|
|
|
+ ArrayList<UserProfitListVO> list = new ArrayList<>();
|
|
|
+ //pos
|
|
|
+ List<KxsUserProfit> userProfitList = list(Wrappers.<KxsUserProfit>lambdaQuery().eq(KxsUserProfit::getProfitMonth, nowMonth)
|
|
|
+ .eq(KxsUserProfit::getUserId, userId)
|
|
|
+ .eq(KxsUserProfit::getStatus, UserProfitTypeEnum.NO_PROFIT.getType()));
|
|
|
+
|
|
|
+ //助力宝
|
|
|
+ List<KxsUserProfitZlb> kxsUserProfitZlbList = kxsUserProfitZlbMapper.selectList(Wrappers.<KxsUserProfitZlb>lambdaQuery().eq(KxsUserProfitZlb::getProfitMonth, nowMonth)
|
|
|
+ .eq(KxsUserProfitZlb::getUserId, userId)
|
|
|
+ .eq(KxsUserProfitZlb::getStatus, UserProfitTypeEnum.NO_PROFIT.getType()));
|
|
|
+ //来客吧
|
|
|
+ List<KxsUserProfitLkb> kxsUserProfitLkbList = kxsUserProfitLkbMapper.selectList(Wrappers.<KxsUserProfitLkb>lambdaQuery().eq(KxsUserProfitLkb::getProfitMonth, nowMonth)
|
|
|
+ .eq(KxsUserProfitLkb::getUserId, userId)
|
|
|
+ .eq(KxsUserProfitLkb::getStatus, UserProfitTypeEnum.NO_PROFIT.getType()));
|
|
|
+
|
|
|
+ for (KxsUserProfit userProfit : userProfitList) {
|
|
|
+ UserProfitListVO userProfitVO = new UserProfitListVO();
|
|
|
+ BeanUtil.copyProperties(userProfit, userProfitVO);
|
|
|
+ list.add(userProfitVO);
|
|
|
+ }
|
|
|
+ for (KxsUserProfitZlb userProfitZlb : kxsUserProfitZlbList) {
|
|
|
+ UserProfitListVO userProfitVO = new UserProfitListVO();
|
|
|
+ userProfitVO.setProfitAmt(userProfitZlb.getProfitAmt());
|
|
|
+ userProfitVO.setProfitMonth(userProfitZlb.getProfitMonth());
|
|
|
+ userProfitVO.setStatus(userProfitZlb.getStatus());
|
|
|
+ userProfitVO.setBrandName("助力宝");
|
|
|
+ userProfitVO.setTradeType(0);
|
|
|
+ userProfitVO.setTradeType(userProfitZlb.getIsTeam());
|
|
|
+ }
|
|
|
+ for (KxsUserProfitLkb kxsUserProfitLkb : kxsUserProfitLkbList) {
|
|
|
+ UserProfitListVO userProfitVO = new UserProfitListVO();
|
|
|
+ userProfitVO.setProfitAmt(kxsUserProfitLkb.getProfitAmt());
|
|
|
+ userProfitVO.setProfitMonth(kxsUserProfitLkb.getProfitMonth());
|
|
|
+ userProfitVO.setStatus(kxsUserProfitLkb.getStatus());
|
|
|
+ userProfitVO.setBrandName("来客吧");
|
|
|
+ userProfitVO.setTradeType(kxsUserProfitLkb.getTradeType());
|
|
|
+
|
|
|
+ }
|
|
|
+ return null;
|
|
|
+ }
|
|
|
}
|
|
|
|