| | |
| | | import cn.hutool.core.collection.CollUtil; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.google.common.collect.Sets; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.exception.ServiceException; |
| | | import com.ruoyi.system.dto.TIntegralSettlementDTO; |
| | | import com.ruoyi.system.export.IntegralSettlementImport; |
| | | import com.ruoyi.system.model.TAppUser; |
| | | import com.ruoyi.system.model.TIntegralSettlement; |
| | | import com.ruoyi.system.mapper.TIntegralSettlementMapper; |
| | | import com.ruoyi.system.query.TIntegralSettlementDetailQuery; |
| | | import com.ruoyi.system.query.TIntegralSettlementQuery; |
| | | import com.ruoyi.system.service.ISysUserService; |
| | | import com.ruoyi.system.service.TAppUserService; |
| | | import com.ruoyi.system.service.TIntegralSettlementService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.system.vo.TIntegralSettlementDetailVO; |
| | | import com.ruoyi.system.vo.TIntegralSettlementVO; |
| | | import lombok.Cleanup; |
| | | import lombok.RequiredArgsConstructor; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.springframework.context.annotation.Lazy; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.io.InputStream; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Set; |
| | | import java.math.BigDecimal; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | * @author xiaochen |
| | | * @since 2025-12-08 |
| | | */ |
| | | @Slf4j |
| | | @Service |
| | | @RequiredArgsConstructor(onConstructor_ = @Lazy) |
| | | public class TIntegralSettlementServiceImpl extends ServiceImpl<TIntegralSettlementMapper, TIntegralSettlement> implements TIntegralSettlementService { |
| | | private final TAppUserService appUserService; |
| | | private final ISysUserService sysUserService; |
| | | |
| | | @Override |
| | | public Page<TIntegralSettlementVO> getSettlementPageList(TIntegralSettlementQuery query) { |
| | | Page<TIntegralSettlementVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | |
| | | }).collect(Collectors.toList()); |
| | | saveBatch(saveList); |
| | | } catch (Exception e) { |
| | | throw new RuntimeException(e); |
| | | log.error("导入积分结算异常", e); |
| | | throw new ServiceException("导入积分结算异常"); |
| | | } |
| | | } |
| | | |
| | |
| | | } |
| | | return Collections.emptyMap(); |
| | | } |
| | | |
| | | @Override |
| | | public TIntegralSettlementVO getDetail(Integer id) { |
| | | TIntegralSettlement integralSettlement = this.getById(id); |
| | | TIntegralSettlementVO tIntegralSettlementVO = BeanUtil.copyProperties(integralSettlement, TIntegralSettlementVO.class); |
| | | if (Objects.nonNull(integralSettlement)) { |
| | | List<TIntegralSettlement> list = this.lambdaQuery().eq(TIntegralSettlement::getSettlementInterval, integralSettlement.getSettlementInterval()).list(); |
| | | BigDecimal total = list.stream().map(TIntegralSettlement::getTotalSettlementIntegral).reduce(BigDecimal.ZERO, BigDecimal::add); |
| | | tIntegralSettlementVO.setTotalSettlementIntegral(total); |
| | | SysUser sysUser = sysUserService.selectUserById(Long.valueOf(integralSettlement.getCreateUserId())); |
| | | tIntegralSettlementVO.setCreateUserName(Objects.nonNull(sysUser) ? sysUser.getNickName() : ""); |
| | | } |
| | | return tIntegralSettlementVO; |
| | | } |
| | | |
| | | @Override |
| | | public Page<TIntegralSettlementDetailVO> getSettlementDetailPageList(TIntegralSettlementDetailQuery query) { |
| | | Page<TIntegralSettlementDetailVO> page = new Page<>(query.getPageNum(), query.getPageSize()); |
| | | page.setRecords(baseMapper.getSettlementDetailPageList(page, query)); |
| | | return page; |
| | | } |
| | | } |