diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/PayWorkingGroupMapper.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/PayWorkingGroupMapper.java index aa023a1a..3d7de864 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/PayWorkingGroupMapper.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/PayWorkingGroupMapper.java @@ -219,4 +219,8 @@ public interface PayWorkingGroupMapper extends BaseMapper { AllMoney queryPageListDepartment33(@Param("departStatisticsSearch") DepartStatisticsSearch departStatisticsSearch, @Param("idList") List idList); List queryListAllProjectMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch, @Param("idList") List idList); + + List queryListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); + + AllMoney queryAllMoney33(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupMapper.xml b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupMapper.xml index 55580110..2486fc25 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupMapper.xml +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/mapper/xml/PayWorkingGroupMapper.xml @@ -2225,7 +2225,6 @@ + + + + diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupService.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupService.java index e2c446c4..42351f54 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupService.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/IPayWorkingGroupService.java @@ -242,4 +242,6 @@ public interface IPayWorkingGroupService extends IService { List queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList); List queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList); + + AllMoney queryAllMoney33(AllProjectStatisticsSearch allProjectStatisticsSearch); } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java index d96d5744..8ba90017 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/project/service/impl/PayWorkingGroupServiceImpl.java @@ -1,5 +1,7 @@ package com.jero.project.service.impl; +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; import com.alibaba.fastjson.JSONObject; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; @@ -46,6 +48,8 @@ import java.util.regex.Matcher; import java.util.regex.Pattern; import java.util.stream.Collectors; +import static org.jeecg.modules.jmreport.desreport.b.b.i; + /** * @Description: pay_working_group @@ -635,21 +639,23 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList) { List list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList); - return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list); + List allMoneyList = payWorkingGroupMapper.queryListAllMoney(allProjectStatisticsSearch); + return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list,allMoneyList); } @Override public List queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList) { List list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList); - List list2=getAllProjectMoneyStatistics(allProjectStatisticsSearch, list); + List allMoneyList = payWorkingGroupMapper.queryListAllMoney(allProjectStatisticsSearch); + List list2=getAllProjectMoneyStatistics(allProjectStatisticsSearch, list, allMoneyList); AllMoney allMoney=payWorkingGroupMapper.queryPageList33(allProjectStatisticsSearch, idList); List comeAllMoneyList=list2.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList()); List billMoneyList=list2.stream().map(AllProjectStatistics::getBillMoney).collect(Collectors.toList()); List confirmMoneyList=list2.stream().map(AllProjectStatistics::getConfirmAmount).collect(Collectors.toList()); - List allMoneyList=list2.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList()); + List allMoneyList1=list2.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList()); List> list3 = new ArrayList<>(); - list3.add(0,allMoneyList); + list3.add(0,allMoneyList1); list3.add(1,confirmMoneyList); list3.add(2,billMoneyList); list3.add(3,comeAllMoneyList); @@ -683,22 +689,58 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl getAllProjectMoneyStatistics(AllProjectStatisticsSearch allProjectStatisticsSearch, List list) { - List collect=list.stream() - .map(allProjectStatistics -> Integer.valueOf(allProjectStatistics.getPaymentDate().split("-")[1])) - .collect(Collectors.toList()); + private List getAllProjectMoneyStatistics(AllProjectStatisticsSearch allProjectStatisticsSearch, List list, List allMoneyList) { + Map comeAllMoneyMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getComeAllMoney)); + Map billMoneyMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getBillMoney)); + Map confirmAmountMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getConfirmAmount)); + Map allMoneyMap = allMoneyList.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getAllMoney)); String paymentYear=allProjectStatisticsSearch.getPaymentYear(); - for (int i=1; i <= 12; i++) { - if (!collect.contains(i)) { - StringBuilder stringBuilder=new StringBuilder().append(paymentYear); - AllProjectStatistics allProjectStatistics=new AllProjectStatistics("0.00", "0.00", "0.00", "0.00", stringBuilder.append("-" + i).toString()); - list.add(allProjectStatistics); + List yearMonth = getYearMonth(paymentYear); + List returnList = new ArrayList<>(12); + for (String date : yearMonth) { + AllProjectStatistics allProjectStatistics = new AllProjectStatistics(); + allProjectStatistics.setAllMoney("0.00"); + allProjectStatistics.setConfirmAmount("0.00"); + allProjectStatistics.setBillMoney("0.00"); + allProjectStatistics.setComeAllMoney("0.00"); + allProjectStatistics.setPaymentDate(date); + returnList.add(allProjectStatistics); + } + for (AllProjectStatistics allProjectStatistics : returnList) { + String paymentDate = allProjectStatistics.getPaymentDate(); + if (comeAllMoneyMap.containsKey(paymentDate)) { + allProjectStatistics.setComeAllMoney(comeAllMoneyMap.get(paymentDate)); + } + if (billMoneyMap.containsKey(paymentDate)) { + allProjectStatistics.setBillMoney(billMoneyMap.get(paymentDate)); + } + if (confirmAmountMap.containsKey(paymentDate)) { + allProjectStatistics.setConfirmAmount(confirmAmountMap.get(paymentDate)); + } + if (allMoneyMap.containsKey(paymentDate)) { + allProjectStatistics.setAllMoney(allMoneyMap.get(paymentDate)); } } - list.sort(Comparator.comparing(allProjectStatistics -> Integer.valueOf(allProjectStatistics.getPaymentDate().split("-")[1]))); - return list; + return returnList; + } + + private List getYearMonth(String year){ + List yearMonthList = new ArrayList<>(12); + DateTime parse = DateUtil.parse(year,"yyyy"); + parse = DateUtil.beginOfYear(parse); + for (int i=1; i <= 12; i++) { + String format = DateUtil.format(parse, "yyyy-MM"); + yearMonthList.add(format); + parse = DateUtil.offsetMonth(parse, 1); + } + return yearMonthList; } diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java index db5ba355..23d2ce41 100644 --- a/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java +++ b/jero-boot-incoming-payment/src/main/java/com/jero/statistics/controller/AllProjectMoneyStatisticsController.java @@ -70,7 +70,8 @@ public class AllProjectMoneyStatisticsController { HashMap hashMap = new HashMap<>(); AllMoney allMoney = payWorkingGroupService.queryPageList33(allProjectStatisticsSearch, null); - hashMap.put("sumOfMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getAllMoney()); + AllMoney allMoney1 = payWorkingGroupService.queryAllMoney33(allProjectStatisticsSearch); + hashMap.put("sumOfMoney", ObjectUtils.isEmpty(allMoney1) ? 0 : allMoney1.getAllMoney()); hashMap.put("sumOfReallyMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getComeAllMoney()); hashMap.put("sumOfBillMoney", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getBillMoney()); hashMap.put("sumOfConfirmAmount", ObjectUtils.isEmpty(allMoney) ? 0 : allMoney.getConfirmAmount());