当前位置:   article > 正文

基于springboot仓库管理系统源码和论文_基于springboot的仓库管理系统的论文

基于springboot的仓库管理系统的论文

信息内容数据从传统到当今,一直在改变,忽然互联网技术让传统信息内容管理见到划时代的黎明,由于传统信息内容管理从时效性、安全系数、可执行性等多个方面,碰到互联网时代发觉弥补了从古至今的缺陷,有效提升管理效率工作能力。在传统的管理模式中,时间越长,管理具体内容越大,需要更多人梳理数据,数据归纳查看高效率非常低,数据安全性从来不会确保安全系数。融合数据具体内容管理的缺陷,在互联网时代能够得到很好的填补。融合前沿的大数据技术,开发设计满足要求的app,使数据具体内容管理可以最大程度地提升准确率,管理更科学便捷,不论是输入时效性、查询的时效性或是梳理总结的时效性。库房管理系统进行了字典管理、公告管理、老师管理、物资供应管理、物资申请管理、用户管理、等服务。设备采用关联数据库里的MySQL做为全面的数据库,合理存放数据,合理备份数据,确保数据稳定性。除此之外,程序流程还具备程序流程所需要的所有功能,大大提升了实际操作安全度,使库房管理系统软件从概念迈向实际,真真正正提升了信息资源管理效率。

关键信息管理,时效性,安全性,MySQL

基于springboot仓库管理系统源码和论文442


Abstract

Information data has been changing from traditional to contemporary, and the sudden Internet has allowed traditional information management to see a revolutionary dawn, because traditional information management is in terms of timeliness, security, or operability. It was only after encountering the Internet era that it was able to make up for the shortcomings since ancient times, and effectively improve the management efficiency and business level. The traditional management model, the longer the time, the more content is managed, and more people are needed to organize the data, and the efficiency of data aggregation and query is extremely low, and data security will never guarantee security performance. Combined with various shortcomings of data content management, they can be effectively supplemented in the Internet era. Combined with advanced Internet technology, develop software that meets the needs, so that the data content management can maximize the accuracy rate from the timeliness of entry, the timeliness of viewing, and the timeliness of summary analysis. The train ticket selling system developed this time has realized the functions of online booking, online payment, online change of ticket, and online refund of train tickets. The system uses MySQL, the king of the relational database, as the system database, which effectively stores the data safely and effectively backs up, ensuring the reliability of the data. And the program also has all the functions required by the program, which greatly improves the operability or security, so that the train ticket sales system can go from concept to reality, and it really allows people to improve the efficiency of information processing.

Key WordsInformation management, timeliness, security, MySQL

 

  1. package com.controller;
  2. import java.io.*;
  3. import java.sql.Connection;
  4. import java.sql.DriverManager;
  5. import java.sql.SQLException;
  6. import java.text.SimpleDateFormat;
  7. import java.util.*;
  8. import javax.servlet.http.HttpServletRequest;
  9. import com.alibaba.fastjson.JSON;
  10. import com.utils.StringUtil;
  11. import org.apache.commons.lang3.StringUtils;
  12. import org.json.JSONObject;
  13. import org.slf4j.Logger;
  14. import org.slf4j.LoggerFactory;
  15. import org.springframework.beans.factory.annotation.Autowired;
  16. import org.springframework.beans.factory.annotation.Value;
  17. import org.springframework.util.ResourceUtils;
  18. import org.springframework.web.bind.annotation.PathVariable;
  19. import org.springframework.web.bind.annotation.RequestBody;
  20. import org.springframework.web.bind.annotation.RequestMapping;
  21. import org.springframework.web.bind.annotation.RequestParam;
  22. import org.springframework.web.bind.annotation.RestController;
  23. import com.annotation.IgnoreAuth;
  24. import com.baidu.aip.face.AipFace;
  25. import com.baidu.aip.face.MatchRequest;
  26. import com.baidu.aip.util.Base64Util;
  27. import com.baomidou.mybatisplus.mapper.EntityWrapper;
  28. import com.baomidou.mybatisplus.mapper.Wrapper;
  29. import com.entity.ConfigEntity;
  30. import com.service.CommonService;
  31. import com.service.ConfigService;
  32. import com.utils.BaiduUtil;
  33. import com.utils.FileUtil;
  34. import com.utils.R;
  35. /**
  36. * 通用接口
  37. */
  38. @RestController
  39. public class CommonController {
  40. private static final Logger logger = LoggerFactory.getLogger(CommonController.class);
  41. @Autowired
  42. private CommonService commonService;
  43. /**
  44. * Java代码实现MySQL数据库导出
  45. *
  46. * @param mysqlUrl MySQL安装路径
  47. * @param hostIP MySQL数据库所在服务器地址IP
  48. * @param userName 进入数据库所需要的用户名
  49. * @param hostPort 数据库端口
  50. * @param password 进入数据库所需要的密码
  51. * @param savePath 数据库文件保存路径
  52. * @param fileName 数据库导出文件文件名
  53. * @param databaseName 要导出的数据库名
  54. * @return 返回true表示导出成功,否则返回false。
  55. */
  56. @IgnoreAuth
  57. @RequestMapping("/beifen")
  58. public R beifen(String mysqlUrl, String hostIP, String userName, String hostPort, String password, String savePath, String fileName, String databaseName) {
  59. File saveFile = new File(savePath);
  60. if (!saveFile.exists()) {// 如果目录不存在 
  61. saveFile.mkdirs();// 创建文件夹 
  62. }
  63. if (!savePath.endsWith(File.separator)) {
  64. savePath = savePath + File.separator;
  65. }
  66. PrintWriter printWriter = null;
  67. BufferedReader bufferedReader = null;
  68. try {
  69. Runtime runtime = Runtime.getRuntime();
  70. String cmd = mysqlUrl + "mysqldump -h" + hostIP + " -u" + userName + " -P" + hostPort + " -p" + password + " " + databaseName;
  71. runtime.exec(cmd);
  72. Process process = runtime.exec(cmd);
  73. InputStreamReader inputStreamReader = new InputStreamReader(process.getInputStream(), "utf8");
  74. bufferedReader = new BufferedReader(inputStreamReader);
  75. printWriter = new PrintWriter(new OutputStreamWriter(new FileOutputStream(savePath + fileName), "utf8"));
  76. String line;
  77. while ((line = bufferedReader.readLine()) != null) {
  78. printWriter.println(line);
  79. }
  80. printWriter.flush();
  81. } catch (Exception e) {
  82. e.printStackTrace();
  83. return R.error("备份数据出错");
  84. } finally {
  85. try {
  86. if (bufferedReader != null) {
  87. bufferedReader.close();
  88. }
  89. if (printWriter != null) {
  90. printWriter.close();
  91. }
  92. } catch (Exception e) {
  93. e.printStackTrace();
  94. }
  95. }
  96. return R.ok();
  97. }
  98. /**
  99. * Java实现MySQL数据库导入
  100. *
  101. * @param mysqlUrl MySQL安装路径
  102. * @param hostIP MySQL数据库所在服务器地址IP
  103. * @param userName 进入数据库所需要的用户名
  104. * @param hostPort 数据库端口
  105. * @param password 进入数据库所需要的密码
  106. * @param savePath 数据库文件保存路径
  107. * @param fileName 数据库导出文件文件名
  108. * @param databaseName 要导出的数据库名
  109. */
  110. @IgnoreAuth
  111. @RequestMapping("/huanyuan")
  112. public R huanyuan(String mysqlUrl, String hostIP, String userName, String hostPort, String password, String savePath, String fileName, String databaseName) {
  113. try {
  114. Runtime rt = Runtime.getRuntime();
  115. Process child1 = rt.exec(mysqlUrl+"mysql.exe -h" + hostIP + " -u" + userName + " -P" + hostPort + " -p" + password + " " + databaseName);
  116. OutputStream out = child1.getOutputStream();//控制台的输入信息作为输出流
  117. String inStr;
  118. StringBuffer sb = new StringBuffer("");
  119. String outStr;
  120. BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream(savePath+"/"+fileName), "utf-8"));
  121. while ((inStr = br.readLine()) != null) {
  122. sb.append(inStr + "\r\n");
  123. }
  124. outStr = sb.toString();
  125. OutputStreamWriter writer = new OutputStreamWriter(out, "utf8");
  126. writer.write(outStr);
  127. // 注:这里如果用缓冲方式写入文件的话,会导致中文乱码,用flush()方法则可以避免
  128. writer.flush();
  129. out.close();
  130. br.close();
  131. writer.close();
  132. } catch (Exception e) {
  133. e.printStackTrace();
  134. return R.error("数据导入出错");
  135. }
  136. return R.ok();
  137. }
  138. /**
  139. * 饼状图求和
  140. * @return
  141. */
  142. @RequestMapping("/pieSum")
  143. public R pieSum(@RequestParam Map<String,Object> params) {
  144. logger.debug("饼状图求和:,,Controller:{},,params:{}",this.getClass().getName(),params);
  145. List<Map<String, Object>> result = commonService.pieSum(params);
  146. return R.ok().put("data", result);
  147. }
  148. /**
  149. * 饼状图统计
  150. * @return
  151. */
  152. @RequestMapping("/pieCount")
  153. public R pieCount(@RequestParam Map<String,Object> params) {
  154. logger.debug("饼状图统计:,,Controller:{},,params:{}",this.getClass().getName(),params);
  155. List<Map<String, Object>> result = commonService.pieCount(params);
  156. return R.ok().put("data", result);
  157. }
  158. /**
  159. * 柱状图求和单列
  160. * @return
  161. */
  162. @RequestMapping("/barSumOne")
  163. public R barSumOne(@RequestParam Map<String,Object> params) {
  164. logger.debug("柱状图求和单列:,,Controller:{},,params:{}",this.getClass().getName(),params);
  165. List<Map<String, Object>> result = commonService.barSumOne(params);
  166. List<String> xAxis = new ArrayList<>();//报表x轴
  167. List<List<String>> yAxis = new ArrayList<>();//y轴
  168. List<String> legend = new ArrayList<>();//标题
  169. List<String> yAxis0 = new ArrayList<>();
  170. yAxis.add(yAxis0);
  171. legend.add("");
  172. for(Map<String, Object> map :result){
  173. String oneValue = String.valueOf(map.get("name"));
  174. String value = String.valueOf(map.get("value"));
  175. xAxis.add(oneValue);
  176. yAxis0.add(value);
  177. }
  178. Map<String, Object> resultMap = new HashMap<>();
  179. resultMap.put("xAxis",xAxis);
  180. resultMap.put("yAxis",yAxis);
  181. resultMap.put("legend",legend);
  182. return R.ok().put("data", resultMap);
  183. }
  184. /**
  185. * 柱状图统计单列
  186. * @return
  187. */
  188. @RequestMapping("/barCountOne")
  189. public R barCountOne(@RequestParam Map<String,Object> params) {
  190. logger.debug("柱状图统计单列:,,Controller:{},,params:{}",this.getClass().getName(),params);
  191. List<Map<String, Object>> result = commonService.barCountOne(params);
  192. List<String> xAxis = new ArrayList<>();//报表x轴
  193. List<List<String>> yAxis = new ArrayList<>();//y轴
  194. List<String> legend = new ArrayList<>();//标题
  195. List<String> yAxis0 = new ArrayList<>();
  196. yAxis.add(yAxis0);
  197. legend.add("");
  198. for(Map<String, Object> map :result){
  199. String oneValue = String.valueOf(map.get("name"));
  200. String value = String.valueOf(map.get("value"));
  201. xAxis.add(oneValue);
  202. yAxis0.add(value);
  203. }
  204. Map<String, Object> resultMap = new HashMap<>();
  205. resultMap.put("xAxis",xAxis);
  206. resultMap.put("yAxis",yAxis);
  207. resultMap.put("legend",legend);
  208. return R.ok().put("data", resultMap);
  209. }
  210. /**
  211. * 柱状图统计双列
  212. * @return
  213. */
  214. @RequestMapping("/barSumTwo")
  215. public R barSumTwo(@RequestParam Map<String,Object> params) {
  216. logger.debug("柱状图统计双列:,,Controller:{},,params:{}",this.getClass().getName(),params);
  217. List<Map<String, Object>> result = commonService.barSumTwo(params);
  218. List<String> xAxis = new ArrayList<>();//报表x轴
  219. List<List<String>> yAxis = new ArrayList<>();//y轴
  220. List<String> legend = new ArrayList<>();//标题
  221. Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
  222. for(Map<String, Object> map :result){
  223. String name1Value = String.valueOf(map.get("name1"));
  224. String name2Value = String.valueOf(map.get("name2"));
  225. String value = String.valueOf(map.get("value"));
  226. if(!legend.contains(name2Value)){
  227. legend.add(name2Value);//添加完成后 就是最全的第二列的类型
  228. }
  229. if(dataMap.containsKey(name1Value)){
  230. dataMap.get(name1Value).put(name2Value,value);
  231. }else{
  232. HashMap<String, String> name1Data = new HashMap<>();
  233. name1Data.put(name2Value,value);
  234. dataMap.put(name1Value,name1Data);
  235. }
  236. }
  237. for(int i =0; i<legend.size(); i++){
  238. yAxis.add(new ArrayList<String>());
  239. }
  240. Set<String> keys = dataMap.keySet();
  241. for(String key:keys){
  242. xAxis.add(key);
  243. HashMap<String, String> map = dataMap.get(key);
  244. for(int i =0; i<legend.size(); i++){
  245. List<String> data = yAxis.get(i);
  246. if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
  247. data.add(map.get(legend.get(i)));
  248. }else{
  249. data.add("0");
  250. }
  251. }
  252. }
  253. System.out.println();
  254. Map<String, Object> resultMap = new HashMap<>();
  255. resultMap.put("xAxis",xAxis);
  256. resultMap.put("yAxis",yAxis);
  257. resultMap.put("legend",legend);
  258. return R.ok().put("data", resultMap);
  259. }
  260. /**
  261. * 柱状图统计双列
  262. * @return
  263. */
  264. @RequestMapping("/barCountTwo")
  265. public R barCountTwo(@RequestParam Map<String,Object> params) {
  266. logger.debug("柱状图统计双列:,,Controller:{},,params:{}",this.getClass().getName(),params);
  267. List<Map<String, Object>> result = commonService.barCountTwo(params);
  268. List<String> xAxis = new ArrayList<>();//报表x轴
  269. List<List<String>> yAxis = new ArrayList<>();//y轴
  270. List<String> legend = new ArrayList<>();//标题
  271. Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
  272. for(Map<String, Object> map :result){
  273. String name1Value = String.valueOf(map.get("name1"));
  274. String name2Value = String.valueOf(map.get("name2"));
  275. String value = String.valueOf(map.get("value"));
  276. if(!legend.contains(name2Value)){
  277. legend.add(name2Value);//添加完成后 就是最全的第二列的类型
  278. }
  279. if(dataMap.containsKey(name1Value)){
  280. dataMap.get(name1Value).put(name2Value,value);
  281. }else{
  282. HashMap<String, String> name1Data = new HashMap<>();
  283. name1Data.put(name2Value,value);
  284. dataMap.put(name1Value,name1Data);
  285. }
  286. }
  287. for(int i =0; i<legend.size(); i++){
  288. yAxis.add(new ArrayList<String>());
  289. }
  290. Set<String> keys = dataMap.keySet();
  291. for(String key:keys){
  292. xAxis.add(key);
  293. HashMap<String, String> map = dataMap.get(key);
  294. for(int i =0; i<legend.size(); i++){
  295. List<String> data = yAxis.get(i);
  296. if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
  297. data.add(map.get(legend.get(i)));
  298. }else{
  299. data.add("0");
  300. }
  301. }
  302. }
  303. System.out.println();
  304. Map<String, Object> resultMap = new HashMap<>();
  305. resultMap.put("xAxis",xAxis);
  306. resultMap.put("yAxis",yAxis);
  307. resultMap.put("legend",legend);
  308. return R.ok().put("data", resultMap);
  309. }
  310. /**
  311. tableName 查询表
  312. condition1 条件1
  313. condition1Value 条件1
  314. average 计算平均评分
  315. 取值
  316. 有值 Number(res.data.value.toFixed(1))
  317. 无值 if(res.data){}
  318. * */
  319. @IgnoreAuth
  320. @RequestMapping("/queryScore")
  321. public R queryScore(@RequestParam Map<String, Object> params) {
  322. logger.debug("queryScore:,,Controller:{},,params:{}",this.getClass().getName(),params);
  323. Map<String, Object> queryScore = commonService.queryScore(params);
  324. return R.ok().put("data", queryScore);
  325. }
  326. /**
  327. * 查询字典表的分组统计总条数
  328. * tableName 表名
  329. * groupColumn 分组字段
  330. * @return
  331. */
  332. @RequestMapping("/newSelectGroupCount")
  333. public R newSelectGroupCount(@RequestParam Map<String,Object> params) {
  334. logger.debug("newSelectGroupCount:,,Controller:{},,params:{}",this.getClass().getName(),params);
  335. List<Map<String, Object>> result = commonService.newSelectGroupCount(params);
  336. return R.ok().put("data", result);
  337. }
  338. /**
  339. * 查询字典表的分组求和
  340. * tableName 表名
  341. * groupColumn 分组字段
  342. * sumCloum 统计字段
  343. * @return
  344. */
  345. @RequestMapping("/newSelectGroupSum")
  346. public R newSelectGroupSum(@RequestParam Map<String,Object> params) {
  347. logger.debug("newSelectGroupSum:,,Controller:{},,params:{}",this.getClass().getName(),params);
  348. List<Map<String, Object>> result = commonService.newSelectGroupSum(params);
  349. return R.ok().put("data", result);
  350. }
  351. /**
  352. * 柱状图求和 老的
  353. */
  354. @RequestMapping("/barSum")
  355. public R barSum(@RequestParam Map<String,Object> params) {
  356. logger.debug("barSum方法:,,Controller:{},,params:{}",this.getClass().getName(), com.alibaba.fastjson.JSONObject.toJSONString(params));
  357. Boolean isJoinTableFlag = false;//是否有级联表相关
  358. String one = "";//第一优先
  359. String two = "";//第二优先
  360. //处理thisTable和joinTable 处理内容是把json字符串转为Map并把带有,的切割为数组
  361. //当前表
  362. Map<String,Object> thisTable = JSON.parseObject(String.valueOf(params.get("thisTable")),Map.class);
  363. params.put("thisTable",thisTable);
  364. //级联表
  365. String joinTableString = String.valueOf(params.get("joinTable"));
  366. if(StringUtil.isNotEmpty(joinTableString)) {
  367. Map<String, Object> joinTable = JSON.parseObject(joinTableString, Map.class);
  368. params.put("joinTable", joinTable);
  369. isJoinTableFlag = true;
  370. }
  371. if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期
  372. thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));
  373. one = "thisDate0";
  374. }
  375. if(isJoinTableFlag){//级联表日期
  376. Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
  377. if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){
  378. joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));
  379. if(StringUtil.isEmpty(one)){
  380. one ="joinDate0";
  381. }else{
  382. if(StringUtil.isEmpty(two)){
  383. two ="joinDate0";
  384. }
  385. }
  386. }
  387. }
  388. if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串
  389. thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));
  390. if(StringUtil.isEmpty(one)){
  391. one ="thisString0";
  392. }else{
  393. if(StringUtil.isEmpty(two)){
  394. two ="thisString0";
  395. }
  396. }
  397. }
  398. if(isJoinTableFlag){//级联表字符串
  399. Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
  400. if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){
  401. joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));
  402. if(StringUtil.isEmpty(one)){
  403. one ="joinString0";
  404. }else{
  405. if(StringUtil.isEmpty(two)){
  406. two ="joinString0";
  407. }
  408. }
  409. }
  410. }
  411. if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型
  412. thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));
  413. if(StringUtil.isEmpty(one)){
  414. one ="thisTypes0";
  415. }else{
  416. if(StringUtil.isEmpty(two)){
  417. two ="thisTypes0";
  418. }
  419. }
  420. }
  421. if(isJoinTableFlag){//级联表类型
  422. Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
  423. if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){
  424. joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));
  425. if(StringUtil.isEmpty(one)){
  426. one ="joinTypes0";
  427. }else{
  428. if(StringUtil.isEmpty(two)){
  429. two ="joinTypes0";
  430. }
  431. }
  432. }
  433. }
  434. List<Map<String, Object>> result = commonService.barSum(params);
  435. List<String> xAxis = new ArrayList<>();//报表x轴
  436. List<List<String>> yAxis = new ArrayList<>();//y轴
  437. List<String> legend = new ArrayList<>();//标题
  438. if(StringUtil.isEmpty(two)){//不包含第二列
  439. List<String> yAxis0 = new ArrayList<>();
  440. yAxis.add(yAxis0);
  441. legend.add("");
  442. for(Map<String, Object> map :result){
  443. String oneValue = String.valueOf(map.get(one));
  444. String value = String.valueOf(map.get("value"));
  445. xAxis.add(oneValue);
  446. yAxis0.add(value);
  447. }
  448. }else{//包含第二列
  449. Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
  450. if(StringUtil.isNotEmpty(two)){
  451. for(Map<String, Object> map :result){
  452. String oneValue = String.valueOf(map.get(one));
  453. String twoValue = String.valueOf(map.get(two));
  454. String value = String.valueOf(map.get("value"));
  455. if(!legend.contains(twoValue)){
  456. legend.add(twoValue);//添加完成后 就是最全的第二列的类型
  457. }
  458. if(dataMap.containsKey(oneValue)){
  459. dataMap.get(oneValue).put(twoValue,value);
  460. }else{
  461. HashMap<String, String> oneData = new HashMap<>();
  462. oneData.put(twoValue,value);
  463. dataMap.put(oneValue,oneData);
  464. }
  465. }
  466. }
  467. for(int i =0; i<legend.size(); i++){
  468. yAxis.add(new ArrayList<String>());
  469. }
  470. Set<String> keys = dataMap.keySet();
  471. for(String key:keys){
  472. xAxis.add(key);
  473. HashMap<String, String> map = dataMap.get(key);
  474. for(int i =0; i<legend.size(); i++){
  475. List<String> data = yAxis.get(i);
  476. if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
  477. data.add(map.get(legend.get(i)));
  478. }else{
  479. data.add("0");
  480. }
  481. }
  482. }
  483. System.out.println();
  484. }
  485. Map<String, Object> resultMap = new HashMap<>();
  486. resultMap.put("xAxis",xAxis);
  487. resultMap.put("yAxis",yAxis);
  488. resultMap.put("legend",legend);
  489. return R.ok().put("data", resultMap);
  490. }
  491. /**
  492. * 柱状图统计 老的
  493. */
  494. @RequestMapping("/barCount")
  495. public R barCount(@RequestParam Map<String,Object> params) {
  496. logger.debug("barCount方法:,,Controller:{},,params:{}",this.getClass().getName(), com.alibaba.fastjson.JSONObject.toJSONString(params));
  497. Boolean isJoinTableFlag = false;//是否有级联表相关
  498. String one = "";//第一优先
  499. String two = "";//第二优先
  500. //处理thisTable和joinTable 处理内容是把json字符串转为Map并把带有,的切割为数组
  501. //当前表
  502. Map<String,Object> thisTable = JSON.parseObject(String.valueOf(params.get("thisTable")),Map.class);
  503. params.put("thisTable",thisTable);
  504. //级联表
  505. String joinTableString = String.valueOf(params.get("joinTable"));
  506. if(StringUtil.isNotEmpty(joinTableString)) {
  507. Map<String, Object> joinTable = JSON.parseObject(joinTableString, Map.class);
  508. params.put("joinTable", joinTable);
  509. isJoinTableFlag = true;
  510. }
  511. if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("date")))){//当前表日期
  512. thisTable.put("date",String.valueOf(thisTable.get("date")).split(","));
  513. one = "thisDate0";
  514. }
  515. if(isJoinTableFlag){//级联表日期
  516. Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
  517. if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("date")))){
  518. joinTable.put("date",String.valueOf(joinTable.get("date")).split(","));
  519. if(StringUtil.isEmpty(one)){
  520. one ="joinDate0";
  521. }else{
  522. if(StringUtil.isEmpty(two)){
  523. two ="joinDate0";
  524. }
  525. }
  526. }
  527. }
  528. if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("string")))){//当前表字符串
  529. thisTable.put("string",String.valueOf(thisTable.get("string")).split(","));
  530. if(StringUtil.isEmpty(one)){
  531. one ="thisString0";
  532. }else{
  533. if(StringUtil.isEmpty(two)){
  534. two ="thisString0";
  535. }
  536. }
  537. }
  538. if(isJoinTableFlag){//级联表字符串
  539. Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
  540. if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("string")))){
  541. joinTable.put("string",String.valueOf(joinTable.get("string")).split(","));
  542. if(StringUtil.isEmpty(one)){
  543. one ="joinString0";
  544. }else{
  545. if(StringUtil.isEmpty(two)){
  546. two ="joinString0";
  547. }
  548. }
  549. }
  550. }
  551. if(StringUtil.isNotEmpty(String.valueOf(thisTable.get("types")))){//当前表类型
  552. thisTable.put("types",String.valueOf(thisTable.get("types")).split(","));
  553. if(StringUtil.isEmpty(one)){
  554. one ="thisTypes0";
  555. }else{
  556. if(StringUtil.isEmpty(two)){
  557. two ="thisTypes0";
  558. }
  559. }
  560. }
  561. if(isJoinTableFlag){//级联表类型
  562. Map<String, Object> joinTable = (Map<String, Object>) params.get("joinTable");
  563. if(StringUtil.isNotEmpty(String.valueOf(joinTable.get("types")))){
  564. joinTable.put("types",String.valueOf(joinTable.get("types")).split(","));
  565. if(StringUtil.isEmpty(one)){
  566. one ="joinTypes0";
  567. }else{
  568. if(StringUtil.isEmpty(two)){
  569. two ="joinTypes0";
  570. }
  571. }
  572. }
  573. }
  574. List<Map<String, Object>> result = commonService.barCount(params);
  575. List<String> xAxis = new ArrayList<>();//报表x轴
  576. List<List<String>> yAxis = new ArrayList<>();//y轴
  577. List<String> legend = new ArrayList<>();//标题
  578. if(StringUtil.isEmpty(two)){//不包含第二列
  579. List<String> yAxis0 = new ArrayList<>();
  580. yAxis.add(yAxis0);
  581. legend.add("");
  582. for(Map<String, Object> map :result){
  583. String oneValue = String.valueOf(map.get(one));
  584. String value = String.valueOf(map.get("value"));
  585. xAxis.add(oneValue);
  586. yAxis0.add(value);
  587. }
  588. }else{//包含第二列
  589. Map<String, HashMap<String, String>> dataMap = new LinkedHashMap<>();
  590. if(StringUtil.isNotEmpty(two)){
  591. for(Map<String, Object> map :result){
  592. String oneValue = String.valueOf(map.get(one));
  593. String twoValue = String.valueOf(map.get(two));
  594. String value = String.valueOf(map.get("value"));
  595. if(!legend.contains(twoValue)){
  596. legend.add(twoValue);//添加完成后 就是最全的第二列的类型
  597. }
  598. if(dataMap.containsKey(oneValue)){
  599. dataMap.get(oneValue).put(twoValue,value);
  600. }else{
  601. HashMap<String, String> oneData = new HashMap<>();
  602. oneData.put(twoValue,value);
  603. dataMap.put(oneValue,oneData);
  604. }
  605. }
  606. }
  607. for(int i =0; i<legend.size(); i++){
  608. yAxis.add(new ArrayList<String>());
  609. }
  610. Set<String> keys = dataMap.keySet();
  611. for(String key:keys){
  612. xAxis.add(key);
  613. HashMap<String, String> map = dataMap.get(key);
  614. for(int i =0; i<legend.size(); i++){
  615. List<String> data = yAxis.get(i);
  616. if(StringUtil.isNotEmpty(map.get(legend.get(i)))){
  617. data.add(map.get(legend.get(i)));
  618. }else{
  619. data.add("0");
  620. }
  621. }
  622. }
  623. System.out.println();
  624. }
  625. Map<String, Object> resultMap = new HashMap<>();
  626. resultMap.put("xAxis",xAxis);
  627. resultMap.put("yAxis",yAxis);
  628. resultMap.put("legend",legend);
  629. return R.ok().put("data", resultMap);
  630. }
  631. }

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/知新_RL/article/detail/583989
推荐阅读
相关标签
  

闽ICP备14008679号