| | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.account.dto.AccountDto2; |
| | | import com.ruoyi.account.dto.AccountDto3; |
| | | import com.ruoyi.account.dto.ReportDateDto; |
| | | import com.ruoyi.account.mapper.AccountIncomeMapper; |
| | | import com.ruoyi.account.pojo.AccountIncome; |
| | | import com.ruoyi.account.service.AccountIncomeService; |
| | | import com.ruoyi.common.utils.DateUtils; |
| | | import com.ruoyi.common.utils.poi.ExcelUtil; |
| | | import com.ruoyi.dto.DateQueryDto; |
| | | import com.ruoyi.project.system.domain.SysDictData; |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.Collections; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @AllArgsConstructor |
| | | @Service |
| | |
| | | //分页查询 |
| | | @Override |
| | | public IPage<AccountIncome> accountIncomeListPage(Page page, AccountIncome accountIncome) { |
| | | resolveIncomeMethodLabelFilter(accountIncome); |
| | | return accountIncomeMapper.accountIncomeListPage(page,accountIncome); |
| | | } |
| | | |
| | | private void resolveIncomeMethodLabelFilter(AccountIncome accountIncome) { |
| | | if (accountIncome == null) { |
| | | return; |
| | | } |
| | | if (accountIncome.getIncomeMethodLabel() == null || accountIncome.getIncomeMethodLabel().trim().isEmpty()) { |
| | | return; |
| | | } |
| | | String targetLabel = accountIncome.getIncomeMethodLabel().trim(); |
| | | List<String> paymentMethodList = selectDictValuesByLabel("payment_methods", targetLabel); |
| | | List<String> receiptPaymentMethodList = selectDictValuesByLabel("receipt_payment_type", targetLabel); |
| | | if (paymentMethodList.isEmpty()) { |
| | | paymentMethodList = Collections.singletonList("__NO_MATCH__"); |
| | | } |
| | | if (receiptPaymentMethodList.isEmpty()) { |
| | | receiptPaymentMethodList = Collections.singletonList("__NO_MATCH__"); |
| | | } |
| | | accountIncome.setPaymentMethodList(paymentMethodList); |
| | | accountIncome.setReceiptPaymentMethodList(receiptPaymentMethodList); |
| | | accountIncome.setIncomeMethod(null); |
| | | } |
| | | |
| | | private List<String> selectDictValuesByLabel(String dictType, String label) { |
| | | return sysDictDataMapper.selectDictDataByType(dictType).stream() |
| | | .filter(item -> label.equals(item.getDictLabel())) |
| | | .map(SysDictData::getDictValue) |
| | | .filter(v -> v != null && !v.trim().isEmpty()) |
| | | .distinct() |
| | | .collect(Collectors.toList()); |
| | | } |
| | | |
| | | //导出 |
| | | @Override |
| | | public void accountIncomeExport(HttpServletResponse response, AccountIncome accountIncome) { |