add 收入分类统计增加收入分析
This commit is contained in:
+5
-3
@@ -2,7 +2,6 @@ package com.jero.index.contoller;
|
|||||||
|
|
||||||
import com.jero.common.api.vo.Result;
|
import com.jero.common.api.vo.Result;
|
||||||
import com.jero.common.aspect.annotation.DictPoint;
|
import com.jero.common.aspect.annotation.DictPoint;
|
||||||
import com.jero.common.exception.JeroBootException;
|
|
||||||
import com.jero.index.service.IndexService;
|
import com.jero.index.service.IndexService;
|
||||||
import com.jero.index.vo.HistogramVO;
|
import com.jero.index.vo.HistogramVO;
|
||||||
import com.jero.index.vo.LineChartListVO;
|
import com.jero.index.vo.LineChartListVO;
|
||||||
@@ -72,10 +71,13 @@ public class IndexController {
|
|||||||
@GetMapping(value = "/incomeClassificationStatistics")
|
@GetMapping(value = "/incomeClassificationStatistics")
|
||||||
public Result<List<PieChartVO>> incomeClassificationStatistics(@RequestParam(name="type", defaultValue = "1")Integer type) {
|
public Result<List<PieChartVO>> incomeClassificationStatistics(@RequestParam(name="type", defaultValue = "1")Integer type) {
|
||||||
if (Objects.equals(type,1)){
|
if (Objects.equals(type,1)){
|
||||||
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney");
|
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type);
|
||||||
return Result.OK(pieChartVOS);
|
return Result.OK(pieChartVOS);
|
||||||
}else if (Objects.equals(type,2)){
|
}else if (Objects.equals(type,2)){
|
||||||
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("confirmAmount");
|
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("confirmAmount", type);
|
||||||
|
return Result.OK(pieChartVOS);
|
||||||
|
}else if (Objects.equals(type,3)){
|
||||||
|
List<PieChartVO> pieChartVOS = indexService.totalAmountClassificationStatistics("allMoney", type);
|
||||||
return Result.OK(pieChartVOS);
|
return Result.OK(pieChartVOS);
|
||||||
}else {
|
}else {
|
||||||
return Result.OK();
|
return Result.OK();
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Objects;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -158,6 +159,8 @@ public class IndexService {
|
|||||||
String year = String.valueOf(DateUtil.year(new DateTime()));
|
String year = String.valueOf(DateUtil.year(new DateTime()));
|
||||||
DepartStatisticsSearch departStatisticsSearch = new DepartStatisticsSearch();
|
DepartStatisticsSearch departStatisticsSearch = new DepartStatisticsSearch();
|
||||||
departStatisticsSearch.setYear(year);
|
departStatisticsSearch.setYear(year);
|
||||||
|
departStatisticsSearch.setColumn("allMoney");
|
||||||
|
departStatisticsSearch.setOrder("desc");
|
||||||
Page<DepartStatistics> page = new Page<>(-1, -1);
|
Page<DepartStatistics> page = new Page<>(-1, -1);
|
||||||
IPage<DepartStatistics> pageList = payWorkingGroupService.queryPageListDepartment(page, departStatisticsSearch, new ArrayList<>());
|
IPage<DepartStatistics> pageList = payWorkingGroupService.queryPageListDepartment(page, departStatisticsSearch, new ArrayList<>());
|
||||||
List<DepartStatistics> records = pageList.getRecords();
|
List<DepartStatistics> records = pageList.getRecords();
|
||||||
@@ -207,9 +210,14 @@ public class IndexService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<PieChartVO> totalAmountClassificationStatistics(String column) {
|
public List<PieChartVO> totalAmountClassificationStatistics(String column, Integer type) {
|
||||||
String year = String.valueOf(DateUtil.year(new DateTime()));
|
String year = String.valueOf(DateUtil.year(new DateTime()));
|
||||||
List<AmountClassDTO> amountClassDTOS = payWorkingGroupMapper.amountClass(year,column);
|
List<AmountClassDTO> amountClassDTOS;
|
||||||
|
if (!Objects.equals(type,3)){
|
||||||
|
amountClassDTOS = payWorkingGroupMapper.amountClass(year,column);
|
||||||
|
}else {
|
||||||
|
amountClassDTOS = payWorkingGroupMapper.amountClass1(year,column);
|
||||||
|
}
|
||||||
BigDecimal all = amountClassDTOS.stream().map(AmountClassDTO::getMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
|
BigDecimal all = amountClassDTOS.stream().map(AmountClassDTO::getMoney).reduce(BigDecimal.ZERO,BigDecimal::add);
|
||||||
List<PieChartVO> pieChartVOS = new ArrayList<>();
|
List<PieChartVO> pieChartVOS = new ArrayList<>();
|
||||||
for (AmountClassDTO amountClassDTO : amountClassDTOS) {
|
for (AmountClassDTO amountClassDTO : amountClassDTOS) {
|
||||||
|
|||||||
+2
@@ -230,4 +230,6 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
|
|||||||
List<AllProjectStatistics> cumulativeListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
|
List<AllProjectStatistics> cumulativeListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
|
||||||
|
|
||||||
List<AmountClassDTO> amountClass(@Param("year") String year, @Param("column") String column);
|
List<AmountClassDTO> amountClass(@Param("year") String year, @Param("column") String column);
|
||||||
|
|
||||||
|
List<AmountClassDTO> amountClass1(@Param("year") String year, @Param("column") String column);
|
||||||
}
|
}
|
||||||
|
|||||||
+254
@@ -2321,4 +2321,258 @@
|
|||||||
</where>
|
</where>
|
||||||
GROUP BY chargeUse
|
GROUP BY chargeUse
|
||||||
</select>
|
</select>
|
||||||
|
<select id="amountClass1" resultType="com.jero.index.vo.AmountClassDTO">
|
||||||
|
SELECT chargeUse,
|
||||||
|
ifnull(SUM(${column}),0) as money
|
||||||
|
FROM (select pp.id as projectId,
|
||||||
|
pp.superId,
|
||||||
|
pp.projectName,
|
||||||
|
principalName,
|
||||||
|
chargeCompanyId,
|
||||||
|
chargeCompanyTemporaryId,
|
||||||
|
chargeCompanyTemporaryName,
|
||||||
|
allMoney,
|
||||||
|
comeAllMoney,
|
||||||
|
chargeUse,
|
||||||
|
depart,
|
||||||
|
createTime,
|
||||||
|
if(pp.pack = 0, '否', '是') as packText,
|
||||||
|
year,
|
||||||
|
payStatue,
|
||||||
|
departId,
|
||||||
|
departCode,
|
||||||
|
principalNameId,
|
||||||
|
type,
|
||||||
|
if(billMoney is null, 0, billMoney) as billMoney,
|
||||||
|
confirmAmount,
|
||||||
|
invoiceNoTaxAmount,
|
||||||
|
paidNoTaxAmount,
|
||||||
|
confirmNoTaxAmount,
|
||||||
|
contactsName,
|
||||||
|
pp.pack
|
||||||
|
from (
|
||||||
|
SELECT pwgs.id,
|
||||||
|
pwg.id as superId,
|
||||||
|
pwg.working_group_project AS projectName,
|
||||||
|
pwg.principal_name_a as principalName,
|
||||||
|
pwgs.charge_company_id AS chargeCompanyId,
|
||||||
|
pwgs.charge_company_temporary_id as chargeCompanyTemporaryId,
|
||||||
|
pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName,
|
||||||
|
pwgs.receivable_amount as allMoney,
|
||||||
|
pwgs.paid_amount as comeAllMoney,
|
||||||
|
16 as chargeUse,
|
||||||
|
sd.depart_name as depart,
|
||||||
|
pwgs.pack as pack,
|
||||||
|
pwg.year as year,
|
||||||
|
pwgs.in_account as payStatue,
|
||||||
|
sd.org_code as departCode,
|
||||||
|
sd.id as departId,
|
||||||
|
pwg.principal_id_a as principalNameId,
|
||||||
|
2 as type,
|
||||||
|
pwgs.invoice_amount AS billMoney,
|
||||||
|
confirm_amount as confirmAmount,
|
||||||
|
invoice_no_tax_amount as invoiceNoTaxAmount,
|
||||||
|
paid_no_tax_amount as paidNoTaxAmount,
|
||||||
|
confirm_no_tax_amount as confirmNoTaxAmount,
|
||||||
|
GROUP_CONCAT(pwgsc.contacts_temporary_name order by pwgsc.contacts_temporary_name) as contactsName,
|
||||||
|
pwgs.create_time as createTime
|
||||||
|
FROM pay_working_group pwg
|
||||||
|
right join pay_working_group_subitem pwgs on (pwg.id = pwgs.working_group_id)
|
||||||
|
left JOIN sys_user su on (pwg.principal_id_a = su.id)
|
||||||
|
left join sys_depart sd on (su.depart_ids = sd.id)
|
||||||
|
left JOIN pay_working_group_subitem_contacts pwgsc on pwgsc.working_group_sub_id = pwgs.id
|
||||||
|
where pwgs.charge_way = 2
|
||||||
|
group by pwgs.id
|
||||||
|
union all
|
||||||
|
SELECT pwgs.id,
|
||||||
|
pwg.id as superId,
|
||||||
|
pwg.working_group_project AS projectName,
|
||||||
|
pwg.principal_name_a as principalName,
|
||||||
|
pwgs.charge_company_id AS chargeCompanyId,
|
||||||
|
pwgs.charge_company_temporary_id as chargeCompanyTemporaryId,
|
||||||
|
pwgs.charge_company_temporary_name AS chargeCompanyTemporaryName,
|
||||||
|
pwgs.receivable_amount as allMoney,
|
||||||
|
pwgs.paid_amount as comeAllMoney,
|
||||||
|
pwgs.charge_use as chargeUse,
|
||||||
|
sd.depart_name as depart,
|
||||||
|
pwgs.pack as pack,
|
||||||
|
pwg.year as year,
|
||||||
|
pwgs.in_account as payStatue,
|
||||||
|
sd.org_code as departCode,
|
||||||
|
sd.id as departId,
|
||||||
|
pwg.principal_id_a as principalNameId,
|
||||||
|
2 as type,
|
||||||
|
pwgs.invoice_amount AS billMoney,
|
||||||
|
confirm_amount as confirmAmount,
|
||||||
|
invoice_no_tax_amount as invoiceNoTaxAmount,
|
||||||
|
paid_no_tax_amount as paidNoTaxAmount,
|
||||||
|
confirm_no_tax_amount as confirmNoTaxAmount,
|
||||||
|
GROUP_CONCAT(pwgsc.contacts_temporary_name order by pwgsc.contacts_temporary_name) as contactsName,
|
||||||
|
pwgs.create_time as createTime
|
||||||
|
FROM pay_working_group pwg
|
||||||
|
right join pay_working_group_subitem pwgs on (pwg.id = pwgs.working_group_id)
|
||||||
|
left JOIN sys_user su on (pwg.principal_id_a = su.id)
|
||||||
|
left join sys_depart sd on (su.depart_ids = sd.id)
|
||||||
|
left JOIN pay_working_group_subitem_contacts pwgsc on pwgsc.working_group_sub_id = pwgs.id
|
||||||
|
where pwgs.charge_way != 2
|
||||||
|
group by pwgs.id
|
||||||
|
union all
|
||||||
|
SELECT pcp.id,
|
||||||
|
pcp.id as superId,
|
||||||
|
pcp.charge_project AS projectName,
|
||||||
|
pcp.principal_name as principalName,
|
||||||
|
pcp.charge_company_id AS chargeCompanyId,
|
||||||
|
pcp.charge_company_temporary_id as chargeCompanyTemporaryId,
|
||||||
|
pcp.charge_company_temporary_name AS chargeCompanyTemporaryName,
|
||||||
|
pcp.receivable_amount as allMoney,
|
||||||
|
pcp.paid_amount as comeAllMoney,
|
||||||
|
pcp.charge_use as chargeUse,
|
||||||
|
sd.depart_name as depart,
|
||||||
|
pcp.pack as pack,
|
||||||
|
pcp.year as year,
|
||||||
|
pcp.in_account as payStatue,
|
||||||
|
sd.org_code as departCode,
|
||||||
|
sd.id as departId,
|
||||||
|
pcp.principal_id as principalNameId,
|
||||||
|
1 as type,
|
||||||
|
pcp.invoice_amount AS billMoney,
|
||||||
|
confirm_amount as confirmAmount,
|
||||||
|
invoice_no_tax_amount as invoiceNoTaxAmount,
|
||||||
|
paid_no_tax_amount as paidNoTaxAmount,
|
||||||
|
confirm_no_tax_amount as confirmNoTaxAmount,
|
||||||
|
contacts_temporary_name as contactsName,
|
||||||
|
pcp.create_time as createTime
|
||||||
|
FROM pay_common_project pcp
|
||||||
|
left JOIN sys_user su on (pcp.principal_id = su.id)
|
||||||
|
left join sys_depart sd on (su.depart_ids = sd.id)
|
||||||
|
union all
|
||||||
|
SELECT pmps.id,
|
||||||
|
pmp.id as superId,
|
||||||
|
pmp.project_name AS projectName,
|
||||||
|
su.realname as principalName,
|
||||||
|
pmps.company_id AS chargeCompanyId,
|
||||||
|
pmps.company_id as chargeCompanyTemporaryId,
|
||||||
|
pmps.company_name AS chargeCompanyTemporaryName,
|
||||||
|
pmps.amount_receivable as allMoney,
|
||||||
|
pmps.paid_amount as comeAllMoney,
|
||||||
|
pmps.charge_use as chargeUse,
|
||||||
|
sd.depart_name as depart,
|
||||||
|
pmps.pack as pack,
|
||||||
|
pmp.particular_year as year,
|
||||||
|
pmps.in_account as payStatue,
|
||||||
|
sd.org_code as departCode,
|
||||||
|
sd.id as departId,
|
||||||
|
pmp.director_id as principalNameId,
|
||||||
|
4 as type,
|
||||||
|
pmps.invoice_amount AS billMoney,
|
||||||
|
confirm_amount as confirmAmount,
|
||||||
|
invoice_no_tax_amount as invoiceNoTaxAmount,
|
||||||
|
paid_no_tax_amount as paidNoTaxAmount,
|
||||||
|
confirm_no_tax_amount as confirmNoTaxAmount,
|
||||||
|
company_contact_name as contactsName,
|
||||||
|
pmps.create_time as createTime
|
||||||
|
FROM pay_member_project pmp
|
||||||
|
right join pay_member_project_subitem pmps on (pmp.id = pmps.project_id)
|
||||||
|
left JOIN sys_user su on (pmp.director_id = su.id)
|
||||||
|
left join sys_depart sd on (su.depart_ids = sd.id)
|
||||||
|
union all
|
||||||
|
SELECT pms.id,
|
||||||
|
pm.id as superId,
|
||||||
|
pm.meeting_name AS projectName,
|
||||||
|
su.realname as principalName,
|
||||||
|
pms.company_id AS chargeCompanyId,
|
||||||
|
pms.company_id as chargeCompanyTemporaryId,
|
||||||
|
pms.company_name AS chargeCompanyTemporaryName,
|
||||||
|
pms.amount_receivable as allMoney,
|
||||||
|
pms.paid_amount as comeAllMoney,
|
||||||
|
pms.charge_use as chargeUse,
|
||||||
|
sd.depart_name as depart,
|
||||||
|
pms.pack as pack,
|
||||||
|
pm.particular_year as year,
|
||||||
|
pms.in_account as payStatue,
|
||||||
|
sd.org_code as departCode,
|
||||||
|
sd.id as departId,
|
||||||
|
pm.director_id as principalNameId,
|
||||||
|
3 as type,
|
||||||
|
pms.invoice_amount AS billMoney,
|
||||||
|
confirm_amount as confirmAmount,
|
||||||
|
invoice_no_tax_amount as invoiceNoTaxAmount,
|
||||||
|
paid_no_tax_amount as paidNoTaxAmount,
|
||||||
|
confirm_no_tax_amount as confirmNoTaxAmount,
|
||||||
|
company_contact_name as contactsName,
|
||||||
|
pms.create_time as createTime
|
||||||
|
FROM pay_meeting pm
|
||||||
|
right join pay_meeting_situation pms on (pm.id = pms.meeting_id)
|
||||||
|
left JOIN sys_user su on (pm.director_id = su.id)
|
||||||
|
left join sys_depart sd on (su.depart_ids = sd.id)
|
||||||
|
union all
|
||||||
|
SELECT tmps.id,
|
||||||
|
tmp.id as superId,
|
||||||
|
tmp.project_name AS projectName,
|
||||||
|
su.realname as principalName,
|
||||||
|
tmps.company_id AS chargeCompanyId,
|
||||||
|
tmps.company_id as chargeCompanyTemporaryId,
|
||||||
|
tmps.company_name AS chargeCompanyTemporaryName,
|
||||||
|
tmps.amount_receivable as allMoney,
|
||||||
|
tmps.paid_amount as comeAllMoney,
|
||||||
|
tmps.charge_use as chargeUse,
|
||||||
|
sd.depart_name as depart,
|
||||||
|
tmps.pack as pack,
|
||||||
|
tmp.year as year,
|
||||||
|
tmps.in_account as payStatue,
|
||||||
|
sd.org_code as departCode,
|
||||||
|
sd.id as departId,
|
||||||
|
tmp.director_id as principalNameId,
|
||||||
|
5 as type,
|
||||||
|
tmps.invoice_amount AS billMoney,
|
||||||
|
confirm_amount as confirmAmount,
|
||||||
|
invoice_no_tax_amount as invoiceNoTaxAmount,
|
||||||
|
paid_no_tax_amount as paidNoTaxAmount,
|
||||||
|
confirm_no_tax_amount as confirmNoTaxAmount,
|
||||||
|
liaison_man as contactsName,
|
||||||
|
tmps.create_time as createTime
|
||||||
|
FROM tb_member_project tmp
|
||||||
|
left join tb_member_project_subitem tmps on (tmp.id = tmps.project_id)
|
||||||
|
left JOIN sys_user su on (tmp.director_id = su.id)
|
||||||
|
left join sys_depart sd on (su.depart_ids = sd.id)
|
||||||
|
union all
|
||||||
|
SELECT tcp.id,
|
||||||
|
tmp.id as superId,
|
||||||
|
tmp.project_name AS projectName,
|
||||||
|
su.realname as principalName,
|
||||||
|
tcp.company_id AS chargeCompanyId,
|
||||||
|
tcp.company_id as chargeCompanyTemporaryId,
|
||||||
|
tcp.company_name AS chargeCompanyTemporaryName,
|
||||||
|
tcp.amount_receivable as allMoney,
|
||||||
|
tcp.paid_amount as comeAllMoney,
|
||||||
|
tcp.charge_use as chargeUse,
|
||||||
|
sd.depart_name as depart,
|
||||||
|
tcp.pack as pack,
|
||||||
|
tmp.year as year,
|
||||||
|
tcp.in_account as payStatue,
|
||||||
|
sd.org_code as departCode,
|
||||||
|
sd.id as departId,
|
||||||
|
tmp.director_id as principalNameId,
|
||||||
|
6 as type,
|
||||||
|
tcp.invoice_amount AS billMoney,
|
||||||
|
confirm_amount as confirmAmount,
|
||||||
|
invoice_no_tax_amount as invoiceNoTaxAmount,
|
||||||
|
paid_no_tax_amount as paidNoTaxAmount,
|
||||||
|
confirm_no_tax_amount as confirmNoTaxAmount,
|
||||||
|
liaison_man as contactsName,
|
||||||
|
tcp.create_time as createTime
|
||||||
|
FROM tb_member_project tmp
|
||||||
|
left join tb_certificate_payment tcp on (tmp.id = tcp.project_id)
|
||||||
|
left JOIN sys_user su on (tmp.director_id = su.id)
|
||||||
|
left join sys_depart sd on (su.depart_ids = sd.id)
|
||||||
|
) pp
|
||||||
|
where pp.allMoney is not null
|
||||||
|
and pp.allMoney != 0
|
||||||
|
order by pp.createTime) v
|
||||||
|
LEFT JOIN pay_confirm_payment_record pcpr ON (v.projectId = pcpr.project_id)
|
||||||
|
<where>
|
||||||
|
DATE_FORMAT(pcpr.payment_date, '%Y') like concat(#{year}, '%')
|
||||||
|
</where>
|
||||||
|
GROUP BY chargeUse
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user