From 288854218ea4055a2a88a9b0f2f155d3909c7820 Mon Sep 17 00:00:00 2001 From: lijiarao Date: Thu, 1 Sep 2022 17:45:48 +0800 Subject: [PATCH] =?UTF-8?q?add=20=E9=A6=96=E9=A1=B5=E6=8A=98=E7=BA=BF?= =?UTF-8?q?=E5=9B=BE=E5=92=8C=E5=88=97=E8=A1=A8=EF=BC=8C=E5=A0=86=E5=8F=A0?= =?UTF-8?q?=E5=9B=BE=E5=92=8C=E5=88=97=E8=A1=A8=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../jero/index/contoller/IndexController.java | 80 +++++++++++ .../com/jero/index/service/IndexService.java | 129 ++++++++++++++++++ .../com/jero/index/vo/LineChartListVO.java | 27 ++++ .../java/com/jero/index/vo/LineChartVO.java | 29 ++++ .../project/mapper/PayWorkingGroupMapper.java | 4 + .../mapper/xml/PayWorkingGroupMapper.xml | 46 +++++++ .../service/IPayWorkingGroupService.java | 2 + .../impl/PayWorkingGroupServiceImpl.java | 9 +- 8 files changed, 324 insertions(+), 2 deletions(-) create mode 100644 jero-boot-incoming-payment/src/main/java/com/jero/index/contoller/IndexController.java create mode 100644 jero-boot-incoming-payment/src/main/java/com/jero/index/service/IndexService.java create mode 100644 jero-boot-incoming-payment/src/main/java/com/jero/index/vo/LineChartListVO.java create mode 100644 jero-boot-incoming-payment/src/main/java/com/jero/index/vo/LineChartVO.java diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/index/contoller/IndexController.java b/jero-boot-incoming-payment/src/main/java/com/jero/index/contoller/IndexController.java new file mode 100644 index 00000000..d7efd24c --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/index/contoller/IndexController.java @@ -0,0 +1,80 @@ +package com.jero.index.contoller; + +import com.jero.common.api.vo.Result; +import com.jero.index.service.IndexService; +import com.jero.index.vo.LineChartListVO; +import com.jero.index.vo.LineChartVO; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.List; + +/** + * @author liJiaRao + * @date 2022-09-01 16:32 + */ +@Api(tags = "首页") +@RestController +@RequestMapping("/index") +@Slf4j +public class IndexController { + @Resource + private IndexService indexService; + + @ApiOperation(value = "折线图") + @GetMapping(value = "/lineChart") + public Result lineChart() { + LineChartVO lineChartVO = indexService.lineChart(); + return Result.OK(lineChartVO); + } + + @ApiOperation(value = "折线图列表") + @GetMapping(value = "/lineChartList") + public Result> lineChartList() { + List list = indexService.lineChartList(); + return Result.OK(list); + } + + @ApiOperation(value = "累计图") + @GetMapping(value = "/cumulativeGraph") + public Result cumulativeGraph() { + LineChartVO lineChartVO = indexService.cumulativeGraph(); + return Result.OK(lineChartVO); + } + + @ApiOperation(value = "累计图列表") + @GetMapping(value = "/cumulativeGraphList") + public Result> cumulativeGraphList() { + List list = indexService.cumulativeGraphList(); + return Result.OK(list); + } + + @ApiOperation(value = "科室总体统计") + @GetMapping(value = "/overallDepartmentStatistics") + public Result overallDepartmentStatistics() { + return Result.OK(); + } + + @ApiOperation(value = "总金额分类统计") + @GetMapping(value = "/totalAmountClassificationStatistics") + public Result totalAmountClassificationStatistics() { + return Result.OK(); + } + + @ApiOperation(value = "收入分类统计") + @GetMapping(value = "/incomeClassificationStatistics") + public Result incomeClassificationStatistics() { + return Result.OK(); + } + + @ApiOperation(value = "前十统计") + @GetMapping(value = "/top10Statistics") + public Result top10Statistics() { + return Result.OK(); + } +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/index/service/IndexService.java b/jero-boot-incoming-payment/src/main/java/com/jero/index/service/IndexService.java new file mode 100644 index 00000000..73f712f4 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/index/service/IndexService.java @@ -0,0 +1,129 @@ +package com.jero.index.service; +import com.google.common.collect.Lists; + +import cn.hutool.core.date.DateTime; +import cn.hutool.core.date.DateUtil; +import com.jero.index.vo.LineChartListVO; +import com.jero.index.vo.LineChartVO; +import com.jero.project.service.IPayWorkingGroupService; +import com.jero.statistics.entity.AllProjectStatistics; +import com.jero.statistics.entity.AllProjectStatisticsSearch; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.ArrayList; +import java.util.List; +import java.util.stream.Collectors; + +/** + * @author liJiaRao + * @date 2022-09-01 16:32 + */ +@Service +public class IndexService { + @Resource + private IPayWorkingGroupService payWorkingGroupService; + + public LineChartVO lineChart() { + String year = String.valueOf(DateUtil.year(new DateTime())); + AllProjectStatisticsSearch allProjectStatisticsSearch = new AllProjectStatisticsSearch(); + allProjectStatisticsSearch.setPaymentYear(year); + List list = payWorkingGroupService.queryListAllProjectMoney(allProjectStatisticsSearch, null); + List comeAllMoneyMap = list.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList()); + List billMoneyMap = list.stream().map(AllProjectStatistics::getBillMoney).collect(Collectors.toList()); + List confirmAmountMap = list.stream().map(AllProjectStatistics::getConfirmAmount).collect(Collectors.toList()); + List allMoneyMap = list.stream().map(AllProjectStatistics::getAllMoney).collect(Collectors.toList()); + List date = list.stream().map(AllProjectStatistics::getPaymentDate).collect(Collectors.toList()); + List dateList = new ArrayList<>(12); + for (String d : date) { + DateTime parse = DateUtil.parse(d, "yyyy-MM"); + int i = parse.monthStartFromOne(); + dateList.add(i + "月"); + } + LineChartVO lineChartVO = new LineChartVO(); + lineChartVO.setAllMoney(allMoneyMap); + lineChartVO.setConfirmAmount(confirmAmountMap); + lineChartVO.setBillMoney(billMoneyMap); + lineChartVO.setComeAllMoney(comeAllMoneyMap); + lineChartVO.setPaymentDate(dateList); + return lineChartVO; + } + + + public List lineChartList() { + String year = String.valueOf(DateUtil.year(new DateTime())); + AllProjectStatisticsSearch allProjectStatisticsSearch = new AllProjectStatisticsSearch(); + allProjectStatisticsSearch.setPaymentYear(year); + List list = payWorkingGroupService.queryListAllProjectMoney(allProjectStatisticsSearch, null); + List lineChartListVOList = convertLineChartListVO(list); + return lineChartListVOList; + } + + private List convertLineChartListVO(List list){ + List lineChartListVOlist=Lists.newArrayList(); + for (AllProjectStatistics allProjectStatistics :list) { + lineChartListVOlist.add(convertFromAllProjectStatistics(allProjectStatistics)); + } + return lineChartListVOlist; + + } + + private LineChartListVO convertFromAllProjectStatistics(AllProjectStatistics allProjectStatistics) { + LineChartListVO lineChartListVO = new LineChartListVO(); + lineChartListVO.setAllMoney(allProjectStatistics.getAllMoney()); + lineChartListVO.setConfirmAmount(allProjectStatistics.getConfirmAmount()); + lineChartListVO.setBillMoney(allProjectStatistics.getBillMoney()); + lineChartListVO.setComeAllMoney(allProjectStatistics.getComeAllMoney()); + lineChartListVO.setPaymentDate(allProjectStatistics.getPaymentDate()); + return lineChartListVO; + } + + public LineChartVO cumulativeGraph() { + String year = String.valueOf(DateUtil.year(new DateTime())); + AllProjectStatisticsSearch allProjectStatisticsSearch = new AllProjectStatisticsSearch(); + allProjectStatisticsSearch.setPaymentYear(year); + List list = payWorkingGroupService.cumulativeListAllProjectMoney(allProjectStatisticsSearch); + List comeAllMoneyMap = cumulativeProcesZero(list.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList())); + List billMoneyMap = cumulativeProcesZero(list.stream().map(AllProjectStatistics::getBillMoney).collect(Collectors.toList())); + List confirmAmountMap = cumulativeProcesZero(list.stream().map(AllProjectStatistics::getConfirmAmount).collect(Collectors.toList())); + List allMoneyMap = cumulativeProcesZero(list.stream().map(AllProjectStatistics::getAllMoney).collect(Collectors.toList())); + List date = list.stream().map(AllProjectStatistics::getPaymentDate).collect(Collectors.toList()); + List dateList = new ArrayList<>(12); + for (String d : date) { + DateTime parse = DateUtil.parse(d, "yyyy-MM"); + int i = parse.monthStartFromOne(); + dateList.add(i + "月"); + } + LineChartVO lineChartVO = new LineChartVO(); + lineChartVO.setAllMoney(allMoneyMap); + lineChartVO.setConfirmAmount(confirmAmountMap); + lineChartVO.setBillMoney(billMoneyMap); + lineChartVO.setComeAllMoney(comeAllMoneyMap); + lineChartVO.setPaymentDate(dateList); + return lineChartVO; + } + + public List cumulativeGraphList() { + String year = String.valueOf(DateUtil.year(new DateTime())); + AllProjectStatisticsSearch allProjectStatisticsSearch = new AllProjectStatisticsSearch(); + allProjectStatisticsSearch.setPaymentYear(year); + List list = payWorkingGroupService.cumulativeListAllProjectMoney(allProjectStatisticsSearch); + List lineChartListVOList = convertLineChartListVO(list); + return lineChartListVOList; + + } + + /** + * 处理堆叠图中的0 + */ + private List cumulativeProcesZero (List list){ + for (int i = 1; i < list.size(); i++) { + //如果为0就保存上一位数据 + if (list.get(i).equals("0.00")) { + list.set(i,list.get(i-1)); + } + } + return list; + } + +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/index/vo/LineChartListVO.java b/jero-boot-incoming-payment/src/main/java/com/jero/index/vo/LineChartListVO.java new file mode 100644 index 00000000..c70877e6 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/index/vo/LineChartListVO.java @@ -0,0 +1,27 @@ +package com.jero.index.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author liJiaRao + * @date 2022-09-01 16:48 + */ +@Data +public class LineChartListVO { + @ApiModelProperty(value = "合同金额") + private String allMoney; + + @ApiModelProperty(value = "确认收入金额") + private String confirmAmount; + + @ApiModelProperty(value = "开票金额") + private String billMoney; + + @ApiModelProperty(value = "到账金额") + private String comeAllMoney; + + @ApiModelProperty(value = "到账时间") + private String paymentDate; + +} diff --git a/jero-boot-incoming-payment/src/main/java/com/jero/index/vo/LineChartVO.java b/jero-boot-incoming-payment/src/main/java/com/jero/index/vo/LineChartVO.java new file mode 100644 index 00000000..ab696441 --- /dev/null +++ b/jero-boot-incoming-payment/src/main/java/com/jero/index/vo/LineChartVO.java @@ -0,0 +1,29 @@ +package com.jero.index.vo; + +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.util.List; + +/** + * @author liJiaRao + * @date 2022-09-01 16:48 + */ +@Data +public class LineChartVO { + @ApiModelProperty(value = "合同金额") + private List allMoney; + + @ApiModelProperty(value = "确认收入金额") + private List confirmAmount; + + @ApiModelProperty(value = "开票金额") + private List billMoney; + + @ApiModelProperty(value = "到账金额") + private List comeAllMoney; + + @ApiModelProperty(value = "到账时间") + private List paymentDate; + +} 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 3d7de864..e53cab4e 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 @@ -223,4 +223,8 @@ public interface PayWorkingGroupMapper extends BaseMapper { List queryListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); AllMoney queryAllMoney33(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); + + List cumulativeListAllProjectMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch); + + List cumulativeListAllMoney(@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 2486fc25..c0c5e5f8 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 @@ -2264,4 +2264,50 @@ + + + + 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 42351f54..dc1d4b3c 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 @@ -241,6 +241,8 @@ public interface IPayWorkingGroupService extends IService { List queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList); + List cumulativeListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch); + 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 8ba90017..1468d3f5 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 @@ -48,8 +48,6 @@ 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 @@ -643,6 +641,13 @@ public class PayWorkingGroupServiceImpl extends ServiceImpl cumulativeListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch) { + List list = payWorkingGroupMapper.cumulativeListAllProjectMoney(allProjectStatisticsSearch); + List allMoneyList = payWorkingGroupMapper.cumulativeListAllMoney(allProjectStatisticsSearch); + return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list,allMoneyList); + } + @Override public List queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List idList) { List list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList);