xiaoyong931011
2021-07-02 abf323cc9a96877ead8aa5e5caacff8c75e4d2e7
gc-shop/src/main/java/com/xzx/gc/shop/service/ScoreDetailsService.java
@@ -1,13 +1,20 @@
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;
@@ -24,9 +31,18 @@
    @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<>();
@@ -36,5 +52,16 @@
        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;
    }
}