package com.oying.modules.rider.service.impl;
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.oying.modules.rider.domain.RiderWalletInfo;
|
import com.oying.utils.FileUtil;
|
import lombok.RequiredArgsConstructor;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.oying.modules.rider.service.RiderWalletInfoService;
|
import com.oying.modules.rider.domain.dto.RiderWalletInfoQueryCriteria;
|
import com.oying.modules.rider.mapper.RiderWalletInfoMapper;
|
import org.springframework.stereotype.Service;
|
import org.springframework.transaction.annotation.Transactional;
|
import com.oying.utils.PageUtil;
|
|
import java.util.List;
|
import java.util.Map;
|
import java.io.IOException;
|
import javax.servlet.http.HttpServletResponse;
|
import java.util.ArrayList;
|
import java.util.LinkedHashMap;
|
|
import com.oying.utils.PageResult;
|
|
/**
|
* @author pxb
|
* @description 服务实现
|
* @date 2025-06-18
|
**/
|
@Service
|
@RequiredArgsConstructor
|
public class RiderWalletInfoServiceImpl extends ServiceImpl<RiderWalletInfoMapper, RiderWalletInfo> implements RiderWalletInfoService {
|
|
private final RiderWalletInfoMapper riderWalletInfoMapper;
|
|
@Override
|
public PageResult<RiderWalletInfo> queryAll(RiderWalletInfoQueryCriteria criteria, Page<Object> page) {
|
return PageUtil.toPage(riderWalletInfoMapper.findAll(criteria, page));
|
}
|
|
@Override
|
public List<RiderWalletInfo> queryAll(RiderWalletInfoQueryCriteria criteria) {
|
return riderWalletInfoMapper.findAll(criteria);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void create(RiderWalletInfo resources) {
|
riderWalletInfoMapper.insert(resources);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void update(RiderWalletInfo resources) {
|
RiderWalletInfo riderWalletInfo = getById(resources.getWalletId());
|
riderWalletInfo.copy(resources);
|
riderWalletInfoMapper.updateById(riderWalletInfo);
|
}
|
|
@Override
|
@Transactional(rollbackFor = Exception.class)
|
public void deleteAll(List<Long> ids) {
|
riderWalletInfoMapper.deleteBatchIds(ids);
|
}
|
|
@Override
|
public void download(List<RiderWalletInfo> all, HttpServletResponse response) throws IOException {
|
List<Map<String, Object>> list = new ArrayList<>();
|
for (RiderWalletInfo riderWalletInfo : all) {
|
Map<String, Object> map = new LinkedHashMap<>();
|
map.put("骑手id", riderWalletInfo.getRiderId());
|
map.put("总金额", riderWalletInfo.getAmount());
|
map.put("可用余额", riderWalletInfo.getAvailableBalance());
|
map.put("购电总金额", riderWalletInfo.getPurchasingElectricityAmount());
|
map.put("累计提现", riderWalletInfo.getWithdrawTotal());
|
map.put("累计收入", riderWalletInfo.getIncomeTotal());
|
map.put("冻结金额", riderWalletInfo.getFrozenAmount());
|
map.put("完成总单数", riderWalletInfo.getRunTotal());
|
map.put("提现总次数", riderWalletInfo.getCashWithdrawalTotal());
|
map.put("购电总次数", riderWalletInfo.getPurchasingElectricityTotal());
|
map.put("钱包状态(0冻结,1正常)", riderWalletInfo.getStatus());
|
map.put("创建人", riderWalletInfo.getCreateBy());
|
map.put("创建时间", riderWalletInfo.getCreateTime());
|
map.put("修改人", riderWalletInfo.getUpdateBy());
|
map.put("修改时间", riderWalletInfo.getUpdateTime());
|
list.add(map);
|
}
|
FileUtil.downloadExcel(list, response);
|
}
|
|
@Override
|
public RiderWalletInfo getRiderWalletInfo(String riderId) {
|
QueryWrapper<RiderWalletInfo> queryWrapper = new QueryWrapper<>();
|
queryWrapper.eq(RiderWalletInfo.COL_RIDER_ID, riderId);
|
return riderWalletInfoMapper.selectOne(queryWrapper);
|
}
|
}
|