update 全所收入统计中合同金额变更为收入合同总金额

This commit is contained in:
lijiarao
2022-09-01 16:29:09 +08:00
parent 33a50f8175
commit b1bb20f544
5 changed files with 90 additions and 17 deletions
@@ -219,4 +219,8 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
AllMoney queryPageListDepartment33(@Param("departStatisticsSearch") DepartStatisticsSearch departStatisticsSearch, @Param("idList") List<String> idList);
List<AllProjectStatistics> queryListAllProjectMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch, @Param("idList") List<String> idList);
List<AllProjectStatistics> queryListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
AllMoney queryAllMoney33(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
}
@@ -2225,7 +2225,6 @@
<!-- 全所收入统计-->
<select id="queryListAllProjectMoney" resultType="com.jero.statistics.entity.AllProjectStatistics">
select
sum(allMoney) as allMoney,
sum(paidNoTaxAmount) as comeAllMoney,
sum(invoiceNoTaxAmount) as billMoney,
sum(confirmNoTaxAmount) as confirmAmount,
@@ -2240,4 +2239,29 @@
group by DATE_FORMAT(pcpr.payment_date,'%Y-%m')
order by paymentDate
</select>
<!-- 全所收入统计-->
<select id="queryListAllMoney" resultType="com.jero.statistics.entity.AllProjectStatistics">
select
sum(contract_amount) as allMoney,
DATE_FORMAT(contract_date,'%Y-%m') as paymentDate
from pay_income_contract
<where>
<if test="allProjectStatisticsSearch.paymentYear != null and allProjectStatisticsSearch.paymentYear != ''">
and DATE_FORMAT (contract_date,'%Y') like concat(#{allProjectStatisticsSearch.paymentYear}, '%')
</if>
</where>
group by DATE_FORMAT(contract_date,'%Y-%m')
order by contract_date
</select>
<select id="queryAllMoney33" resultType="com.jero.statistics.entity.AllMoney">
select
sum(contract_amount) as allMoney
from pay_income_contract
<where>
<if test="allProjectStatisticsSearch.paymentYear != null and allProjectStatisticsSearch.paymentYear != ''">
and DATE_FORMAT (contract_date,'%Y') like concat(#{allProjectStatisticsSearch.paymentYear}, '%')
</if>
</where>
</select>
</mapper>
@@ -242,4 +242,6 @@ public interface IPayWorkingGroupService extends IService<PayWorkingGroup> {
List<AllProjectStatistics> queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List<String> idList);
List<AllProjectMoneyExcel> queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List<String> idList);
AllMoney queryAllMoney33(AllProjectStatisticsSearch allProjectStatisticsSearch);
}
@@ -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<PayWorkingGroupMappe
@Override
public List<AllProjectStatistics> queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List<String> idList) {
List<AllProjectStatistics> list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList);
return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list);
List<AllProjectStatistics> allMoneyList = payWorkingGroupMapper.queryListAllMoney(allProjectStatisticsSearch);
return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list,allMoneyList);
}
@Override
public List<AllProjectMoneyExcel> queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List<String> idList) {
List<AllProjectStatistics> list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList);
List<AllProjectStatistics> list2=getAllProjectMoneyStatistics(allProjectStatisticsSearch, list);
List<AllProjectStatistics> allMoneyList = payWorkingGroupMapper.queryListAllMoney(allProjectStatisticsSearch);
List<AllProjectStatistics> list2=getAllProjectMoneyStatistics(allProjectStatisticsSearch, list, allMoneyList);
AllMoney allMoney=payWorkingGroupMapper.queryPageList33(allProjectStatisticsSearch, idList);
List<String> comeAllMoneyList=list2.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList());
List<String> billMoneyList=list2.stream().map(AllProjectStatistics::getBillMoney).collect(Collectors.toList());
List<String> confirmMoneyList=list2.stream().map(AllProjectStatistics::getConfirmAmount).collect(Collectors.toList());
List<String> allMoneyList=list2.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList());
List<String> allMoneyList1=list2.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList());
List<List<String>> 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<PayWorkingGroupMappe
return excelList;
}
@Override
public AllMoney queryAllMoney33(AllProjectStatisticsSearch allProjectStatisticsSearch) {
return payWorkingGroupMapper.queryAllMoney33(allProjectStatisticsSearch);
}
@NotNull
private List<AllProjectStatistics> getAllProjectMoneyStatistics(AllProjectStatisticsSearch allProjectStatisticsSearch, List<AllProjectStatistics> list) {
List<Integer> collect=list.stream()
.map(allProjectStatistics -> Integer.valueOf(allProjectStatistics.getPaymentDate().split("-")[1]))
.collect(Collectors.toList());
private List<AllProjectStatistics> getAllProjectMoneyStatistics(AllProjectStatisticsSearch allProjectStatisticsSearch, List<AllProjectStatistics> list, List<AllProjectStatistics> allMoneyList) {
Map<String, String> comeAllMoneyMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getComeAllMoney));
Map<String, String> billMoneyMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getBillMoney));
Map<String, String> confirmAmountMap = list.stream().collect(Collectors.toMap(AllProjectStatistics::getPaymentDate, AllProjectStatistics::getConfirmAmount));
Map<String, String> 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<String> yearMonth = getYearMonth(paymentYear);
List<AllProjectStatistics> 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<String> getYearMonth(String year){
List<String> 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;
}
@@ -70,7 +70,8 @@ public class AllProjectMoneyStatisticsController {
HashMap<String, Object> 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());