首页页面及后台
This commit is contained in:
parent
f4f5d393bb
commit
1785db0a5f
|
|
@ -41,7 +41,6 @@ public class HomeController {
|
|||
return map;
|
||||
}
|
||||
@PostMapping(value = "getATeamNumForEcharts")
|
||||
@DecryptAndVerify(decryptedClass = ToolsManageDto.class)
|
||||
public Map<String,Object> getATeamNumForEcharts(HomeVo vo) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
try{
|
||||
|
|
@ -52,7 +51,6 @@ public class HomeController {
|
|||
return map;
|
||||
}
|
||||
@PostMapping(value = "getATeamCostForEcharts")
|
||||
@DecryptAndVerify(decryptedClass = ToolsManageDto.class)
|
||||
public Map<String,Object> getATeamCostForEcharts(HomeVo vo) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
try{
|
||||
|
|
@ -63,7 +61,6 @@ public class HomeController {
|
|||
return map;
|
||||
}
|
||||
@PostMapping(value = "getCostRank")
|
||||
@DecryptAndVerify(decryptedClass = ToolsManageDto.class)
|
||||
public Map<String,Object> getCostRank(HomeVo vo) {
|
||||
Map<String,Object> map=new HashMap<>();
|
||||
try{
|
||||
|
|
|
|||
|
|
@ -33,4 +33,6 @@ public interface HomeDao {
|
|||
* @return
|
||||
*/
|
||||
List<HomeVo> getCostRank(HomeVo vo);
|
||||
|
||||
List<HomeVo> getTeams(HomeVo vo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
|||
import lombok.Data;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @className:ExperDeviceVo
|
||||
|
|
@ -16,6 +17,7 @@ import java.util.Date;
|
|||
*/
|
||||
@Data
|
||||
public class HomeVo {
|
||||
private String id;
|
||||
/**
|
||||
* 待派工
|
||||
*/
|
||||
|
|
@ -82,4 +84,6 @@ public class HomeVo {
|
|||
private String cooperateDate;
|
||||
|
||||
private String updateDate;
|
||||
private String type;
|
||||
private List<HomeVo> listData;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ import com.bonus.aqgqj.basis.dao.ToolsManageDao;
|
|||
import com.bonus.aqgqj.basis.entity.dto.ToolsManageDto;
|
||||
import com.bonus.aqgqj.basis.entity.vo.HomeVo;
|
||||
import com.bonus.aqgqj.basis.service.HomeService;
|
||||
import com.bonus.aqgqj.utils.DateTimeHelper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* @description 工器具个体管理
|
||||
|
|
@ -28,7 +28,7 @@ public class HomeServiceImpl implements HomeService {
|
|||
Map<String, Object> map=new HashMap<>();
|
||||
try{
|
||||
List<HomeVo> list=dao.getApprovalNum(vo);
|
||||
HomeVo hvo=new HomeVo();
|
||||
HomeVo hvo=list.get(0);
|
||||
map.put("data",hvo);
|
||||
map.put("code","200");
|
||||
}catch (Exception e){
|
||||
|
|
@ -41,9 +41,48 @@ public class HomeServiceImpl implements HomeService {
|
|||
public Map<String, Object> getATeamNumForEcharts(HomeVo vo) {
|
||||
Map<String, Object> map=new HashMap<>();
|
||||
try{
|
||||
List<HomeVo> list=dao.getATeamNumForEcharts(vo);
|
||||
HomeVo hvo=new HomeVo();
|
||||
map.put("data",hvo);
|
||||
List<String> dates=new ArrayList<>();
|
||||
List<HomeVo> teamlist=dao.getTeams(vo);
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
||||
Date date=new Date();
|
||||
if("1".equals(vo.getType())){
|
||||
Calendar calendar = Calendar.getInstance(); // 获取当前日期和时间
|
||||
for (int i = 1; i <= 14; i++) {
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1); // 使用add方法减去指定的天数
|
||||
date = calendar.getTime();
|
||||
}
|
||||
}else{
|
||||
Calendar calendar = Calendar.getInstance(); // 获取当前日期和时间
|
||||
for (int i = 1; i <= 6; i++) {
|
||||
calendar.add(Calendar.DAY_OF_MONTH, -1); // 使用add方法减去指定的天数
|
||||
date = calendar.getTime();
|
||||
}
|
||||
}
|
||||
dates=DateTimeHelper.getDatesBetween(sdf.format(date), sdf.format(new Date()));
|
||||
List<HomeVo> lists=new ArrayList<>();
|
||||
List<HomeVo> listsalls=new ArrayList<>();
|
||||
for(HomeVo teamvo:teamlist){
|
||||
List<HomeVo> list=dao.getATeamNumForEcharts(teamvo);
|
||||
if(list==null||list.size()==0){
|
||||
continue;
|
||||
}
|
||||
lists=new ArrayList<>();
|
||||
for(String daetr:dates){
|
||||
HomeVo hvod=new HomeVo();
|
||||
hvod.setTeamName(teamvo.getTeamName());
|
||||
hvod.setTestData(daetr);
|
||||
hvod.setTestNum("0");
|
||||
for(HomeVo hvo:list){
|
||||
if(daetr.equals(hvo.getTestData())){
|
||||
hvod.setTestNum(hvo.getTestNum());
|
||||
}
|
||||
}
|
||||
lists.add(hvod);
|
||||
}
|
||||
teamvo.setListData(lists);
|
||||
listsalls.add(teamvo);
|
||||
}
|
||||
map.put("data",listsalls);
|
||||
map.put("code","200");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
|
@ -56,8 +95,7 @@ public class HomeServiceImpl implements HomeService {
|
|||
Map<String, Object> map=new HashMap<>();
|
||||
try{
|
||||
List<HomeVo> list=dao.getATeamCostForEcharts(vo);
|
||||
HomeVo hvo=new HomeVo();
|
||||
map.put("data",hvo);
|
||||
map.put("data",list);
|
||||
map.put("code","200");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
|
@ -70,8 +108,7 @@ public class HomeServiceImpl implements HomeService {
|
|||
Map<String, Object> map=new HashMap<>();
|
||||
try{
|
||||
List<HomeVo> list=dao.getCostRank(vo);
|
||||
HomeVo hvo=new HomeVo();
|
||||
map.put("data",hvo);
|
||||
map.put("data",list);
|
||||
map.put("code","200");
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
|
|
|||
|
|
@ -780,4 +780,57 @@ public class DateTimeHelper {
|
|||
}
|
||||
return false;
|
||||
}
|
||||
/**
|
||||
* 获取本周周日日期
|
||||
* @return
|
||||
*/
|
||||
public static String getWeekSun(Date date){
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(date);
|
||||
// 如果是周日直接返回
|
||||
if (c.get(Calendar.DAY_OF_WEEK) == 1) {
|
||||
return sdf.format(date);
|
||||
}
|
||||
//System.out.println(c.get(Calendar.DAY_OF_WEEK));
|
||||
c.add(Calendar.DATE, 7 - c.get(Calendar.DAY_OF_WEEK) + 1);
|
||||
return sdf.format(c.getTime());
|
||||
}
|
||||
/**
|
||||
* 获取本周周一日期
|
||||
* @return
|
||||
*/
|
||||
public static String getWeekMon(Date date) {
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
||||
Calendar c = Calendar.getInstance();
|
||||
c.setTime(date);
|
||||
if (c.get(Calendar.DAY_OF_WEEK) == 1) {
|
||||
c.add(Calendar.DAY_OF_MONTH, -1);
|
||||
}
|
||||
c.add(Calendar.DATE, c.getFirstDayOfWeek() - c.get(Calendar.DAY_OF_WEEK) + 1);
|
||||
return sdf.format(c.getTime());
|
||||
}
|
||||
/**
|
||||
*获取两日期间的日期
|
||||
* @param startStr
|
||||
* @param endStr
|
||||
* @return
|
||||
*/
|
||||
public static List<String> getDatesBetween(String startStr, String endStr) {
|
||||
SimpleDateFormat sdf=new SimpleDateFormat("yyyy-MM-dd");
|
||||
List<String> strs=new ArrayList<>();
|
||||
try{
|
||||
Date startDate=sdf.parse(startStr);
|
||||
Date endDate=sdf.parse(endStr);
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(startDate);
|
||||
while (calendar.getTime().before(endDate) || calendar.getTime().equals(endDate)) {
|
||||
strs.add(sdf.format(calendar.getTime()));
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
return strs;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -15,8 +15,14 @@
|
|||
) ts
|
||||
</select>
|
||||
<select id="getATeamNumForEcharts" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
||||
select tt.team_name as teamName,ts.id,DATE_FORMAT(ts.dispatch_time, '%Y-%m-%d') as testData from tb_sample ts
|
||||
where ts.del_flag='0'
|
||||
SELECT testData,COUNT(1) AS testNum from (
|
||||
select tt.team_name as teamName,ts.id,DATE_FORMAT(ts.dispatch_time, '%Y-%m-%d') as testData from tb_sample ts
|
||||
LEFT JOIN tb_team tt on ts.team_id=tt.id
|
||||
where ts.del_flag='0' and tt.id=#{id}
|
||||
) aa group by testData
|
||||
</select>
|
||||
<select id="getTeams" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
||||
select id,team_name as teamname from tb_team where del_flag='0'
|
||||
</select>
|
||||
<select id="getATeamCostForEcharts" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
||||
select
|
||||
|
|
@ -30,6 +36,30 @@
|
|||
) aa group by teamName
|
||||
</select>
|
||||
<select id="getCostRank" parameterType="com.bonus.aqgqj.basis.entity.vo.HomeVo" resultType="com.bonus.aqgqj.basis.entity.vo.HomeVo">
|
||||
|
||||
select aa.custom_name userName,aa.custom_user as contacts,aa.custom_phone as contactPhone,aa.orderNum,bb.totalCost,cc.cooperateDate from (
|
||||
select ec.id,ec.custom_name,ec.custom_user,ec.custom_phone,sum(te.dev_num) as orderNum from
|
||||
tb_custom ec
|
||||
left join tb_sample ts on ec.id=ts.custom_id
|
||||
left join tb_exper te on ts.id=te.sample_id
|
||||
left join tb_exper_items teis on te.id=teis.exper_id
|
||||
group by ec.custom_name,ec.custom_user,ec.custom_phone
|
||||
) aa
|
||||
left join (
|
||||
select ec.id,ec.custom_name,ec.custom_user,ec.custom_phone,sum(teis.amount) as totalCost from
|
||||
tb_custom ec
|
||||
left join tb_sample ts on ec.id=ts.custom_id
|
||||
left join tb_exper te on ts.id=te.sample_id
|
||||
left join tb_exper_items teis on te.id=teis.exper_id
|
||||
group by ec.custom_name,ec.custom_user,ec.custom_phone
|
||||
) bb on aa.id=bb.id
|
||||
left join (
|
||||
select ec.id,ec.custom_name,ec.custom_user,ec.custom_phone,max(ts.create_time) as cooperateDate from
|
||||
tb_custom ec
|
||||
left join tb_sample ts on ec.id=ts.custom_id
|
||||
left join tb_exper te on ts.id=te.sample_id
|
||||
left join tb_exper_items teis on te.id=teis.exper_id
|
||||
group by ec.custom_name,ec.custom_user,ec.custom_phone
|
||||
) cc on aa.id=cc.id
|
||||
where cooperateDate is not null order by totalCost desc
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
@ -7,7 +7,7 @@ layui.use(['form', 'layer', 'table', 'laydate','carousel','util'], function () {
|
|||
util=layui.util;
|
||||
console.log("测试")
|
||||
initApproe();
|
||||
echartsone();
|
||||
echartsone(0);
|
||||
echartstwo();
|
||||
iniTable();
|
||||
// layui-table-body
|
||||
|
|
@ -19,10 +19,6 @@ function initApproe(){
|
|||
var reviewNUm =0;
|
||||
var examineNum =0;
|
||||
var approvalNum =0;
|
||||
var objs=$(".updateDate");
|
||||
$.each(objs, function (index, item) {
|
||||
$(item).html("2024-07-26")
|
||||
})
|
||||
$.ajax({
|
||||
url: dataUrl + "/home/getApprovalNum",
|
||||
headers: {
|
||||
|
|
@ -31,13 +27,21 @@ function initApproe(){
|
|||
type: 'POST',
|
||||
async: true,
|
||||
success: function (result) {
|
||||
if (result.code === 200) {
|
||||
if (result.code == 200) {
|
||||
if (result.data) {
|
||||
$("#dispatchWorkNum").html(result.data.dispatchWorkNum);
|
||||
$("#testNum").html(result.data.testNum);
|
||||
$("#reloadReviewNUm").html(result.data.reloadReviewNUm);
|
||||
$("#reviewNUm").html(result.data.reviewNUm);
|
||||
$("#examineNum").html(result.data.examineNum);
|
||||
$("#approvalNum").html(result.data.approvalNum);
|
||||
|
||||
var objs=$(".updateDate");
|
||||
$.each(objs, function (index, item) {
|
||||
$(item).html(result.data.updateDate)
|
||||
})
|
||||
}
|
||||
}
|
||||
}, error: function (xhr) {
|
||||
// error(xhr);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
@ -61,19 +65,34 @@ var totalHeight ;
|
|||
var visibleHeight ;
|
||||
var currentScrollTop = 0;
|
||||
function iniTable(){
|
||||
$.ajax({
|
||||
url: dataUrl + "/home/getCostRank",
|
||||
headers: {
|
||||
"token": tokens
|
||||
},
|
||||
type: 'POST',
|
||||
async: false,
|
||||
success: function (result) {
|
||||
if (result.code == 200) {
|
||||
if (result.data) {
|
||||
data=result.data;
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
table.render({
|
||||
elem: '#table-box',
|
||||
data:data,
|
||||
limit: 10000,
|
||||
page:false,
|
||||
cols: [[
|
||||
{type: 'numbers', title: '排名', width: '10%',align:"center"}//序号列
|
||||
,{field: 'username', title: '用户名称', width: '20%',align:"center"}
|
||||
,{field: 'fee', title: '总金额(元)', width: '15%',align:"center"}
|
||||
,{field: 'dingdan', title: '订单量', width: '12%',align:"center"}
|
||||
,{field: 'name', title: '联系人', width: '12%',align:"center"}
|
||||
,{field: 'phone', title: '联系电话', width: '15%',align:"center"}
|
||||
,{field: 'gettime', title: '最近合作时间', width: '15%',align:"center"}
|
||||
{field: 'num',type:'numbers',align:'center',title: '排名', width:'10%'}
|
||||
,{field: 'userName', title: '用户名称', width: '20%',align:"center"}
|
||||
,{field: 'totalCost', title: '总金额(元)', width: '15%',align:"center"}
|
||||
,{field: 'orderNum', title: '订单量', width: '12%',align:"center"}
|
||||
,{field: 'contacts', title: '联系人', width: '12%',align:"center"}
|
||||
,{field: 'contactPhone', title: '联系电话', width: '15%',align:"center"}
|
||||
,{field: 'cooperateDate', title: '最近合作时间', width: '15%',align:"center"}
|
||||
]]
|
||||
});
|
||||
scrollableDiv = $('#table-box + div .layui-table-body'); // 假设你的滚动容器类名为.scrollable
|
||||
|
|
@ -103,8 +122,59 @@ function scrolldiv() {
|
|||
scrollableDiv.scrollTop(currentScrollTop);
|
||||
}
|
||||
}
|
||||
function echartsone(){
|
||||
function getchick(type){
|
||||
echartsone(type)
|
||||
}
|
||||
var colors=['#0052D9','#B5C7FF','#21C7FF','#21d7dd','#11C7FF']
|
||||
function echartsone(type){
|
||||
var myChart = echarts.init(document.getElementById('echartsone'));
|
||||
var datearr=[];
|
||||
var seriesdata=[];
|
||||
var daydata=[];
|
||||
$.ajax({
|
||||
url: dataUrl + "/home/getATeamNumForEcharts",
|
||||
headers: {
|
||||
"token": tokens
|
||||
},
|
||||
data:{type:type},
|
||||
type: 'POST',
|
||||
async: false,
|
||||
success: function (result) {
|
||||
if (result.code == 200) {
|
||||
if (result.data) {
|
||||
var listData=result.data[0].listData;
|
||||
$.each(listData, function (index, item) {
|
||||
daydata.push(item.testData)
|
||||
})
|
||||
$.each(result.data, function (index, itemd) {
|
||||
var dot={
|
||||
name: '实验一班',
|
||||
type: 'line',
|
||||
data: [10, 11, 13, 11, 12, 12, 9],
|
||||
lineStyle: {
|
||||
color: '#0052D9',
|
||||
width: 2,
|
||||
type: 'solid'
|
||||
},
|
||||
// 设置散点(线中的点)颜色
|
||||
itemStyle: {
|
||||
color: '#0052D9'
|
||||
}
|
||||
};
|
||||
dot.name=itemd.listData[0].teamName;
|
||||
var testnum=[];
|
||||
$.each(itemd.listData, function (index, item) {
|
||||
testnum.push(item.testNum)
|
||||
})
|
||||
dot.data=testnum;
|
||||
dot.lineStyle.color=colors[index];
|
||||
dot.itemStyle.color=colors[index];
|
||||
seriesdata.push(dot);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
option = {
|
||||
title: {
|
||||
text: ''
|
||||
|
|
@ -127,7 +197,7 @@ function echartsone(){
|
|||
xAxis: {
|
||||
type: 'category',
|
||||
boundaryGap: false,
|
||||
data: ['2024-07-01', '2024-07-02', '2024-07-03', '2024-07-04', '2024-07-05', '2024-07-06', '2024-07-07']
|
||||
data: daydata
|
||||
},
|
||||
yAxis: {
|
||||
type: 'value',
|
||||
|
|
@ -135,40 +205,33 @@ function echartsone(){
|
|||
formatter: '{value}'
|
||||
}
|
||||
},
|
||||
series: [
|
||||
{
|
||||
name: '实验一班',
|
||||
type: 'line',
|
||||
data: [10, 11, 13, 11, 12, 12, 9],
|
||||
lineStyle: {
|
||||
color: '#0052D9',
|
||||
width: 2,
|
||||
type: 'solid'
|
||||
},
|
||||
// 设置散点(线中的点)颜色
|
||||
itemStyle: {
|
||||
color: '#0052D9'
|
||||
}
|
||||
},
|
||||
{
|
||||
name: '实验二班',
|
||||
type: 'line',
|
||||
data: [1, 2, 2, 5, 3, 2, 4],
|
||||
lineStyle: {
|
||||
color: '#B5C7FF',
|
||||
width: 2,
|
||||
type: 'solid'
|
||||
},
|
||||
// 设置散点(线中的点)颜色
|
||||
itemStyle: {
|
||||
color: '#B5C7FF'
|
||||
}
|
||||
}
|
||||
]
|
||||
series: seriesdata
|
||||
};
|
||||
myChart.setOption(option);
|
||||
}
|
||||
function echartstwo(){
|
||||
var datearr=[];
|
||||
$.ajax({
|
||||
url: dataUrl + "/home/getATeamCostForEcharts",
|
||||
headers: {
|
||||
"token": tokens
|
||||
},
|
||||
type: 'POST',
|
||||
async: false,
|
||||
success: function (result) {
|
||||
if (result.code == 200) {
|
||||
if (result.data) {
|
||||
$.each(result.data, function (index, item) {
|
||||
var dat={};
|
||||
dat.value= item.testCost;
|
||||
dat.name=item.teamName;
|
||||
datearr.push(dat);
|
||||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
console.log(datearr,"datearr")
|
||||
var myChart = echarts.init(document.getElementById('echartstwo'));
|
||||
option = {
|
||||
tooltip: {
|
||||
|
|
@ -186,10 +249,7 @@ function echartstwo(){
|
|||
type: 'pie',
|
||||
radius: '50%',
|
||||
color: ['#0052D9', '#B5C7FF'],
|
||||
data: [
|
||||
{ value: 1048, name: '试验一班' },
|
||||
{ value: 735, name: '试验二班' }
|
||||
]
|
||||
data: datearr
|
||||
}
|
||||
]
|
||||
};
|
||||
|
|
|
|||
|
|
@ -84,7 +84,7 @@
|
|||
</div>
|
||||
<div class="three">
|
||||
<div class="three-one">
|
||||
<div><span>班组工作情况统计(试验数)</span><button>近15天</button><button>本周</button></div>
|
||||
<div><span>班组工作情况统计(试验数)</span><button onclick="getchick(1)">近15天</button><button onclick="getchick(0)">本周</button></div>
|
||||
<div id="echartsone"></div>
|
||||
</div>
|
||||
<div class="three-two">
|
||||
|
|
|
|||
Loading…
Reference in New Issue