add 首页折线图和列表,堆叠图和列表。
This commit is contained in:
+80
@@ -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<LineChartVO> lineChart() {
|
||||
LineChartVO lineChartVO = indexService.lineChart();
|
||||
return Result.OK(lineChartVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "折线图列表")
|
||||
@GetMapping(value = "/lineChartList")
|
||||
public Result<List<LineChartListVO>> lineChartList() {
|
||||
List<LineChartListVO> list = indexService.lineChartList();
|
||||
return Result.OK(list);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "累计图")
|
||||
@GetMapping(value = "/cumulativeGraph")
|
||||
public Result<LineChartVO> cumulativeGraph() {
|
||||
LineChartVO lineChartVO = indexService.cumulativeGraph();
|
||||
return Result.OK(lineChartVO);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "累计图列表")
|
||||
@GetMapping(value = "/cumulativeGraphList")
|
||||
public Result<List<LineChartListVO>> cumulativeGraphList() {
|
||||
List<LineChartListVO> 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();
|
||||
}
|
||||
}
|
||||
@@ -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<AllProjectStatistics> list = payWorkingGroupService.queryListAllProjectMoney(allProjectStatisticsSearch, null);
|
||||
List<String> comeAllMoneyMap = list.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList());
|
||||
List<String> billMoneyMap = list.stream().map(AllProjectStatistics::getBillMoney).collect(Collectors.toList());
|
||||
List<String> confirmAmountMap = list.stream().map(AllProjectStatistics::getConfirmAmount).collect(Collectors.toList());
|
||||
List<String> allMoneyMap = list.stream().map(AllProjectStatistics::getAllMoney).collect(Collectors.toList());
|
||||
List<String> date = list.stream().map(AllProjectStatistics::getPaymentDate).collect(Collectors.toList());
|
||||
List<String> 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<LineChartListVO> lineChartList() {
|
||||
String year = String.valueOf(DateUtil.year(new DateTime()));
|
||||
AllProjectStatisticsSearch allProjectStatisticsSearch = new AllProjectStatisticsSearch();
|
||||
allProjectStatisticsSearch.setPaymentYear(year);
|
||||
List<AllProjectStatistics> list = payWorkingGroupService.queryListAllProjectMoney(allProjectStatisticsSearch, null);
|
||||
List<LineChartListVO> lineChartListVOList = convertLineChartListVO(list);
|
||||
return lineChartListVOList;
|
||||
}
|
||||
|
||||
private List<LineChartListVO> convertLineChartListVO(List<AllProjectStatistics> list){
|
||||
List<LineChartListVO> 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<AllProjectStatistics> list = payWorkingGroupService.cumulativeListAllProjectMoney(allProjectStatisticsSearch);
|
||||
List<String> comeAllMoneyMap = cumulativeProcesZero(list.stream().map(AllProjectStatistics::getComeAllMoney).collect(Collectors.toList()));
|
||||
List<String> billMoneyMap = cumulativeProcesZero(list.stream().map(AllProjectStatistics::getBillMoney).collect(Collectors.toList()));
|
||||
List<String> confirmAmountMap = cumulativeProcesZero(list.stream().map(AllProjectStatistics::getConfirmAmount).collect(Collectors.toList()));
|
||||
List<String> allMoneyMap = cumulativeProcesZero(list.stream().map(AllProjectStatistics::getAllMoney).collect(Collectors.toList()));
|
||||
List<String> date = list.stream().map(AllProjectStatistics::getPaymentDate).collect(Collectors.toList());
|
||||
List<String> 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<LineChartListVO> cumulativeGraphList() {
|
||||
String year = String.valueOf(DateUtil.year(new DateTime()));
|
||||
AllProjectStatisticsSearch allProjectStatisticsSearch = new AllProjectStatisticsSearch();
|
||||
allProjectStatisticsSearch.setPaymentYear(year);
|
||||
List<AllProjectStatistics> list = payWorkingGroupService.cumulativeListAllProjectMoney(allProjectStatisticsSearch);
|
||||
List<LineChartListVO> lineChartListVOList = convertLineChartListVO(list);
|
||||
return lineChartListVOList;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理堆叠图中的0
|
||||
*/
|
||||
private List<String> cumulativeProcesZero (List<String> 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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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<String> allMoney;
|
||||
|
||||
@ApiModelProperty(value = "确认收入金额")
|
||||
private List<String> confirmAmount;
|
||||
|
||||
@ApiModelProperty(value = "开票金额")
|
||||
private List<String> billMoney;
|
||||
|
||||
@ApiModelProperty(value = "到账金额")
|
||||
private List<String> comeAllMoney;
|
||||
|
||||
@ApiModelProperty(value = "到账时间")
|
||||
private List<String> paymentDate;
|
||||
|
||||
}
|
||||
+4
@@ -223,4 +223,8 @@ public interface PayWorkingGroupMapper extends BaseMapper<PayWorkingGroup> {
|
||||
List<AllProjectStatistics> queryListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
|
||||
|
||||
AllMoney queryAllMoney33(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
|
||||
|
||||
List<AllProjectStatistics> cumulativeListAllProjectMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
|
||||
|
||||
List<AllProjectStatistics> cumulativeListAllMoney(@Param(value = "allProjectStatisticsSearch") AllProjectStatisticsSearch allProjectStatisticsSearch);
|
||||
}
|
||||
|
||||
+46
@@ -2264,4 +2264,50 @@
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<select id="cumulativeListAllProjectMoney" resultType="com.jero.statistics.entity.AllProjectStatistics">
|
||||
select TMP1.paymentDate,
|
||||
sum(TMP2.comeAllMoney) as comeAllMoney,
|
||||
sum(TMP2.billMoney) as billMoney,
|
||||
sum(TMP2.confirmAmount) as confirmAmount
|
||||
from (SELECT sum(paidNoTaxAmount) AS comeAllMoney,
|
||||
sum(invoiceNoTaxAmount) AS billMoney,
|
||||
sum(confirmNoTaxAmount) AS confirmAmount,
|
||||
DATE_FORMAT(pcpr.payment_date, '%Y-%m') AS paymentDate
|
||||
FROM v_statistical v
|
||||
LEFT JOIN pay_confirm_payment_record pcpr ON (v.projectId = pcpr.project_id)
|
||||
WHERE DATE_FORMAT(pcpr.payment_date, '%Y') like concat(#{allProjectStatisticsSearch.paymentYear}, '%')
|
||||
GROUP BY DATE_FORMAT(pcpr.payment_date, '%Y-%m')
|
||||
ORDER BY paymentDate) TMP1,
|
||||
(SELECT sum(paidNoTaxAmount) AS comeAllMoney,
|
||||
sum(invoiceNoTaxAmount) AS billMoney,
|
||||
sum(confirmNoTaxAmount) AS confirmAmount,
|
||||
DATE_FORMAT(pcpr.payment_date, '%Y-%m') AS paymentDate
|
||||
FROM v_statistical v
|
||||
LEFT JOIN pay_confirm_payment_record pcpr ON (v.projectId = pcpr.project_id)
|
||||
WHERE DATE_FORMAT(pcpr.payment_date, '%Y') like concat(#{allProjectStatisticsSearch.paymentYear}, '%')
|
||||
GROUP BY DATE_FORMAT(pcpr.payment_date, '%Y-%m')
|
||||
ORDER BY paymentDate) TMP2
|
||||
where TMP1.paymentDate >= TMP2.paymentDate
|
||||
group by TMP1.paymentDate
|
||||
ORDER BY TMP1.paymentDate
|
||||
</select>
|
||||
|
||||
<select id="cumulativeListAllMoney" resultType="com.jero.statistics.entity.AllProjectStatistics">
|
||||
SELECT TMP1.paymentDate,
|
||||
sum(TMP2.allMoney) as allMoney
|
||||
FROM (SELECT sum(contract_amount) AS allMoney,
|
||||
DATE_FORMAT(contract_date, '%Y-%m') AS paymentDate
|
||||
FROM pay_income_contract
|
||||
WHERE DATE_FORMAT(contract_date, '%Y') LIKE concat('2022', '%')
|
||||
GROUP BY DATE_FORMAT(contract_date, '%Y-%m')) TMP1,
|
||||
(SELECT sum(contract_amount) AS allMoney,
|
||||
DATE_FORMAT(contract_date, '%Y-%m') AS paymentDate
|
||||
FROM pay_income_contract
|
||||
WHERE DATE_FORMAT(contract_date, '%Y') LIKE concat('2022', '%')
|
||||
GROUP BY DATE_FORMAT(contract_date, '%Y-%m')) TMP2
|
||||
WHERE TMP1.paymentDate >= TMP2.paymentDate
|
||||
GROUP BY TMP1.paymentDate
|
||||
ORDER BY TMP1.paymentDate
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
+2
@@ -241,6 +241,8 @@ public interface IPayWorkingGroupService extends IService<PayWorkingGroup> {
|
||||
|
||||
List<AllProjectStatistics> queryListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch, List<String> idList);
|
||||
|
||||
List<AllProjectStatistics> cumulativeListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch);
|
||||
|
||||
List<AllProjectMoneyExcel> queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List<String> idList);
|
||||
|
||||
AllMoney queryAllMoney33(AllProjectStatisticsSearch allProjectStatisticsSearch);
|
||||
|
||||
+7
-2
@@ -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<PayWorkingGroupMappe
|
||||
return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list,allMoneyList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AllProjectStatistics> cumulativeListAllProjectMoney(AllProjectStatisticsSearch allProjectStatisticsSearch) {
|
||||
List<AllProjectStatistics> list = payWorkingGroupMapper.cumulativeListAllProjectMoney(allProjectStatisticsSearch);
|
||||
List<AllProjectStatistics> allMoneyList = payWorkingGroupMapper.cumulativeListAllMoney(allProjectStatisticsSearch);
|
||||
return getAllProjectMoneyStatistics(allProjectStatisticsSearch, list,allMoneyList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<AllProjectMoneyExcel> queryListAllProjectMoneyExcel(AllProjectStatisticsSearch allProjectStatisticsSearch, List<String> idList) {
|
||||
List<AllProjectStatistics> list = payWorkingGroupMapper.queryListAllProjectMoney(allProjectStatisticsSearch,idList);
|
||||
|
||||
Reference in New Issue
Block a user