package com.xzx.gc.shop.service;
|
|
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.convert.Convert;
|
import com.github.pagehelper.PageHelper;
|
import com.github.pagehelper.PageInfo;
|
import com.xzx.gc.common.utils.StringUtils;
|
import com.xzx.gc.entity.AccountInfo;
|
import com.xzx.gc.shop.dto.QueryScoreDetailsListDto;
|
import com.xzx.gc.shop.dto.XcxScoreDetailsDto;
|
import com.xzx.gc.shop.mapper.AccountInfoMapper;
|
import com.xzx.gc.shop.mapper.ScoreDetailsMapper;
|
import com.xzx.gc.shop.vo.QueryOrderListVo;
|
import com.xzx.gc.shop.vo.QueryScoreDetailsListVo;
|
import com.xzx.gc.shop.vo.XcxScoreDetailsVo;
|
import lombok.extern.slf4j.Slf4j;
|
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
|
import javax.annotation.Resource;
|
import java.util.HashMap;
|
import java.util.List;
|
import java.util.Map;
|
|
@Service
|
@Transactional
|
@Slf4j
|
public class ScoreDetailsService {
|
|
@Resource
|
ScoreDetailsMapper scoreDetailsMapper;
|
|
@Autowired
|
private AccountInfoMapper accountInfoMapper;
|
|
public Map<String, Object> queryScoreDetailsList(QueryScoreDetailsListDto model) {
|
PageHelper.startPage(model.getPage(), model.getLimit());
|
List<QueryScoreDetailsListVo> maps = scoreDetailsMapper.queryScoreDetailsList(model);
|
if(CollUtil.isNotEmpty(maps)){
|
for(QueryScoreDetailsListVo queryScoreDetailsListVo : maps){
|
String decode = StringUtils.decode(queryScoreDetailsListVo.getName());
|
queryScoreDetailsListVo.setName(decode);
|
}
|
}
|
PageInfo pageInfo = new PageInfo(maps);
|
int count = Convert.toInt(pageInfo.getTotal());
|
Map<String, Object> map = new HashMap<>();
|
map.put("data", maps);
|
map.put("count", count);
|
map.put("code", 0);
|
return map;
|
}
|
|
public Map<String, Object> scoreDetails(XcxScoreDetailsDto xcxScoreDetailsDto) {
|
PageHelper.startPage(xcxScoreDetailsDto.getPageNo(), xcxScoreDetailsDto.getPageSize());
|
List<XcxScoreDetailsVo> details = scoreDetailsMapper.selectXcxScoreDetailsList(xcxScoreDetailsDto);
|
|
AccountInfo accountInfo = accountInfoMapper.selectAccountInfoByUserId(xcxScoreDetailsDto.getUserId());
|
|
Map<String, Object> map = new HashMap<>();
|
map.put("score", accountInfo.getCollectScore());
|
map.put("data", details);
|
return map;
|
}
|
|
}
|