feat(sip): 新增首页数据统计功能
- 添加 HomepageController 控制器处理首页数据请求 - 新增 HomepageQueryDto 查询参数对象 - 在 IOrderInfoService、IProjectInfoService 和 IProjectOrderInfoService 接口中添加首页数据统计方法 - 实现 OrderInfoServiceImpl、ProjectInfoServiceImpl 和 ProjectOrderInfoServiceImpl 中的首页数据统计逻辑 - 在 OrderInfoMapper、ProjectInfoMapper 和 ProjectOrderInfoMapper接口中添加相应的 SQL 查询方法- 新增 StatisticsDetailDto 和 StatisticsDto 数据传输对象用于统计结果- 更新 main.html 页面,添加数据统计图表展示master
parent
3ccb79a31d
commit
2999b18085
|
@ -218,8 +218,8 @@
|
||||||
let tr = $(`
|
let tr = $(`
|
||||||
<tr>
|
<tr>
|
||||||
<td style="text-align: center;" class="indexBox">${length + 1}</td>
|
<td style="text-align: center;" class="indexBox">${length + 1}</td>
|
||||||
<td> <input type="hidden" name="maintenanceProjectProductInfoList[${length}].id" value="${data.id || ''}"><input class="form-control productBomCode" type="text" onclick="selectProduct('11,22','服务产品',this)" value="${data.productBomCode || ''}" name="maintenanceProjectProductInfoList[${length}].productBomCode"></td>
|
<td> <input type="hidden" name="maintenanceProjectProductInfoList[${length}].id" value="${data.id || ''}"><input class="form-control productBomCode" type="text" onclick="selectProduct('11,22,99','服务产品',this)" value="${data.productBomCode || ''}" name="maintenanceProjectProductInfoList[${length}].productBomCode"></td>
|
||||||
<td><input readonly class="form-control model" type="text" onclick="selectProduct('11,22','服务产品',this)" value="${data.model || ''}" name="maintenanceProjectProductInfoList[${length}].model"></td>
|
<td><input readonly class="form-control model" type="text" onclick="selectProduct('11,22,99','服务产品',this)" value="${data.model || ''}" name="maintenanceProjectProductInfoList[${length}].model"></td>
|
||||||
<td><textarea name="maintenanceProjectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly>${data.productDesc || ''}</textarea></td>
|
<td><textarea name="maintenanceProjectProductInfoList[${length}].productDesc" required class="form-control productDesc" placeholder="自动带入" readonly>${data.productDesc || ''}</textarea></td>
|
||||||
<td><input value="${data.quantity || ''}" name="maintenanceProjectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
|
<td><input value="${data.quantity || ''}" name="maintenanceProjectProductInfoList[${length}].quantity" type="number" class="form-control quantity" step="1" required></td>
|
||||||
<td><input value="${data.cataloguePrice || ''}" name="maintenanceProjectProductInfoList[${length}].cataloguePrice" readonly type="hidden" class="form-control cataloguePrice" required>
|
<td><input value="${data.cataloguePrice || ''}" name="maintenanceProjectProductInfoList[${length}].cataloguePrice" readonly type="hidden" class="form-control cataloguePrice" required>
|
||||||
|
@ -251,7 +251,7 @@
|
||||||
|
|
||||||
</tr>`)
|
</tr>`)
|
||||||
$('#productTable3 tbody').append(tr)
|
$('#productTable3 tbody').append(tr)
|
||||||
initSearchProduct('11,22')
|
initSearchProduct('11,22,99')
|
||||||
initPrice()
|
initPrice()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -10,13 +10,201 @@
|
||||||
<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
|
<link href="../static/css/font-awesome.min.css" th:href="@{/css/font-awesome.min.css}" rel="stylesheet"/>
|
||||||
<link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
|
<link href="../static/css/style.min.css" th:href="@{/css/style.min.css}" rel="stylesheet"/>
|
||||||
</head>
|
</head>
|
||||||
|
<style>
|
||||||
|
.echarts{
|
||||||
|
height: 70vh;
|
||||||
|
}
|
||||||
|
.row{
|
||||||
|
margin-top: 50px;
|
||||||
|
}
|
||||||
|
</style>
|
||||||
<body class="gray-bg">
|
<body class="gray-bg">
|
||||||
|
<div class="row">
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="ibox float-e-margins">
|
||||||
|
<div class="ibox-title">
|
||||||
|
<h5>商机管理</h5>
|
||||||
|
</div>
|
||||||
|
<div class="ibox-content">
|
||||||
|
<div class="echarts" id="echarts-line-chart"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<div class="col-sm-6">
|
||||||
|
<div class="ibox float-e-margins">
|
||||||
|
<div class="ibox-title">
|
||||||
|
<h5>合同信息</h5>
|
||||||
|
</div>
|
||||||
|
<div class="ibox-content">
|
||||||
|
<div class="echarts" id="echarts-bar-chart"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<script th:src="@{/js/jquery.min.js}"></script>
|
<script th:src="@{/js/jquery.min.js}"></script>
|
||||||
<script th:src="@{/js/bootstrap.min.js}"></script>
|
<script th:src="@{/js/bootstrap.min.js}"></script>
|
||||||
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
|
<script th:src="@{/ajax/libs/layer/layer.min.js}"></script>
|
||||||
<script type="text/javascript">
|
<th:block th:include="include :: echarts-js"/>
|
||||||
|
<th:block th:include="include :: footer"/>
|
||||||
|
<script type="text/javascript" th:inline="javascript">
|
||||||
|
const prefix = ctx + "homepage";
|
||||||
|
const lineChart = echarts.init(document.getElementById("echarts-line-chart"));
|
||||||
|
const barChart = echarts.init(document.getElementById("echarts-bar-chart"));
|
||||||
|
let lineoption = {
|
||||||
|
title: {
|
||||||
|
text: '入库量'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
|
show: true,
|
||||||
|
feature: {
|
||||||
|
magicType: {show: true, type: ['line', 'bar']},
|
||||||
|
restore: {show: true},
|
||||||
|
saveAsImage: {show: true}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: ['商机入库量', '订单入库量']
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
x: 40,
|
||||||
|
x2: 40,
|
||||||
|
y2: 24
|
||||||
|
},
|
||||||
|
calculable: true,
|
||||||
|
xAxis: [
|
||||||
|
{
|
||||||
|
type: 'category',
|
||||||
|
boundaryGap: false,
|
||||||
|
data: []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '商机入库量',
|
||||||
|
type: 'line',
|
||||||
|
data: [],
|
||||||
|
smooth: true,
|
||||||
|
markPoint: {
|
||||||
|
data: [
|
||||||
|
{type: 'max', name: '最大值'},
|
||||||
|
{type: 'min', name: '最小值'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
markLine: {
|
||||||
|
data: [
|
||||||
|
{type: 'average', name: '平均值'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: '订单入库量',
|
||||||
|
type: 'line',
|
||||||
|
data: [], smooth: true,
|
||||||
|
markPoint: {
|
||||||
|
data: [
|
||||||
|
{type: 'max', name: '最大值'},
|
||||||
|
{type: 'min', name: '最小值'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
markLine: {
|
||||||
|
data: [
|
||||||
|
{type: 'average', name: '平均值'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
var baroption = {
|
||||||
|
title: {
|
||||||
|
text: '合同签订数量'
|
||||||
|
},
|
||||||
|
tooltip: {
|
||||||
|
trigger: 'axis'
|
||||||
|
},
|
||||||
|
toolbox: {
|
||||||
|
show: true,
|
||||||
|
feature: {
|
||||||
|
magicType: {show: true, type: ['line', 'bar']},
|
||||||
|
restore: {show: true},
|
||||||
|
saveAsImage: {show: true}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
legend: {
|
||||||
|
data: ['签订数量']
|
||||||
|
},
|
||||||
|
grid: {
|
||||||
|
x: 30,
|
||||||
|
x2: 40,
|
||||||
|
y2: 24
|
||||||
|
},
|
||||||
|
calculable: true,
|
||||||
|
xAxis: [
|
||||||
|
{
|
||||||
|
type: 'category',
|
||||||
|
data: []
|
||||||
|
}
|
||||||
|
],
|
||||||
|
yAxis: [
|
||||||
|
{
|
||||||
|
type: 'value'
|
||||||
|
}
|
||||||
|
],
|
||||||
|
series: [
|
||||||
|
{
|
||||||
|
name: '签订数量',
|
||||||
|
type: 'bar',
|
||||||
|
data: [],
|
||||||
|
markPoint: {
|
||||||
|
data: [
|
||||||
|
{type: 'max', name: '最大值'},
|
||||||
|
{type: 'min', name: '最小值'}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
markLine: {
|
||||||
|
data: [
|
||||||
|
{type: 'average', name: '平均值'}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
]
|
||||||
|
};
|
||||||
|
$(function () {
|
||||||
|
|
||||||
|
|
||||||
|
lineChart.setOption(lineoption);
|
||||||
|
$(window).resize(lineChart.resize);
|
||||||
|
|
||||||
|
barChart.setOption(baroption);
|
||||||
|
window.onresize = barChart.resize;
|
||||||
|
|
||||||
|
$.get(prefix + "/project?day=7", function (res) {
|
||||||
|
console.log(lineoption.xAxis[0])
|
||||||
|
console.log(lineoption.xAxis[0].data)
|
||||||
|
lineoption.xAxis[0].data = res.data.lineData;
|
||||||
|
console.log(lineoption.xAxis[0].data)
|
||||||
|
lineoption.series[0].data = res.data.projectInfoList;
|
||||||
|
lineoption.series[1].data = res.data.projectOrderInfoList;
|
||||||
|
lineChart.setOption(lineoption,true);
|
||||||
|
}, 'json');
|
||||||
|
|
||||||
|
$.get(prefix + "/order?month=12", function (res) {
|
||||||
|
baroption.xAxis[0].data = res.data.lineData;
|
||||||
|
baroption.series[0].data = res.data.orderInfoList;
|
||||||
|
barChart.setOption(baroption,true);
|
||||||
|
}, 'json');
|
||||||
|
|
||||||
|
|
||||||
|
});
|
||||||
</script>
|
</script>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
||||||
|
|
|
@ -0,0 +1,56 @@
|
||||||
|
package com.ruoyi.sip.controller;
|
||||||
|
|
||||||
|
|
||||||
|
import com.ruoyi.common.annotation.Anonymous;
|
||||||
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.service.IOrderInfoService;
|
||||||
|
import com.ruoyi.sip.service.IProjectInfoService;
|
||||||
|
import com.ruoyi.sip.service.IProjectOrderInfoService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : ch
|
||||||
|
* @version : 1.0
|
||||||
|
* @ClassName : HomepageController
|
||||||
|
* @Description : 首页控制器
|
||||||
|
* @DATE : Created in 11:09 2025/6/17
|
||||||
|
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||||
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
* Modification History:
|
||||||
|
* Date Author Version Discription
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 2025/06/17 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/homepage")
|
||||||
|
public class HomepageController {
|
||||||
|
@Autowired
|
||||||
|
private IProjectInfoService projectInfoService;
|
||||||
|
@Autowired
|
||||||
|
private IOrderInfoService orderInfoService;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@GetMapping( "/project")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult projectInfo(HomepageQueryDto dto){
|
||||||
|
|
||||||
|
return AjaxResult.success( projectInfoService.homePageData(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
@GetMapping( "/order")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult orderInfo(HomepageQueryDto dto){
|
||||||
|
return AjaxResult.success(orderInfoService.homePageData(dto));
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.ruoyi.sip.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : ch
|
||||||
|
* @version : 1.0
|
||||||
|
* @ClassName : HomepageQueryDto
|
||||||
|
* @Description :
|
||||||
|
* @DATE : Created in 11:14 2025/6/17
|
||||||
|
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||||
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
* Modification History:
|
||||||
|
* Date Author Version Discription
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 2025/06/17 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class HomepageQueryDto {
|
||||||
|
private Integer day;
|
||||||
|
private Integer month;
|
||||||
|
}
|
|
@ -0,0 +1,23 @@
|
||||||
|
package com.ruoyi.sip.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : ch
|
||||||
|
* @version : 1.0
|
||||||
|
* @ClassName : StatisticsDetailDto
|
||||||
|
* @Description :
|
||||||
|
* @DATE : Created in 11:23 2025/6/17
|
||||||
|
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||||
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
* Modification History:
|
||||||
|
* Date Author Version Discription
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 2025/06/17 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticsDetailDto {
|
||||||
|
private String statisticsStr;
|
||||||
|
private Integer value;
|
||||||
|
}
|
|
@ -0,0 +1,29 @@
|
||||||
|
package com.ruoyi.sip.dto;
|
||||||
|
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author : ch
|
||||||
|
* @version : 1.0
|
||||||
|
* @ClassName : StatisticsDto
|
||||||
|
* @Description :
|
||||||
|
* @DATE : Created in 11:17 2025/6/17
|
||||||
|
* <pre> Copyright: Copyright(c) 2025 </pre>
|
||||||
|
* <pre> Company : 紫光汇智信息技术有限公司 </pre>
|
||||||
|
* Modification History:
|
||||||
|
* Date Author Version Discription
|
||||||
|
* --------------------------------------------------------------------------
|
||||||
|
* 2025/06/17 ch 1.0 Why & What is modified: <修改原因描述> *
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class StatisticsDto {
|
||||||
|
private List<String> lineData;
|
||||||
|
private List<Integer> projectInfoList;
|
||||||
|
private List<Integer> projectOrderInfoList;
|
||||||
|
private List<Integer> orderInfoList;
|
||||||
|
|
||||||
|
|
||||||
|
}
|
|
@ -6,6 +6,8 @@ import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.sip.domain.MaintenanceRecordsDto;
|
import com.ruoyi.sip.domain.MaintenanceRecordsDto;
|
||||||
import com.ruoyi.sip.domain.OrderInfo;
|
import com.ruoyi.sip.domain.OrderInfo;
|
||||||
import com.ruoyi.sip.domain.OrderList;
|
import com.ruoyi.sip.domain.OrderList;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 合同档案Mapper接口
|
* 合同档案Mapper接口
|
||||||
|
@ -112,4 +114,5 @@ public interface OrderInfoMapper
|
||||||
List<OrderList> listExport(OrderList orderList);
|
List<OrderList> listExport(OrderList orderList);
|
||||||
Integer selectUniqueCount(OrderInfo orderInfo);
|
Integer selectUniqueCount(OrderInfo orderInfo);
|
||||||
|
|
||||||
|
List<StatisticsDetailDto> homePageData(HomepageQueryDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -4,6 +4,8 @@ import java.util.List;
|
||||||
|
|
||||||
import com.ruoyi.common.core.domain.entity.SysUser;
|
import com.ruoyi.common.core.domain.entity.SysUser;
|
||||||
import com.ruoyi.sip.domain.ProjectInfo;
|
import com.ruoyi.sip.domain.ProjectInfo;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目管理Mapper接口
|
* 项目管理Mapper接口
|
||||||
|
@ -64,4 +66,6 @@ public interface ProjectInfoMapper
|
||||||
String selectMaxProjectCode(ProjectInfo projectInfo);
|
String selectMaxProjectCode(ProjectInfo projectInfo);
|
||||||
|
|
||||||
List<SysUser> selectUserById(List<String> list);
|
List<SysUser> selectUserById(List<String> list);
|
||||||
|
|
||||||
|
List<StatisticsDetailDto> listHomePageData(HomepageQueryDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.ruoyi.sip.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单管理Mapper接口
|
* 订单管理Mapper接口
|
||||||
|
@ -64,4 +66,6 @@ public interface ProjectOrderInfoMapper
|
||||||
int selectMaxOrderCode(String province);
|
int selectMaxOrderCode(String province);
|
||||||
|
|
||||||
String selectAgentProvinceByProjectId(Long projectId);
|
String selectAgentProvinceByProjectId(Long projectId);
|
||||||
|
|
||||||
|
List<StatisticsDetailDto> listHomePageData(HomepageQueryDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -7,6 +7,8 @@ import com.ruoyi.sip.domain.MaintenanceRecordsDto;
|
||||||
import com.ruoyi.sip.domain.OrderInfo;
|
import com.ruoyi.sip.domain.OrderInfo;
|
||||||
import com.ruoyi.sip.domain.OrderList;
|
import com.ruoyi.sip.domain.OrderList;
|
||||||
import com.ruoyi.sip.dto.ApiDataQueryDto;
|
import com.ruoyi.sip.dto.ApiDataQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDto;
|
||||||
import com.ruoyi.sip.vo.OrderInfoVo;
|
import com.ruoyi.sip.vo.OrderInfoVo;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
@ -81,4 +83,6 @@ public interface IOrderInfoService
|
||||||
AjaxResult listImportData(List<OrderList> orderListList, Long orderId);
|
AjaxResult listImportData(List<OrderList> orderListList, Long orderId);
|
||||||
|
|
||||||
List<OrderList> readData(MultipartFile file);
|
List<OrderList> readData(MultipartFile file);
|
||||||
|
|
||||||
|
StatisticsDto homePageData(HomepageQueryDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.ruoyi.sip.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.sip.domain.ProjectInfo;
|
import com.ruoyi.sip.domain.ProjectInfo;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 项目管理Service接口
|
* 项目管理Service接口
|
||||||
|
@ -60,4 +62,6 @@ public interface IProjectInfoService
|
||||||
public int deleteProjectInfoById(Long id);
|
public int deleteProjectInfoById(Long id);
|
||||||
|
|
||||||
String exportList(ProjectInfo projectInfo);
|
String exportList(ProjectInfo projectInfo);
|
||||||
|
|
||||||
|
StatisticsDto homePageData(HomepageQueryDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,6 +2,8 @@ package com.ruoyi.sip.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
import com.ruoyi.sip.domain.ProjectOrderInfo;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 订单管理Service接口
|
* 订单管理Service接口
|
||||||
|
@ -70,4 +72,6 @@ public interface IProjectOrderInfoService
|
||||||
List< ProjectOrderInfo> selectProjectOrderInfoByProjectId(List<Long> projectId);
|
List< ProjectOrderInfo> selectProjectOrderInfoByProjectId(List<Long> projectId);
|
||||||
|
|
||||||
String exportList(ProjectOrderInfo projectOrderInfo);
|
String exportList(ProjectOrderInfo projectOrderInfo);
|
||||||
|
|
||||||
|
List<StatisticsDetailDto> listHomePageData(HomepageQueryDto dto);
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,18 +2,25 @@ package com.ruoyi.sip.service.impl;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
import cn.hutool.core.date.DateUtil;
|
||||||
import cn.hutool.core.lang.Assert;
|
import cn.hutool.core.lang.Assert;
|
||||||
import cn.hutool.core.lang.Dict;
|
import cn.hutool.core.lang.Dict;
|
||||||
import com.ruoyi.common.core.domain.AjaxResult;
|
import com.ruoyi.common.core.domain.AjaxResult;
|
||||||
import com.ruoyi.common.exception.ServiceException;
|
import com.ruoyi.common.exception.ServiceException;
|
||||||
|
import com.ruoyi.common.utils.DateUtils;
|
||||||
import com.ruoyi.common.utils.DictUtils;
|
import com.ruoyi.common.utils.DictUtils;
|
||||||
import com.ruoyi.common.utils.ShiroUtils;
|
import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.sip.domain.*;
|
import com.ruoyi.sip.domain.*;
|
||||||
import com.ruoyi.sip.dto.ApiDataQueryDto;
|
import com.ruoyi.sip.dto.ApiDataQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDto;
|
||||||
import com.ruoyi.sip.service.IAgentInfoService;
|
import com.ruoyi.sip.service.IAgentInfoService;
|
||||||
import com.ruoyi.sip.service.ICustomerInfoService;
|
import com.ruoyi.sip.service.ICustomerInfoService;
|
||||||
import com.ruoyi.sip.service.IProductInfoService;
|
import com.ruoyi.sip.service.IProductInfoService;
|
||||||
|
@ -268,7 +275,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
if (orderList.getDiscount() == null) {
|
if (orderList.getDiscount() == null) {
|
||||||
return AjaxResult.error("折扣不能为空");
|
return AjaxResult.error("折扣不能为空");
|
||||||
}
|
}
|
||||||
if (orderList.getDiscount().compareTo(BigDecimal.ONE) > 0 || orderList.getDiscount().compareTo(BigDecimal.ZERO) <= 0) {
|
if (orderList.getDiscount().compareTo(BigDecimal.ONE) > 0 || orderList.getDiscount().compareTo(BigDecimal.ZERO) < 0) {
|
||||||
return AjaxResult.error("折扣区间需在0-1之间");
|
return AjaxResult.error("折扣区间需在0-1之间");
|
||||||
}
|
}
|
||||||
if (orderList.getPrice() == null) {
|
if (orderList.getPrice() == null) {
|
||||||
|
@ -369,6 +376,39 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
||||||
return orderListList;
|
return orderListList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatisticsDto homePageData(HomepageQueryDto dto) {
|
||||||
|
if (dto.getMonth() == null) {
|
||||||
|
throw new ServiceException("请选择月份");
|
||||||
|
}
|
||||||
|
List<StatisticsDetailDto> orderList = orderInfoMapper.homePageData(dto);
|
||||||
|
Map<String, StatisticsDetailDto> orderMap = orderList.stream().collect(Collectors.toMap(StatisticsDetailDto::getStatisticsStr, Function.identity(), (a, b) -> a));
|
||||||
|
LocalDate endDate = LocalDate.now();
|
||||||
|
LocalDate startDate = endDate.minusMonths(dto.getMonth());
|
||||||
|
for (LocalDate localDate = startDate; !localDate.isAfter(endDate);
|
||||||
|
localDate = localDate.plusMonths(1)) {
|
||||||
|
String key = localDate.format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM));
|
||||||
|
if (!orderMap.containsKey(key)) {
|
||||||
|
StatisticsDetailDto statisticsDetailDto = new StatisticsDetailDto();
|
||||||
|
statisticsDetailDto.setStatisticsStr(key);
|
||||||
|
statisticsDetailDto.setValue(0);
|
||||||
|
orderMap.put(key, statisticsDetailDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
List<String> xData = new ArrayList<>();
|
||||||
|
List<Integer> orderInfoList = new ArrayList<>();
|
||||||
|
orderMap.keySet().stream().sorted().forEach(item -> {
|
||||||
|
xData.add(item);
|
||||||
|
orderInfoList.add(orderMap.get(item) == null ? 0 : orderMap.get(item).getValue());
|
||||||
|
});
|
||||||
|
// 构建返回结果
|
||||||
|
StatisticsDto statisticsDto = new StatisticsDto();
|
||||||
|
statisticsDto.setLineData(xData);
|
||||||
|
statisticsDto.setOrderInfoList(orderInfoList);
|
||||||
|
return statisticsDto;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public Map<String, List<OrderList>> compareOrderLists(List<OrderList> orderInfoList, List<OrderList> orderListList) {
|
public Map<String, List<OrderList>> compareOrderLists(List<OrderList> orderInfoList, List<OrderList> orderListList) {
|
||||||
// 创建一个映射,用于快速查找订单
|
// 创建一个映射,用于快速查找订单
|
||||||
Map<String, OrderList> orderInfoMap = orderInfoList.stream()
|
Map<String, OrderList> orderInfoMap = orderInfoList.stream()
|
||||||
|
|
|
@ -19,6 +19,7 @@ import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.sip.domain.*;
|
import com.ruoyi.sip.domain.*;
|
||||||
import com.ruoyi.sip.dto.HomepageQueryDto;
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
import com.ruoyi.sip.dto.StatisticsDto;
|
import com.ruoyi.sip.dto.StatisticsDto;
|
||||||
import com.ruoyi.sip.mapper.ProjectInfoMapper;
|
import com.ruoyi.sip.mapper.ProjectInfoMapper;
|
||||||
import com.ruoyi.sip.service.*;
|
import com.ruoyi.sip.service.*;
|
||||||
|
@ -34,6 +35,7 @@ import java.math.BigDecimal;
|
||||||
import java.time.LocalDate;
|
import java.time.LocalDate;
|
||||||
import java.time.Period;
|
import java.time.Period;
|
||||||
import java.time.ZoneId;
|
import java.time.ZoneId;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.function.Function;
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
@ -505,6 +507,42 @@ public class ProjectInfoServiceImpl implements IProjectInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public StatisticsDto homePageData(HomepageQueryDto dto) {
|
||||||
|
List<StatisticsDetailDto> projectDetailList = projectInfoMapper.listHomePageData(dto);
|
||||||
|
Map<String, StatisticsDetailDto> staticsMap = projectDetailList.stream().collect(Collectors.toMap(StatisticsDetailDto::getStatisticsStr, Function.identity(), (a, b) -> a));
|
||||||
|
LocalDate endDate = LocalDate.now();
|
||||||
|
LocalDate startDate = endDate.minusDays(dto.getDay());
|
||||||
|
for (LocalDate localDate = startDate; !localDate.isAfter(endDate);
|
||||||
|
localDate = localDate.plusDays(1)) {
|
||||||
|
String key = localDate.format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD));
|
||||||
|
if (!staticsMap.containsKey(key)) {
|
||||||
|
StatisticsDetailDto statisticsDetailDto = new StatisticsDetailDto();
|
||||||
|
statisticsDetailDto.setStatisticsStr(key);
|
||||||
|
statisticsDetailDto.setValue(0);
|
||||||
|
staticsMap.put(key, statisticsDetailDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
List<StatisticsDetailDto> projectOrderDetailList = orderInfoService.listHomePageData(dto);
|
||||||
|
Map<String, StatisticsDetailDto> orderStaticsMap = projectOrderDetailList.stream().collect(Collectors.toMap(StatisticsDetailDto::getStatisticsStr, Function.identity(), (a, b) -> a));
|
||||||
|
List<String> xData = new ArrayList<>();
|
||||||
|
List<Integer> projectInfoList = new ArrayList<>();
|
||||||
|
List<Integer> projectOrderInfoList = new ArrayList<>();
|
||||||
|
staticsMap.keySet().stream().sorted().forEach(item -> {
|
||||||
|
xData.add(item);
|
||||||
|
projectInfoList.add(staticsMap.get(item) == null ? 0 : staticsMap.get(item).getValue());
|
||||||
|
projectOrderInfoList.add(orderStaticsMap.get(item) == null ? 0 : orderStaticsMap.get(item).getValue());
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
StatisticsDto result = new StatisticsDto();
|
||||||
|
result.setLineData(xData);
|
||||||
|
result.setProjectInfoList(projectInfoList);
|
||||||
|
result.setProjectOrderInfoList(projectOrderInfoList);
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
private List<ProjectInfo> fetchProjectInfos(ProjectInfo projectInfo) {
|
private List<ProjectInfo> fetchProjectInfos(ProjectInfo projectInfo) {
|
||||||
List<ProjectInfo> projectInfos = projectInfoMapper.selectProjectInfoList(projectInfo);
|
List<ProjectInfo> projectInfos = projectInfoMapper.selectProjectInfoList(projectInfo);
|
||||||
if (CollUtil.isEmpty(projectInfos)) {
|
if (CollUtil.isEmpty(projectInfos)) {
|
||||||
|
|
|
@ -1,7 +1,11 @@
|
||||||
package com.ruoyi.sip.service.impl;
|
package com.ruoyi.sip.service.impl;
|
||||||
|
|
||||||
|
import java.io.File;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
|
import java.time.LocalDate;
|
||||||
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
|
@ -20,6 +24,8 @@ import com.ruoyi.common.utils.ShiroUtils;
|
||||||
import com.ruoyi.common.utils.StringUtils;
|
import com.ruoyi.common.utils.StringUtils;
|
||||||
import com.ruoyi.common.utils.poi.ExcelUtil;
|
import com.ruoyi.common.utils.poi.ExcelUtil;
|
||||||
import com.ruoyi.sip.domain.*;
|
import com.ruoyi.sip.domain.*;
|
||||||
|
import com.ruoyi.sip.dto.HomepageQueryDto;
|
||||||
|
import com.ruoyi.sip.dto.StatisticsDetailDto;
|
||||||
import com.ruoyi.sip.service.*;
|
import com.ruoyi.sip.service.*;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.poi.ss.usermodel.Cell;
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
|
@ -247,6 +253,25 @@ public class ProjectOrderInfoServiceImpl implements IProjectOrderInfoService {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<StatisticsDetailDto> listHomePageData(HomepageQueryDto dto) {
|
||||||
|
List<StatisticsDetailDto> statisticsDetailDtos = projectOrderInfoMapper.listHomePageData(dto);
|
||||||
|
Map<String, StatisticsDetailDto> staticsMap = statisticsDetailDtos.stream().collect(Collectors.toMap(StatisticsDetailDto::getStatisticsStr, Function.identity(), (a, b) -> a));
|
||||||
|
LocalDate endDate = LocalDate.now();
|
||||||
|
LocalDate startDate = endDate.minusDays(dto.getDay());
|
||||||
|
for (LocalDate localDate = startDate; !localDate.isAfter(endDate);
|
||||||
|
localDate = localDate.plusDays(1)) {
|
||||||
|
String key = localDate.format(DateTimeFormatter.ofPattern(DateUtils.YYYY_MM_DD));
|
||||||
|
if (!staticsMap.containsKey(key)) {
|
||||||
|
StatisticsDetailDto statisticsDetailDto = new StatisticsDetailDto();
|
||||||
|
statisticsDetailDto.setStatisticsStr(key);
|
||||||
|
statisticsDetailDto.setValue(0);
|
||||||
|
staticsMap.put(key, statisticsDetailDto);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return staticsMap.values().stream().sorted(Comparator.comparing(StatisticsDetailDto::getStatisticsStr)).collect(Collectors.toList());
|
||||||
|
}
|
||||||
|
|
||||||
private List<ProjectOrderInfo> fetchProjectInfos(ProjectOrderInfo projectOrderInfo) {
|
private List<ProjectOrderInfo> fetchProjectInfos(ProjectOrderInfo projectOrderInfo) {
|
||||||
List<ProjectOrderInfo> projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo);
|
List<ProjectOrderInfo> projectOrderInfos = projectOrderInfoMapper.selectProjectOrderInfoList(projectOrderInfo);
|
||||||
if (CollUtil.isEmpty(projectOrderInfos)) {
|
if (CollUtil.isEmpty(projectOrderInfos)) {
|
||||||
|
|
|
@ -262,6 +262,12 @@
|
||||||
select count(1) from order_info where order_code = #{orderCode} and version_code=#{versionCode} and status=0
|
select count(1) from order_info where order_code = #{orderCode} and version_code=#{versionCode} and status=0
|
||||||
<if test="id != null">and id != #{id}</if>
|
<if test="id != null">and id != #{id}</if>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="homePageData" resultType="com.ruoyi.sip.dto.StatisticsDetailDto">
|
||||||
|
select count(1) value, date_format(order_date, '%Y-%m') statistics_str
|
||||||
|
from order_info
|
||||||
|
where order_date >=DATE_SUB(CURDATE(), INTERVAL ${month} MONTH)
|
||||||
|
group by date_format(order_date, '%Y-%m')
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertOrderInfo" parameterType="OrderInfo" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertOrderInfo" parameterType="OrderInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into order_info
|
insert into order_info
|
||||||
|
|
|
@ -184,6 +184,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</select>
|
</select>
|
||||||
|
<select id="listHomePageData" resultType="com.ruoyi.sip.dto.StatisticsDetailDto">
|
||||||
|
select count(1) value,date_format(create_time,'%Y-%m-%d') statistics_str
|
||||||
|
from project_info where create_time <![CDATA[ >= ]]> DATE_SUB(CURDATE(), INTERVAL ${day} DAY)
|
||||||
|
group by date_format(create_time,'%Y-%m-%d')
|
||||||
|
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertProjectInfo" parameterType="ProjectInfo" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertProjectInfo" parameterType="ProjectInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into project_info
|
insert into project_info
|
||||||
|
|
|
@ -160,6 +160,11 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where t1.id = #{projectId}
|
where t1.id = #{projectId}
|
||||||
limit 1
|
limit 1
|
||||||
</select>
|
</select>
|
||||||
|
<select id="listHomePageData" resultType="com.ruoyi.sip.dto.StatisticsDetailDto">
|
||||||
|
select count(1) value,date_format(create_time,'%Y-%m-%d') statistics_str from project_order_info
|
||||||
|
where create_time >=DATE_SUB(CURDATE(), INTERVAL ${day} DAY)
|
||||||
|
group by date_format(create_time,'%Y-%m-%d')
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertProjectOrderInfo" parameterType="ProjectOrderInfo" useGeneratedKeys="true" keyProperty="id">
|
<insert id="insertProjectOrderInfo" parameterType="ProjectOrderInfo" useGeneratedKeys="true" keyProperty="id">
|
||||||
insert into project_order_info
|
insert into project_order_info
|
||||||
|
|
Loading…
Reference in New Issue