HomeController.java
4.99 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
package com.huaheng.pc.system.user.controller;
import com.huaheng.framework.config.HuaHengConfig;
import com.huaheng.framework.web.controller.BaseController;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.report.excelReport.mapper.ExcelReportMapper;
import com.huaheng.pc.system.menu.domain.Menu;
import com.huaheng.pc.system.menu.service.IMenuService;
import com.huaheng.pc.system.user.domain.User;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.*;
/**
* @author
*/
@Controller
@RequestMapping("/admin")
public class HomeController extends BaseController {
@Autowired
private IMenuService menuService;
@Autowired
private HuaHengConfig huahengConfig;
@Resource
ExcelReportMapper mapper;
private String prefix = "admin";
//6个显示后台
@GetMapping("home/getCommonData")
@ResponseBody
public AjaxResult getCommonData(){
// String condition = " and warehouseId = " + ShiroUtils.getWarehouseId();
String bllCount = "SELECT ifnull(sum(t.a),0) 'total' from (\n" +
"SELECT COUNT(*) 'a' FROM receipt_header WHERE DATEDIFF(NOW(), created)=0 " +
" UNION \n" +
"SELECT COUNT(*) 'a' FROM shipment_header WHERE DATEDIFF(NOW(), created)=0 " +
") t";
String receiptTotal = "SELECT ifnull(sum(t.qty),0) 'total' from task_detail t\n" +
"inner join receipt_header r on t.billCode=r.code and\n" +
"t.status>100 and DATEDIFF(NOW(), t.lastUpdated)=0;";
String shipmentTotal = "SELECT ifnull(sum(t.qty),0) 'total' from task_detail t\n" +
"inner join shipment_header s on t.billCode=s.code and\n" +
"t.status>100 and DATEDIFF(NOW(), t.lastUpdated)=0;";
String inventoryTotal = "SELECT IFNULL(SUM(qty),0) 'total' from inventory_detail where 1=1 " ;
String materialCount = "SELECT count(DISTINCT materialCode) 'total' from inventory_detail WHERE 1=1";
String taskUncompletedTotal = "SELECT COUNT(*) 'total' from task_header WHERE status < 100 " ;
Map<String, Object> map = new HashMap<>();
/*List<LinkedHashMap<String, Object>> temp1 = mapper.selectCommon(bllCount);
map.put("bllCount",temp1.get(0).entrySet().iterator().next().getValue());
List<LinkedHashMap<String, Object>> temp2 = mapper.selectCommon(receiptTotal);
map.put("receiptTotal",temp2.get(0).entrySet().stream().findFirst().get().getValue());
List<LinkedHashMap<String, Object>> temp3 = mapper.selectCommon(shipmentTotal);
map.put("shipmentTotal",temp3.get(0).entrySet().stream().findFirst().get().getValue());
List<LinkedHashMap<String, Object>> temp4 = mapper.selectCommon(inventoryTotal);
map.put("inventoryTotal",temp4.get(0).entrySet().stream().findFirst().get().getValue());
List<LinkedHashMap<String, Object>> temp5 = mapper.selectCommon(materialCount);
map.put("materialCount",temp5.get(0).entrySet().stream().findFirst().get().getValue());
List<LinkedHashMap<String, Object>> temp6 = mapper.selectCommon(taskUncompletedTotal);
map.put("taskUncompletedTotal",temp6.get(0).entrySet().stream().findFirst().get().getValue());
*/
return AjaxResult.success(map);
}
//库龄展示
@GetMapping("home/getInventoryStatus")
@ResponseBody
public AjaxResult getInventoryStatus(String type){
List<Map<String, Object>> list=new ArrayList<>();
return AjaxResult.success(list);
}
//获得七天的出入库量
@GetMapping("home/getShipmentsLast7Days")
@ResponseBody
public AjaxResult getQtyLast7Days(String type){
Map map=new ModelMap();
return AjaxResult.success(map);
}
//库存分布
@GetMapping("home/getInventoryProp")
@ResponseBody
public AjaxResult getInventoryProp(String type){
List<Map<String, Object>> list=new ArrayList<>();
return AjaxResult.success(list);
}
//库位利用率
@GetMapping("home/getLocationProp")
@ResponseBody
public AjaxResult getLocationProp(){
return AjaxResult.success();
}
@GetMapping("/home")
public String home(ModelMap mmap)
{
// 取身份信息
User user = getUser();
// 根据用户id取出菜单
List<Menu> menus = menuService.selectMenusByUserId(user.getId());
mmap.put("menus", menus);
mmap.put("user", user);
mmap.put("copyrightYear", huahengConfig.getCopyrightYear());
return prefix + "/home";
}
// 系统介绍
@GetMapping("/main")
public String main(ModelMap mmap) {
mmap.put("version", huahengConfig.getVersion());
return prefix + "/main";
}
}