diff --git a/.idea/workspace.xml b/.idea/workspace.xml deleted file mode 100644 index 1569411..0000000 --- a/.idea/workspace.xml +++ /dev/null @@ -1,254 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - { - "associatedIndex": 1 -} - - - - { - "keyToString": { - "ModuleVcsDetector.initialDetectionPerformed": "true", - "RunOnceActivity.ShowReadmeOnStart": "true", - "Tomcat 服务器.Tomcat9.executor": "Run", - "git-widget-placeholder": "main", - "kotlin-language-version-configured": "true", - "last_opened_file_path": "C:/Users/Administrator/Desktop/合肥师范学院/ssm076校园快递一站式服务系统+jsp/kuaidizhan/src/main/java/com", - "node.js.detected.package.eslint": "true", - "node.js.detected.package.tslint": "true", - "node.js.selected.package.eslint": "(autodetect)", - "node.js.selected.package.tslint": "(autodetect)", - "nodejs_package_manager_path": "npm", - "project.structure.last.edited": "工件", - "project.structure.proportion": "0.15", - "project.structure.side.proportion": "0.2", - "settings.editor.selected.configurable": "configurable.group.tools", - "vue.rearranger.settings.migration": "true" - } -} - - - - - - - - - - - - - - - - - - - - - - - - - - - 1744280671626 - - - - - - - - - - - - + +
+ +
+ 注册 + + + + + + + + + + + + + + + + + + diff --git a/kuaidizhan/src/main/webapp/jsp/modules/center/info.jsp b/kuaidizhan/src/main/webapp/jsp/modules/center/info.jsp new file mode 100644 index 0000000..68d1edf --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/center/info.jsp @@ -0,0 +1,257 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +<%@ include file="../../static/head.jsp"%> + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp"%> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

个人信息信息

+
+
+ +
+ +
+ + +
+ +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + <%@ include file="../../static/foot.jsp"%> + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/center/updatePassword.jsp b/kuaidizhan/src/main/webapp/jsp/modules/center/updatePassword.jsp new file mode 100644 index 0000000..522d349 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/center/updatePassword.jsp @@ -0,0 +1,246 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + +<%@ include file="../../static/head.jsp"%> + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp"%> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

修改密码信息

+
+
+ +
+ +
+ +
+ +
+ +
+ +
+ + +
+ +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + <%@ include file="../../static/foot.jsp"%> + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/daiqu/add-or-update.jsp b/kuaidizhan/src/main/webapp/jsp/modules/daiqu/add-or-update.jsp new file mode 100644 index 0000000..8162a72 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/daiqu/add-or-update.jsp @@ -0,0 +1,683 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

待取件表信息

+
+
+ +
+ +
+ +
+
+
+ + +
+
+ + +
+
+ + +
+
+ + +
+
+ +
+ +
+
+
+ + +
+ + +
+ + +
+ + +
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/daiqu/info.jsp b/kuaidizhan/src/main/webapp/jsp/modules/daiqu/info.jsp new file mode 100644 index 0000000..cb3db54 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/daiqu/info.jsp @@ -0,0 +1,327 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

待取件表信息

+
+
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + + + +
+ + +
+ + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/daiqu/list.jsp b/kuaidizhan/src/main/webapp/jsp/modules/daiqu/list.jsp new file mode 100644 index 0000000..f36f596 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/daiqu/list.jsp @@ -0,0 +1,757 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

待取件表列表

+
+
+ + + + + + + - + + + +
+ + + +
+ + + + + + + + + + + + + + + + + + +
+
+ + +
+
快递名称用户名称站点名称站点地址快递大小手机号取件码快递状态取件时间操作
+
+
+ + + 条 每页 + +
+
+ +
+
+
+ +
+
+ + +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/daiquren/add-or-update.jsp b/kuaidizhan/src/main/webapp/jsp/modules/daiquren/add-or-update.jsp new file mode 100644 index 0000000..8a36e4c --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/daiquren/add-or-update.jsp @@ -0,0 +1,487 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

信息

+
+
+ + + +
+ + +
+
+ + +
+
+ + +
+
+ + + + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/daiquren/info.jsp b/kuaidizhan/src/main/webapp/jsp/modules/daiquren/info.jsp new file mode 100644 index 0000000..899de84 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/daiquren/info.jsp @@ -0,0 +1,245 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

信息

+
+
+ + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+ + +
+ +
+ + +
+ + +
+ + +
+ +
+ +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/daiquren/list.jsp b/kuaidizhan/src/main/webapp/jsp/modules/daiquren/list.jsp new file mode 100644 index 0000000..6037930 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/daiquren/list.jsp @@ -0,0 +1,607 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

列表

+
+
+ + + + + + + +
+ + + +
+ + + + + + + + + + + + + + + + +
+
+ + +
+
用户名称账号性别头像联系电话身份操作
+
+
+ + + 条 每页 + +
+
+ +
+
+
+ +
+
+ + +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/dictionary/add-or-update.jsp b/kuaidizhan/src/main/webapp/jsp/modules/dictionary/add-or-update.jsp new file mode 100644 index 0000000..870bcd6 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/dictionary/add-or-update.jsp @@ -0,0 +1,449 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

字典表信息

+
+
+ + + +
+ + +
+
+ + +
+
+ + +
+ +
+ + +
+ +
+ + +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/dictionary/info.jsp b/kuaidizhan/src/main/webapp/jsp/modules/dictionary/info.jsp new file mode 100644 index 0000000..0981927 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/dictionary/info.jsp @@ -0,0 +1,233 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

字典表信息

+
+
+ + + + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ + +
+ +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/dictionary/list.jsp b/kuaidizhan/src/main/webapp/jsp/modules/dictionary/list.jsp new file mode 100644 index 0000000..47fb122 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/dictionary/list.jsp @@ -0,0 +1,527 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

字典表列表

+
+
+ + + +
+ + + +
+ + + + + + + + + + + + + + + +
+
+ + +
+
字段字段名编码编码名字操作
+
+
+ + + 条 每页 + +
+
+ +
+
+
+ +
+
+ + +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/modules/forgetThePassword/forgetThePassword.jsp b/kuaidizhan/src/main/webapp/jsp/modules/forgetThePassword/forgetThePassword.jsp new file mode 100644 index 0000000..267370f --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/modules/forgetThePassword/forgetThePassword.jsp @@ -0,0 +1,263 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8" %> + + + + + <%@ include file="../../static/head.jsp" %> + + + + + + + + + +
+
+
+
+
+
+ +
+ +
+ + <%@ include file="../../static/topNav.jsp" %> + + + + + +
+ +
+ + + + +
+ +
+ +
+
+

忘记密码

+
+
+ +
+ + +
+
+ + +
+
+ + +
+
+
+
+
+ +
+
+ +
+ +
+ + + + + +<%@ include file="../../static/foot.jsp" %> + + + + + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/static/crossBtnControl.js b/kuaidizhan/src/main/webapp/jsp/static/crossBtnControl.js new file mode 100644 index 0000000..91065a3 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/static/crossBtnControl.js @@ -0,0 +1,26 @@ +function crossBtnControl(btnName){ + var role = window.sessionStorage.getItem('role'); + + for(var i=0;i + + + + + + + + + + + diff --git a/kuaidizhan/src/main/webapp/jsp/static/getRoleButtons.js b/kuaidizhan/src/main/webapp/jsp/static/getRoleButtons.js new file mode 100644 index 0000000..76d9a3b --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/static/getRoleButtons.js @@ -0,0 +1,41 @@ +function getRoleButtons() { + var role = window.sessionStorage.getItem('role'); + var allButtons = ["新增", "修改", "查看", "删除", "发布", "取件", "完成", "报表", "寄件", "接单", "发布订单"]; + for (var i = 0; i < menus.length; i++) { + // 找到当前登录角色的菜单 + if (menus[i].roleName == role) { + //后台菜单 + var backMenu = menus[i].backMenu; + for (var j = 0; j < backMenu.length; j++) { + // 一级菜单 + var menuChild = backMenu[j].child; + for (var k = 0; k < menuChild.length; k++) { + // 二级菜单 + if (tableName == menuChild[k].tableName) { + var buttons = menuChild[k].buttons; + //console.log("you can see: "+buttons); + //将allButtons剔除能看到的按钮,剩下的就是不能看到的按钮 + if(buttons && buttons.length>0){ + for(var l=0;l= 0; n--) { + elements[n].parentNode.removeChild(elements[n]); + } + } + } + + } + } + } + } +} \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/static/head.jsp b/kuaidizhan/src/main/webapp/jsp/static/head.jsp new file mode 100644 index 0000000..60eb188 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/static/head.jsp @@ -0,0 +1,25 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + + + + 校园快递一站式服务系统 + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/static/iframeAuto.js b/kuaidizhan/src/main/webapp/jsp/static/iframeAuto.js new file mode 100644 index 0000000..b01f516 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/static/iframeAuto.js @@ -0,0 +1,32 @@ +function iframeAuto() { + try { + if (window != parent) { + //定位需要调整的frame框架(在父级窗口中查找) + var a = parent.document.getElementsByTagName("iframe"); + for (var i = 0; i < a.length; i++) { + if (a[i].contentWindow == window) { + var h1 = 0, h2 = 0; + a[i].parentNode.style.height = a[i].offsetHeight + "px"; + a[i].style.height = "10px"; //首先设置高度为10px,后面会修改 + if (document.documentElement && document.documentElement.scrollHeight) { + h1 = document.documentElement.scrollHeight; + } + if (document.body) h2 = document.body.scrollHeight; + var h = Math.max(h1, h2); //取两者中的较大值 + if (document.all) { h += 4; } + if (window.opera) { h += 1; } + //调整框架的大小 + a[i].style.height = a[i].parentNode.style.height = h + "px"; + } + } + } + } + catch (ex) { } +} +//事件绑定的方法,支持IE5以上版本 +if (window.attachEvent) { + window.attachEvent("onload", iframeAuto); +} +else if (window.addEventListener) { + window.addEventListener('load', iframeAuto, false); +} diff --git a/kuaidizhan/src/main/webapp/jsp/static/logout.jsp b/kuaidizhan/src/main/webapp/jsp/static/logout.jsp new file mode 100644 index 0000000..058b612 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/static/logout.jsp @@ -0,0 +1,22 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + function logout() { + $.ajax({ + type: "GET", + url: baseUrl + "users/logout", + beforeSend: function(xhr) { + xhr.setRequestHeader("token", window.sessionStorage.getItem('token')); + }, + success: function(res){ + if(res.code == 0 || res.code == 401){ + window.sessionStorage.clear(); + window.location.href="${pageContext.request.contextPath}/jsp/login.jsp" + }else{ + alert(res.msg); + } + }, + }); + } + function toFront() { +window.location.assign(baseUrl+'front'); +} \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/static/myInfo.js b/kuaidizhan/src/main/webapp/jsp/static/myInfo.js new file mode 100644 index 0000000..57d3fc6 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/static/myInfo.js @@ -0,0 +1,15 @@ +//设置用户个人中心入口 +if(window.sessionStorage.getItem('role') != '管理员'){ + var accountTableName = window.sessionStorage.getItem('accountTableName'); + $('#myinfo').attr('href','#'); + $('#myinfo').on('click', function(e) { + e.preventDefault(); + http(accountTableName+'/session','GET',{},(res)=>{ + if(res.code == 0){ + window.sessionStorage.setItem('userId',res.data.id); + window.sessionStorage.setItem('onlyme',true); + window.location.href = baseUrl + 'jsp/modules/' + accountTableName + '/add-or-update.jsp'; + } + }); + }); +} \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/static/setMenu.js b/kuaidizhan/src/main/webapp/jsp/static/setMenu.js new file mode 100644 index 0000000..be35b2b --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/static/setMenu.js @@ -0,0 +1,51 @@ +function setMenu(){ + if(window.sessionStorage.getItem('role') != '管理员'){ + var accountTableName = window.sessionStorage.getItem('accountTableName'); + $('#side-menu').append('
  • 个人中心
  • '); + http(accountTableName+'/session','GET',{},(res)=>{ + if(res.code == 0){ + window.sessionStorage.setItem('userId',res.data.id); + window.sessionStorage.setItem('onlyme',true); + } + }); + } else { + $('#side-menu').append('
  • 个人中心
  • '); + } + + var role = window.sessionStorage.getItem('role'); + var menusHtml = ''; + for(var i=0;i
    ' + menu[j].menu + '
      '; + + var menuSubHtml = ''; + var secondMenuName = ""; + var menuChild = menu[j].child; + for(var k=0;k' + menuChild[k].menu + ''; + }else{ + menuSubHtml += '
    • ' + menuChild[k].menu + '
    • '; + secondMenuName = menuChild[k].tableName; + } + } + menuHtml += menuSubHtml + '
    '; + } + menusHtml += menuHtml; + } + } + $('#side-menu').append(menusHtml); + if(hasMessage != null && hasMessage == '是' && role == '管理员'){ + $('#side-menu').append('
  • 留言管理
  • '); + } +} + +window.navClick = function(obj, rootNavName, subNavName) { + $('iframe').attr('src', obj.href); +} \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/static/toLogin.jsp b/kuaidizhan/src/main/webapp/jsp/static/toLogin.jsp new file mode 100644 index 0000000..d867f6d --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/static/toLogin.jsp @@ -0,0 +1,5 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> + +alert('token过期或未登录!') +window.location.href="${pageContext.request.contextPath}/jsp/login.jsp" \ No newline at end of file diff --git a/kuaidizhan/src/main/webapp/jsp/static/topNav.jsp b/kuaidizhan/src/main/webapp/jsp/static/topNav.jsp new file mode 100644 index 0000000..e69de29 diff --git a/kuaidizhan/src/main/webapp/jsp/utils/baseUrl.jsp b/kuaidizhan/src/main/webapp/jsp/utils/baseUrl.jsp new file mode 100644 index 0000000..3885b05 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/utils/baseUrl.jsp @@ -0,0 +1,69 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +var baseUrl = "http://localhost:8080/kuaidizhan/"; +var projectName = "校园快递一站式服务系统" + +/** + * 网络请求 + * @param {Object} url 地址 + * @param {Object} method get/post + * @param {Object} param 参数 + * @param {Object} callback 回调函数 + */ +function http(url, type, data, callback) { + url = baseUrl + url; + $.ajax({ + url: url, + beforeSend: function(request) { + request.setRequestHeader("token", window.sessionStorage.getItem("token")); + }, + contentType: 'application/x-www-form-urlencoded', + data: data, + dataType: 'json', + type: type, + async: false, + success: function(result, status, xhr) { + if (result.code == 0) { + callback(result); + } else if (result.code == 401) { + window.location.href = '${pageContext.request.contextPath}/jsp/login.jsp'; + } else { + alert(result.msg) + } + }, + error: function(xhr, status, error) { + console.log(xhr, status, error) + } + }); +} + +function httpJson(url, type, data, callback) { + url = baseUrl + url; + var params = null; + if (data) { + var params = JSON.stringify(data); + } + $.ajax({ + url: url, + beforeSend: function(request) { + request.setRequestHeader("token", window.sessionStorage.getItem("token")); + }, + contentType: 'application/json', + data: params, + dataType: 'json', + type: type, + async: false, + success: function(result, status, xhr) { + if (result.code == 0) { + callback(result); + } else if (result.code == 401) { + window.location.href = '${pageContext.request.contextPath}/jsp/login.jsp'; + } else { + alert(result.msg) + } + }, + error: function(xhr, status, error) { + console.log(xhr, status, error) + } + }); +} diff --git a/kuaidizhan/src/main/webapp/jsp/utils/menu.jsp b/kuaidizhan/src/main/webapp/jsp/utils/menu.jsp new file mode 100644 index 0000000..78eb054 --- /dev/null +++ b/kuaidizhan/src/main/webapp/jsp/utils/menu.jsp @@ -0,0 +1,219 @@ +<%@ page language="java" contentType="text/html; charset=UTF-8" + pageEncoding="UTF-8"%> +var menus = [ + { + "backMenu":[ + { + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除", + ], + "menu":"用户管理", + "menuJump":"列表", + "tableName":"yonghu" + } + ], + "menu":"用户管理" + } + + ,{ + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除", + ], + "menu":"代取人管理", + "menuJump":"列表", + "tableName":"daiquren" + } + ], + "menu":"代取人管理" + }, + { + "child":[ + { + "buttons":[ + "查看", + "新增", + "修改", + "删除", + ], + "menu":"快递站点管理", + "menuJump":"列表", + "tableName":"zhandian" + } + ], + "menu":"快递站点管理" + }, + { + "child":[ + { + "buttons":[ + "新增", + "修改", + "删除", + ], + "menu":"待取件表管理", + "menuJump":"列表", + "tableName":"daiqu" + } + ], + "menu":"待取件表管理" + } + ,{ + "child":[ + { + "buttons":[ + "新增", + "删除", + ], + "menu":"快递接单表管理", + "menuJump":"列表", + "tableName":"jiedan" + } + ], + "menu":"快递接单表管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "删除", + ], + "menu":"已接单表管理", + "menuJump":"列表", + "tableName":"yijiedan" + } + ], + "menu":"已接单表管理" + } + ], + "frontMenu":[ + + ], + "roleName":"管理员", + "tableName":"users" + }, + { + "backMenu":[ + { + "child":[ + { + "buttons":[ + "查看", + ], + "menu":"快递站点管理", + "menuJump":"列表", + "tableName":"zhandian" + } + ], + "menu":"快递站点管理" + }, + { + "child":[ + { + "buttons":[ + "接单", + ], + "menu":"快递接单表管理", + "menuJump":"列表", + "tableName":"jiedan" + } + ], + "menu":"快递接单表管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + ], + "menu":"已接单表管理", + "menuJump":"列表", + "tableName":"yijiedan" + } + ], + "menu":"已接单表管理" + } + ], + "frontMenu":[ + + ], + "roleName":"代取人", + "tableName":"daiquren" + }, + { + "backMenu":[ + { + "child":[ + { + "buttons":[ + "查看", + + ], + "menu":"快递站点管理", + "menuJump":"列表", + "tableName":"zhandian" + } + ], + "menu":"快递站点管理" + }, + { + "child":[ + { + "buttons":[ + "取件", + "发布订单", + ], + "menu":"待取件表管理", + "menuJump":"列表", + "tableName":"daiqu" + } + ], + "menu":"待取件表管理" + } + ,{ + "child":[ + { + "buttons":[ + "寄件", + ], + "menu":"快递接单表管理", + "menuJump":"列表", + "tableName":"jiedan" + } + ], + "menu":"快递接单表管理" + } + ,{ + "child":[ + { + "buttons":[ + "查看", + "完成", + ], + "menu":"已接单表管理", + "menuJump":"列表", + "tableName":"yijiedan" + } + ], + "menu":"已接单表管理" + } + ], + "frontMenu":[ + + ], + "roleName":"用户", + "tableName":"yonghu" + } +]; + +var hasMessage = ''; diff --git a/src/main/java/.idea/.gitignore b/src/main/java/.idea/.gitignore deleted file mode 100644 index 7d05e99..0000000 --- a/src/main/java/.idea/.gitignore +++ /dev/null @@ -1,10 +0,0 @@ -# 默认忽略的文件 -/shelf/ -/workspace.xml -# 基于编辑器的 HTTP 客户端请求 -/httpRequests/ -# 依赖于环境的 Maven 主目录路径 -/mavenHomeManager.xml -# Datasource local storage ignored files -/dataSources/ -/dataSources.local.xml diff --git a/src/main/java/.idea/misc.xml b/src/main/java/.idea/misc.xml deleted file mode 100644 index f03c948..0000000 --- a/src/main/java/.idea/misc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/main/java/.idea/modules.xml b/src/main/java/.idea/modules.xml deleted file mode 100644 index 122a905..0000000 --- a/src/main/java/.idea/modules.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/src/main/java/.idea/vcs.xml b/src/main/java/.idea/vcs.xml deleted file mode 100644 index c2365ab..0000000 --- a/src/main/java/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/src/main/java/com/controller/AntiLeechServlet.java b/src/main/java/com/controller/AntiLeechServlet.java deleted file mode 100644 index 980c2ba..0000000 --- a/src/main/java/com/controller/AntiLeechServlet.java +++ /dev/null @@ -1,60 +0,0 @@ -package com.controller; -import java.io.*; -import jakarta.servlet.ServletException; -import jakarta.servlet.http.*; -import jakarta.servlet.annotation.*; -@WebServlet("/download") -public class AntiLeechServlet extends HttpServlet { - // 允许访问的域名白名单(根据实际修改) - private static final String[] ALLOWED_DOMAINS = { - "http://your-domain.com", - "https://www.your-domain.com" - }; - - protected void doGet(HttpServletRequest request, HttpServletResponse response) throws IOException { - // 获取来源域名 - String referer = request.getHeader("Referer"); - - // 防盗链检查 - if (referer == null || !isAllowedDomain(referer)) { - response.sendError(HttpServletResponse.SC_FORBIDDEN, "禁止直接访问"); - return; - } - - // 文件路径配置(根据实际路径修改) - String filePath = getServletContext().getRealPath("/WEB-INF/resources/images/image.png"); - File file = new File(filePath); - - // 检查文件是否存在 - if (!file.exists()) { - response.sendError(HttpServletResponse.SC_NOT_FOUND); - return; - } - - // 设置响应头 - response.setContentType("image/png"); - response.setHeader("Content-Disposition", "attachment; filename=\"image.png\""); - response.setContentLength((int) file.length()); - - // 文件传输 - try (InputStream in = new FileInputStream(file); - OutputStream out = response.getOutputStream()) { - byte[] buffer = new byte[4096]; - int bytesRead; - while ((bytesRead = in.read(buffer)) != -1) { - out.write(buffer, 0, bytesRead); - } - } - } - - // 域名白名单验证方法 - private boolean isAllowedDomain(String referer) { - if (referer == null) return false; - for (String domain : ALLOWED_DOMAINS) { - if (referer.startsWith(domain)) { - return true; - } - } - return false; - } -} \ No newline at end of file diff --git a/src/main/java/com/controller/CommonController.java b/src/main/java/com/controller/CommonController.java deleted file mode 100644 index 72977de..0000000 --- a/src/main/java/com/controller/CommonController.java +++ /dev/null @@ -1,350 +0,0 @@ -package com.controller; - -import java.io.File; -import java.io.FileNotFoundException; -import java.io.IOException; -import java.text.SimpleDateFormat; -import java.util.ArrayList; -import java.util.Calendar; -import java.util.Date; -import java.util.HashMap; -import java.util.List; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.entity.ConfigEntity; -import org.apache.commons.lang3.StringUtils; -import org.json.JSONObject; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import com.annotation.IgnoreAuth; -import com.baidu.aip.face.AipFace; -import com.baidu.aip.face.MatchRequest; -import com.baidu.aip.util.Base64Util; -import com.service.CommonService; -import com.service.ConfigService; -import com.utils.BaiduUtil; -import com.utils.FileUtil; -import com.utils.R; -/** - * 通用接口控制器 - * 提供地理位置查询、人脸识别、数据联动查询等通用功能接口 - * - * 依赖服务: - * - CommonService:通用业务逻辑服务 - * - ConfigService:配置管理服务 - * - * 核心功能: - * 1. 第三方服务集成(百度地图、人脸识别) - * 2. 动态数据查询(联动下拉、统计计算) - * 3. 通用数据操作(审核、提醒) - */ -@RestController -public class CommonController { - @Autowired - private CommonService commonService; // 通用业务逻辑服务 - - @Autowired - private ConfigService configService; // 配置管理服务 - - private static AipFace client = null; // 百度人脸识别客户端(单例模式) - private static String BAIDU_DITU_AK = null; // 百度地图AK(从配置中心获取) - - /** - * 地理位置查询接口 - * 通过经纬度获取城市信息(调用百度地图API) - * - * @param lng 经度(如:116.404) - * @param lat 纬度(如:39.915) - * @return 包含城市信息的响应对象(格式:{"status":0,"result":{"city":"北京市"}}) - * - * @throws 配置异常 当未配置baidu_ditu_ak时返回错误 - */ - @RequestMapping("/location") - public R location(String lng, String lat) { - // 懒加载配置(首次调用时从数据库加载配置) - if (BAIDU_DITU_AK == null) { - ConfigEntity config = configService.selectOne( - new EntityWrapper().eq("name", "baidu_ditu_ak") - ); - BAIDU_DITU_AK = config.getValue(); - - if (StringUtils.isEmpty(BAIDU_DITU_AK)) { - return R.error("请在配置管理中正确配置baidu_ditu_ak"); - } - } - - // 调用百度地图逆地理编码API - Map map = BaiduUtil.getCityByLonLat(BAIDU_DITU_AK, lng, lat); - return R.ok().put("data", map); - } - - /** - * 人脸比对接口(1:1精确比对) - * 使用百度AI人脸识别技术进行人脸相似度比对 - * - * @param face1 人脸图片1文件名(存储于服务器upload目录) - * @param face2 人脸图片2文件名 - * @param request HTTP请求对象(用于获取服务器文件路径) - * @return 比对结果响应对象(包含相似度分数,如:{"score":85.5}) - * - * @throws 配置异常 当未配置APIKey/SecretKey时返回错误 - * @throws 文件异常 当图片文件不存在时返回错误 - */ - @RequestMapping("/matchFace") - public R matchFace(String face1, String face2, HttpServletRequest request) { - // 初始化百度AI客户端(单例模式保证线程安全) - if (client == null) { - String APIKey = configService.selectOne( - new EntityWrapper().eq("name", "APIKey") - ).getValue(); - String SecretKey = configService.selectOne( - new EntityWrapper().eq("name", "SecretKey") - ).getValue(); - - String token = BaiduUtil.getAuth(APIKey, SecretKey); - if (token == null) { - return R.error("请在配置管理中正确配置APIKey和SecretKey"); - } - - client = new AipFace(null, APIKey, SecretKey); - client.setConnectionTimeoutInMillis(2000); // 连接超时2秒 - client.setSocketTimeoutInMillis(60000); // 数据传输超时60秒 - } - - try { - // 构建服务器文件路径(从web应用根目录获取) - String uploadPath = request.getSession() - .getServletContext() - .getRealPath("/upload"); - - File file1 = new File(uploadPath, face1); - File file2 = new File(uploadPath, face2); - - // 图片转Base64编码 - String img1 = Base64Util.encode(FileUtil.FileToByte(file1)); - String img2 = Base64Util.encode(FileUtil.FileToByte(file2)); - - // 构造比对请求参数 - MatchRequest req1 = new MatchRequest(img1, "BASE64"); - MatchRequest req2 = new MatchRequest(img2, "BASE64"); - ArrayList requests = new ArrayList<>(); - requests.add(req1); - requests.add(req2); - - // 执行人脸比对 - JSONObject res = client.match(requests); - return R.ok().put("data", - JSONObject.parse(res.get("result").toString()) - ); - - } catch (FileNotFoundException e) { - return R.error("文件不存在:" + e.getMessage()); - } catch (IOException e) { - return R.error("文件处理失败:" + e.getMessage()); - } - } - - /** - * 联动下拉选项接口 - * 根据表名和列名获取动态下拉选项数据(支持多级联动) - * - * @param tableName 数据表名(如:sys_area 表示地区表) - * @param columnName 列名(如:parent_id 表示父级ID字段) - * @param level 层级参数(可选,用于多级数据过滤) - * @param parent 父级ID(可选,用于获取子级数据) - * @return 下拉选项列表响应对象(格式:["选项1","选项2"]) - * - * @apiNote 示例:/option/sys_area/area_name?level=2&parent=110000 - */ - @RequestMapping("/option/{tableName}/{columnName}") - @IgnoreAuth // 标注不需要登录验证 - public R getOption(@PathVariable String tableName, - @PathVariable String columnName, - @RequestParam(required = false) String level, - @RequestParam(required = false) String parent) { - Map params = new HashMap<>(); - params.put("table", tableName); - params.put("column", columnName); - - // 添加可选参数 - if (StringUtils.isNotBlank(level)) { - params.put("level", level); - } - if (StringUtils.isNotBlank(parent)) { - params.put("parent", parent); - } - - List data = commonService.getOption(params); - return R.ok().put("data", data); - } -} - /** - * 根据table中的column获取单条记录 - * @param table - * @param column - * @return - */ -/** - * 根据条件获取单条记录(级联查询) - * 用于联动下拉框选择后加载详细数据 - * - * @param tableName 数据表名(如:sys_user 表示用户表) - * @param columnName 关联列名(如:dept_id 表示部门ID字段) - * @param columnValue 列值(需要查询的具体值,如:1001) - * @return 包含单条记录的响应对象(格式:{"id":1,"name":"测试数据"}) - * - * @apiNote 示例:/follow/sys_user/dept_id/1001 - */ -@RequestMapping("/follow/{tableName}/{columnName}") -@IgnoreAuth -public R getFollowByOption(@PathVariable String tableName, - @PathVariable String columnName, - @RequestParam String columnValue) { - Map params = new HashMap<>(); - params.put("table", tableName); - params.put("column", columnName); - params.put("columnValue", columnValue); // 关键查询条件 - - Map result = commonService.getFollowByOption(params); - return R.ok().put("data", result); -} - -/** - * 通用审核接口(修改审核状态) - * 支持任意业务表的审核操作(需实现sh方法) - * - * @param tableName 操作的数据表名(如:news 表示新闻表) - * @param map 审核参数(需包含:id-记录ID, shzt-审核状态) - * @return 操作结果响应 - * - * @apiNote 请求示例: - * POST /sh/news - * Body: {"id":123,"shzt":"1"} - */ -@RequestMapping("/sh/{tableName}") -public R sh(@PathVariable String tableName, - @RequestBody Map map) { - map.put("table", tableName); // 注入表名参数 - commonService.sh(map); // 调用通用审核服务 - return R.ok(); -} - -/** - * 提醒数量统计接口 - * 支持数字范围提醒和日期范围提醒两种模式 - * - * @param tableName 数据表名(如:order 表示订单表) - * @param columnName 时间字段名(如:create_time) - * @param type 提醒类型(1:数字提醒 2:日期提醒) - * @param map 扩展参数: - * - remindstart: 开始偏移量(数字类型) - * - remindend: 结束偏移量(数字类型) - * @return 提醒数量响应(格式:{"count":5}) - * - * @apiNote 日期计算示例: - * 当前时间+remindstart天 到 当前时间+remindend天 - */ -@RequestMapping("/remind/{tableName}/{columnName}/{type}") -@IgnoreAuth -public R remindCount(@PathVariable String tableName, - @PathVariable String columnName, - @PathVariable String type, - @RequestParam Map map) { - map.put("table", tableName); - map.put("column", columnName); - map.put("type", type); - - // 日期类型特殊处理 - if ("2".equals(type)) { - SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); - Calendar c = Calendar.getInstance(); - - // 处理开始日期偏移(支持负数表示过去天数) - if (map.get("remindstart") != null) { - int offset = Integer.parseInt(map.get("remindstart").toString()); - c.add(Calendar.DAY_OF_MONTH, offset); - map.put("remindstart", sdf.format(c.getTime())); - } - - // 处理结束日期偏移 - if (map.get("remindend") != null) { - int offset = Integer.parseInt(map.get("remindend").toString()); - c.add(Calendar.DAY_OF_MONTH, offset); - map.put("remindend", sdf.format(c.getTime())); - } - } - - int count = commonService.remindCount(map); - return R.ok().put("count", count); -} - -/** - * 数值列求和接口 - * 对指定表的数值型字段进行求和计算 - * - * @param tableName 数据表名(如:finance 表示财务表) - * @param columnName 数值列名(如:amount 表示金额字段) - * @return 求和结果响应(格式:{"sum":1000.5}) - */ -@RequestMapping("/cal/{tableName}/{columnName}") -@IgnoreAuth -public R cal(@PathVariable String tableName, - @PathVariable String columnName) { - Map params = new HashMap<>(); - params.put("table", tableName); - params.put("column", columnName); - - Map result = commonService.selectCal(params); - return R.ok().put("data", result); -} - -/** - * 分组统计接口 - * 对指定字段进行GROUP BY分组统计 - * - * @param tableName 数据表名(如:sales 表示销售记录表) - * @param columnName 分组字段名(如:product_type 表示产品类型) - * @return 分组统计结果(格式:[{"group":"类型A","count":10},...]) - */ -@RequestMapping("/group/{tableName}/{columnName}") -@IgnoreAuth -public R group(@PathVariable String tableName, - @PathVariable String columnName) { - Map params = new HashMap<>(); - params.put("table", tableName); - params.put("column", columnName); - - List> result = commonService.selectGroup(params); - return R.ok().put("data", result); -} - -/** - * 交叉统计接口 - * 按X/Y轴字段进行二维统计(类似数据透视表) - * - * @param tableName 数据表名(如:visit_log 表示访问日志) - * @param xColumnName X轴统计字段(如:date 表示日期) - * @param yColumnName Y轴统计字段(如:channel 表示渠道) - * @return 交叉统计结果(格式:[{"x":"2023-01-01","y":"SEO","count":15},...]) - */ -@RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}") -@IgnoreAuth -public R value(@PathVariable String tableName, - @PathVariable String yColumnName, - @PathVariable String xColumnName) { - Map params = new HashMap<>(); - params.put("table", tableName); - params.put("xColumn", xColumnName); - params.put("yColumn", yColumnName); - - List> result = commonService.selectValue(params); - return R.ok().put("data", result); -} diff --git a/src/main/java/com/controller/ConfigController.java b/src/main/java/com/controller/ConfigController.java deleted file mode 100644 index ec724c4..0000000 --- a/src/main/java/com/controller/ConfigController.java +++ /dev/null @@ -1,110 +0,0 @@ - -package com.controller; - - -import java.util.Arrays; -import java.util.Map; - -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.entity.ConfigEntity; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; - -import com.annotation.IgnoreAuth; -import com.service.ConfigService; -import com.utils.PageUtils; -import com.utils.R; - -/** - * 登录相关 - */ -@RequestMapping("config") -@RestController -public class ConfigController{ - - @Autowired - private ConfigService configService; - - /** - * 列表 - */ - @RequestMapping("/page") - public R page(@RequestParam Map params,ConfigEntity config){ - EntityWrapper ew = new EntityWrapper(); - PageUtils page = configService.queryPage(params); - return R.ok().put("data", page); - } - - /** - * 列表 - */ - @IgnoreAuth - @RequestMapping("/list") - public R list(@RequestParam Map params,ConfigEntity config){ - EntityWrapper ew = new EntityWrapper(); - PageUtils page = configService.queryPage(params); - return R.ok().put("data", page); - } - - /** - * 信息 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") String id){ - ConfigEntity config = configService.selectById(id); - return R.ok().put("data", config); - } - - /** - * 详情 - */ - @IgnoreAuth - @RequestMapping("/detail/{id}") - public R detail(@PathVariable("id") String id){ - ConfigEntity config = configService.selectById(id); - return R.ok().put("data", config); - } - - /** - * 根据name获取信息 - */ - @RequestMapping("/info") - public R infoByName(@RequestParam String name){ - ConfigEntity config = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); - return R.ok().put("data", config); - } - - /** - * 保存 - */ - @PostMapping("/save") - public R save(@RequestBody ConfigEntity config){ -// ValidatorUtils.validateEntity(config); - configService.insert(config); - return R.ok(); - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody ConfigEntity config){ -// ValidatorUtils.validateEntity(config); - configService.updateById(config);//全部更新 - return R.ok(); - } - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Long[] ids){ - configService.deleteBatchIds(Arrays.asList(ids)); - return R.ok(); - } -} diff --git a/src/main/java/com/controller/DaiquController.java b/src/main/java/com/controller/DaiquController.java deleted file mode 100644 index 07cb1a8..0000000 --- a/src/main/java/com/controller/DaiquController.java +++ /dev/null @@ -1,244 +0,0 @@ -package com.controller; - - -import java.text.SimpleDateFormat; -import com.alibaba.fastjson.JSONObject; -import java.util.*; - -import com.entity.JiedanEntity; -import com.service.*; -import org.springframework.beans.BeanUtils; -import javax.servlet.http.HttpServletRequest; -import org.springframework.web.context.ContextLoader; -import javax.servlet.ServletContext; - -import com.utils.StringUtil; -import java.lang.reflect.InvocationTargetException; - -import org.apache.commons.lang3.StringUtils; -import com.annotation.IgnoreAuth; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.mapper.Wrapper; - -import com.entity.DaiquEntity; - -import com.entity.view.DaiquView; -import com.entity.YonghuEntity; -import com.entity.ZhandianEntity; -import com.utils.PageUtils; -import com.utils.R; - -/** - * 待取件表 - * 后端接口 - * @author - * @email - * @date 2021-03-11 -*/ -@RestController -@Controller -@RequestMapping("/daiqu") -public class DaiquController { - private static final Logger logger = LoggerFactory.getLogger(DaiquController.class); - - @Autowired - private DaiquService daiquService; - - @Autowired - private JiedanService jiedanService; - - @Autowired - private TokenService tokenService; - @Autowired - private DictionaryService dictionaryService; - - - //级联表service - @Autowired - private YonghuService yonghuService; - @Autowired - private ZhandianService zhandianService; - - - /** - * 后端列表 - */ - @RequestMapping("/page") - public R page(@RequestParam Map params, HttpServletRequest request){ - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); - String role = String.valueOf(request.getSession().getAttribute("role")); - if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ - params.put("yonghuId",request.getSession().getAttribute("userId")); - } - PageUtils page = daiquService.queryPage(params); - - //字典表数据转换 - List list =(List)page.getList(); - for(DaiquView c:list){ - //修改对应字典表字段 - dictionaryService.dictionaryConvert(c); - } - return R.ok().put("data", page); - } - /** - * 后端详情 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Long id){ - logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); - DaiquEntity daiqu = daiquService.selectById(id); - if(daiqu !=null){ - //entity转view - DaiquView view = new DaiquView(); - BeanUtils.copyProperties( daiqu , view );//把实体数据重构到view中 - - //级联表 - YonghuEntity yonghu = yonghuService.selectById(daiqu.getYonghuId()); - if(yonghu != null){ - BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 - view.setYonghuId(yonghu.getId()); - } - //级联表 - ZhandianEntity zhandian = zhandianService.selectById(daiqu.getZhandianId()); - if(zhandian != null){ - BeanUtils.copyProperties( zhandian , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 - view.setZhandianId(zhandian.getId()); - } - //修改对应字典表字段 - dictionaryService.dictionaryConvert(view); - return R.ok().put("data", view); - }else { - return R.error(511,"查不到数据"); - } - - } - - /** - * 后端保存 - */ - @RequestMapping("/save") - public R save(@RequestBody DaiquEntity daiqu, HttpServletRequest request){ - logger.debug("save方法:,,Controller:{},,daiqu:{}",this.getClass().getName(),daiqu.toString()); - daiqu.setKdztTypes(1); - daiqu.setTakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6)); - Wrapper queryWrapper = new EntityWrapper() - .eq("dqname", daiqu.getDqname()) - .eq("zhandian_id", daiqu.getZhandianId()) - .eq("yonghu_id", daiqu.getYonghuId()) - .eq("takecode", daiqu.getTakecode()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - DaiquEntity daiquEntity = daiquService.selectOne(queryWrapper); - if(daiquEntity==null){ - daiquService.insert(daiqu); - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody DaiquEntity daiqu, HttpServletRequest request){ - logger.debug("update方法:,,Controller:{},,daiqu:{}",this.getClass().getName(),daiqu.toString()); - //根据字段查询是否有相同数据 - Wrapper queryWrapper = new EntityWrapper() - .notIn("id",daiqu.getId()) - .eq("dqname", daiqu.getDqname()) - .eq("zhandian_id", daiqu.getZhandianId()) - .eq("yonghu_id", daiqu.getYonghuId()) - .eq("kddx_types", daiqu.getKddxTypes()) - .eq("dqphone", daiqu.getDqphone()) - .eq("takecode", daiqu.getTakecode()) - .eq("kdzt_types", daiqu.getKdztTypes()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - DaiquEntity daiquEntity = daiquService.selectOne(queryWrapper); - daiqu.setPickupTime(new Date()); - if(daiquEntity==null){ - daiquService.updateById(daiqu);//根据id更新 - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - - /** - * 代取订单 - */ - @RequestMapping("/replaceExpress") - public R replaceExpress(@RequestBody Integer ids){ - DaiquEntity daiqu = daiquService.selectById(ids); - if(daiqu == null){ - return R.error("数据不存在"); - } - YonghuEntity yonghu = yonghuService.selectById(daiqu.getYonghuId()); - if(yonghu == null){ - return R.error("数据不存在"); - } - JiedanEntity jiedan = new JiedanEntity(); - jiedan.setInitiateTime(new Date()); - jiedan.setJdyonghuId(daiqu.getYonghuId()); - jiedan.setJdphone(daiqu.getDqphone()); - jiedan.setAddresseename(yonghu.getName()); - jiedan.setJdaddressee("住宿楼栋:"+yonghu.getDormitory()+" ,寝室号:"+yonghu.getDormitory()); - jiedan.setJdtakecode(daiqu.getTakecode()); - jiedan.setDaiqukuaidimc(daiqu.getDqname()); - jiedan.setJdztTypes(1);//1未接 - jiedan.setKdlxTypes(1);//1取件 - jiedan.setOdd(String.valueOf(new Date().getTime())); - Wrapper queryWrapper = new EntityWrapper() - .eq("jdyonghu_id", jiedan.getJdyonghuId()) - .eq("jdtakecode", jiedan.getJdtakecode()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper); - if(jiedanEntity==null){ - daiqu.setKdztTypes(3); - daiquService.updateById(daiqu); - jiedanService.insert(jiedan); - return R.ok(); - }else { - return R.error(511,"你已经发布过这件快递的代取订单了"); - } - } - - - /** - * 取件 - */ - @RequestMapping("/pickUp") - public R pickUp(@RequestBody Integer ids){ - DaiquEntity daiqu = daiquService.selectById(ids); - if(daiqu == null){ - return R.error("数据不存在"); - } - daiqu.setKdztTypes(2); - daiqu.setPickupTime(new Date()); - daiquService.updateById(daiqu); - return R.ok(); - } - - - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids){ - logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); - daiquService.deleteBatchIds(Arrays.asList(ids)); - return R.ok(); - } - - -} - diff --git a/src/main/java/com/controller/DaiqurenController.java b/src/main/java/com/controller/DaiqurenController.java deleted file mode 100644 index 40f29a5..0000000 --- a/src/main/java/com/controller/DaiqurenController.java +++ /dev/null @@ -1,225 +0,0 @@ -package com.controller; - - -import java.text.SimpleDateFormat; -import com.alibaba.fastjson.JSONObject; -import java.util.*; - -import com.entity.DaiqurenEntity; -import org.springframework.beans.BeanUtils; -import javax.servlet.http.HttpServletRequest; -import org.springframework.web.context.ContextLoader; -import javax.servlet.ServletContext; -import com.service.TokenService; -import com.utils.StringUtil; -import java.lang.reflect.InvocationTargetException; - -import com.service.DictionaryService; -import org.apache.commons.lang3.StringUtils; -import com.annotation.IgnoreAuth; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.mapper.Wrapper; - -import com.entity.DaiqurenEntity; - -import com.service.DaiqurenService; -import com.entity.view.DaiqurenView; -import com.utils.PageUtils; -import com.utils.R; - -/** - * - * 后端接口 - * @author - * @email - * @date 2021-03-11 -*/ -@RestController -@Controller -@RequestMapping("/daiquren") -public class DaiqurenController { - private static final Logger logger = LoggerFactory.getLogger(DaiqurenController.class); - - @Autowired - private DaiqurenService daiqurenService; - - - @Autowired - private TokenService tokenService; - @Autowired - private DictionaryService dictionaryService; - - - //级联表service - - - /** - * 后端列表 - */ - @RequestMapping("/page") - public R page(@RequestParam Map params, HttpServletRequest request){ - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); - String role = String.valueOf(request.getSession().getAttribute("role")); - if(StringUtil.isNotEmpty(role) && "代取人".equals(role)){ - params.put("yonghuId",request.getSession().getAttribute("userId")); - } - PageUtils page = daiqurenService.queryPage(params); - - //字典表数据转换 - List list =(List)page.getList(); - for(DaiqurenView c:list){ - //修改对应字典表字段 - dictionaryService.dictionaryConvert(c); - } - return R.ok().put("data", page); - } - /** - * 后端详情 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Long id){ - logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); - DaiqurenEntity daiquren = daiqurenService.selectById(id); - if(daiquren !=null){ - //entity转view - DaiqurenView view = new DaiqurenView(); - BeanUtils.copyProperties( daiquren , view );//把实体数据重构到view中 - - //修改对应字典表字段 - dictionaryService.dictionaryConvert(view); - return R.ok().put("data", view); - }else { - return R.error(511,"查不到数据"); - } - - } - - /** - * 后端保存 - */ - @RequestMapping("/save") - public R save(@RequestBody DaiqurenEntity daiquren, HttpServletRequest request){ - logger.debug("save方法:,,Controller:{},,daiquren:{}",this.getClass().getName(),daiquren.toString()); - Wrapper queryWrapper = new EntityWrapper() - .eq("name", daiquren.getName()) - .eq("username", daiquren.getUsername()) - .eq("password", daiquren.getPassword()) - .eq("sex_types", daiquren.getSexTypes()) - .eq("phone", daiquren.getPhone()) - .eq("role", daiquren.getRole()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - DaiqurenEntity daiqurenEntity = daiqurenService.selectOne(queryWrapper); - if(daiqurenEntity==null){ - daiquren.setRole("代取人"); - daiqurenService.insert(daiquren); - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody DaiqurenEntity daiquren, HttpServletRequest request){ - logger.debug("update方法:,,Controller:{},,daiquren:{}",this.getClass().getName(),daiquren.toString()); - //根据字段查询是否有相同数据 - Wrapper queryWrapper = new EntityWrapper() - .notIn("id",daiquren.getId()) - .eq("name", daiquren.getName()) - .eq("username", daiquren.getUsername()) - .eq("password", daiquren.getPassword()) - .eq("sex_types", daiquren.getSexTypes()) - .eq("phone", daiquren.getPhone()) - .eq("role", daiquren.getRole()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - DaiqurenEntity daiqurenEntity = daiqurenService.selectOne(queryWrapper); - if("".equals(daiquren.getImgPhoto()) || "null".equals(daiquren.getImgPhoto())){ - daiquren.setImgPhoto(null); - } - if(daiqurenEntity==null){ - daiqurenService.updateById(daiquren);//根据id更新 - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids){ - logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); - daiqurenService.deleteBatchIds(Arrays.asList(ids)); - return R.ok(); - } - - - /** - * 登录 - */ - @IgnoreAuth - @PostMapping(value = "/login") - public R login(String username, String password, String role, HttpServletRequest request) { - DaiqurenEntity yonghu = daiqurenService.selectOne(new EntityWrapper().eq("username", username)); - if(yonghu==null || !yonghu.getPassword().equals(password)) { - return R.error("账号或密码不正确"); - } - if(!role.equals(yonghu.getRole())){ - return R.error("权限不正确"); - } - String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "代取人"); - R r = R.ok(); - r.put("token", token); - r.put("role","代取人"); - r.put("userId",yonghu.getId()); - return r; - } - - /** - * 注册 - */ - @IgnoreAuth - @PostMapping(value = "/register") - public R register(@RequestBody DaiqurenEntity yonghu){ - // ValidatorUtils.validateEntity(user); - if(daiqurenService.selectOne(new EntityWrapper().eq("username", yonghu.getUsername()).orNew().eq("phone",yonghu.getPhone())) !=null) { - return R.error("代取人已存在或手机号身份证号已经被使用"); - } - daiqurenService.insert(yonghu); - return R.ok(); - } - - /** - * 获取代取人的session代取人信息 - */ - @RequestMapping("/session") - public R getCurrYonghu(HttpServletRequest request){ - Integer id = (Integer)request.getSession().getAttribute("userId"); - DaiqurenEntity yonghu = daiqurenService.selectById(id); - return R.ok().put("data", yonghu); - } - - - /** - * 退出 - */ - @GetMapping(value = "logout") - public R logout(HttpServletRequest request) { - request.getSession().invalidate(); - return R.ok("退出成功"); - } - - -} - diff --git a/src/main/java/com/controller/DictionaryController.java b/src/main/java/com/controller/DictionaryController.java deleted file mode 100644 index e3a01ae..0000000 --- a/src/main/java/com/controller/DictionaryController.java +++ /dev/null @@ -1,188 +0,0 @@ -package com.controller; - - -import java.text.SimpleDateFormat; -import com.alibaba.fastjson.JSONObject; -import java.util.*; -import org.springframework.beans.BeanUtils; -import javax.servlet.http.HttpServletRequest; -import org.springframework.web.context.ContextLoader; -import javax.servlet.ServletContext; -import com.service.TokenService; -import com.utils.StringUtil; -import java.lang.reflect.InvocationTargetException; - -import com.service.DictionaryService; -import org.apache.commons.lang3.StringUtils; -import com.annotation.IgnoreAuth; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.mapper.Wrapper; - -import com.entity.DictionaryEntity; - -import com.service.DictionaryService; -import com.entity.view.DictionaryView; -import com.utils.PageUtils; -import com.utils.R; - -/** - * 字典表 - * 后端接口 - * @author - * @email - * @date 2021-03-11 -*/ -@RestController -@Controller -@RequestMapping("/dictionary") -public class DictionaryController { - private static final Logger logger = LoggerFactory.getLogger(DictionaryController.class); - - @Autowired - private DictionaryService dictionaryService; - - - @Autowired - private TokenService tokenService; - - - //级联表service - - - /** - * 后端列表 - */ - @RequestMapping("/page") - public R page(@RequestParam Map params, HttpServletRequest request){ - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); - String role = String.valueOf(request.getSession().getAttribute("role")); - if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ - params.put("yonghuId",request.getSession().getAttribute("userId")); - } - PageUtils page = dictionaryService.queryPage(params); - - //字典表数据转换 - List list =(List)page.getList(); - for(DictionaryView c:list){ - //修改对应字典表字段 - dictionaryService.dictionaryConvert(c); - } - return R.ok().put("data", page); - } - /** - * 后端详情 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Long id){ - logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); - DictionaryEntity dictionary = dictionaryService.selectById(id); - if(dictionary !=null){ - //entity转view - DictionaryView view = new DictionaryView(); - BeanUtils.copyProperties( dictionary , view );//把实体数据重构到view中 - - //修改对应字典表字段 - dictionaryService.dictionaryConvert(view); - return R.ok().put("data", view); - }else { - return R.error(511,"查不到数据"); - } - - } - - /** - * 后端保存 - */ - @RequestMapping("/save") - public R save(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){ - logger.debug("save方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString()); - Wrapper queryWrapper = new EntityWrapper() - .eq("dic_code", dictionary.getDicCode()) - .eq("code_index", dictionary.getCodeIndex()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper); - if(dictionaryEntity==null){ - dictionary.setCreateTime(new Date()); - // String role = String.valueOf(request.getSession().getAttribute("role")); - // if("".equals(role)){ - // dictionary.set - // } - dictionaryService.insert(dictionary); - //如果字典表新增数据的话,把数据再重新查出,放入监听器中 - List dictionaryEntities = dictionaryService.selectList(new EntityWrapper()); - ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext(); - Map> map = new HashMap<>(); - for(DictionaryEntity d :dictionaryEntities){ - Map m = map.get(d.getDicCode()); - if(m ==null || m.isEmpty()){ - m = new HashMap<>(); - } - m.put(d.getCodeIndex(),d.getIndexName()); - map.put(d.getDicCode(),m); - } - servletContext.setAttribute("dictionaryMap",map); - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody DictionaryEntity dictionary, HttpServletRequest request){ - logger.debug("update方法:,,Controller:{},,dictionary:{}",this.getClass().getName(),dictionary.toString()); - //根据字段查询是否有相同数据 - Wrapper queryWrapper = new EntityWrapper() - .notIn("id",dictionary.getId()) - .eq("dic_code", dictionary.getDicCode()) - .eq("code_index", dictionary.getCodeIndex()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - DictionaryEntity dictionaryEntity = dictionaryService.selectOne(queryWrapper); - if(dictionaryEntity==null){ - // String role = String.valueOf(request.getSession().getAttribute("role")); - // if("".equals(role)){ - // dictionary.set - // } - dictionaryService.updateById(dictionary);//根据id更新 - //如果字典表修改数据的话,把数据再重新查出,放入监听器中 - List dictionaryEntities = dictionaryService.selectList(new EntityWrapper()); - ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext(); - Map> map = new HashMap<>(); - for(DictionaryEntity d :dictionaryEntities){ - Map m = map.get(d.getDicCode()); - if(m ==null || m.isEmpty()){ - m = new HashMap<>(); - } - m.put(d.getCodeIndex(),d.getIndexName()); - map.put(d.getDicCode(),m); - } - servletContext.setAttribute("dictionaryMap",map); - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids){ - logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); - dictionaryService.deleteBatchIds(Arrays.asList(ids)); - return R.ok(); - } - - -} - diff --git a/src/main/java/com/controller/ExpressItem.java b/src/main/java/com/controller/ExpressItem.java deleted file mode 100644 index ad75901..0000000 --- a/src/main/java/com/controller/ExpressItem.java +++ /dev/null @@ -1,164 +0,0 @@ -import java.util.*; - -// 快递实体类(POJO) -class ExpressItem { - private String trackingNumber; // 运单号 - private String recipient; // 收件人 - private String phone; // 联系电话 - private String status; // 包裹状态 - private Date arrivalTime; // 到站时间 - private String pickupCode; // 取件码 - - public ExpressItem(String trackingNumber, String recipient, String phone) { - this.trackingNumber = trackingNumber; - this.recipient = recipient; - this.phone = phone; - this.status = "待取件"; // 默认状态 - this.arrivalTime = new Date(); - this.pickupCode = generatePickupCode(); // 自动生成取件码 - } - - // 生成4位随机取件码(0000-9999) - private String generatePickupCode() { - Random random = new Random(); - return String.format("%04d", random.nextInt(10000)); - } - - // Getter/Setter 区域(省略其他getter/setter) - public String getStatus() { return status; } - public String getPickupCode() { return pickupCode; } - // ...其他getter/setter保持原有结构 - - @Override - public String toString() { - return String.format(""" - 运单号:%s - 收件人:%s - 状态:%s - 取件码:%s - 到达时间:%tF %tT - """, trackingNumber, recipient, status, pickupCode, arrivalTime, arrivalTime); - } -} - -// 快递业务逻辑类 -class ExpressService { - private final Map database = new HashMap<>(); // 内存数据库 - private int totalPackages = 0; // 总入库计数器 - - // 快递入库(返回是否成功) - public boolean addPackage(ExpressItem item) { - if (database.containsKey(item.getTrackingNumber())) return false; // 重复检查 - database.put(item.getTrackingNumber(), item); - totalPackages++; - return true; - } - - // 标记包裹为已取件 - public boolean markAsPickedUp(String trackingNumber) { - ExpressItem item = database.get(trackingNumber); - if (item != null && "待取件".equals(item.getStatus())) { // 双重验证 - item.setStatus("已取件"); - return true; - } - return false; - } - - // 统计方法 - public int getTotalPackages() { return totalPackages; } - public int getPendingPackages() { - return (int) database.values().stream() // 使用流式计算 - .filter(item -> "待取件".equals(item.getStatus())) - .count(); - } -} - -// 控制台交互层 -public class ExpressManagementSystem { - private static final Scanner scanner = new Scanner(System.in); - private static final ExpressService service = new ExpressService(); - - public static void main(String[] args) { - while (true) { - printMenu(); - int choice = getIntInput("请选择操作:"); - - switch (choice) { - case 1 -> addPackage(); - case 2 -> pickupPackage(); - case 3 -> searchPackage(); - case 4 -> showStatistics(); - case 5 -> System.exit(0); - default -> System.out.println("无效输入!"); - } - } - } - - private static void printMenu() { - System.out.println(""" - ===== 快递站管理系统 ===== - 1. 快递入库 - 2. 快递出库 - 3. 查询快递 - 4. 统计信息 - 5. 退出系统 - """); - } - - private static void addPackage() { - System.out.println("\n--- 快递入库 ---"); - String trackingNumber = getNonEmptyInput("请输入运单号:"); - String recipient = getNonEmptyInput("请输入收件人姓名:"); - String phone = getValidPhone(); - - ExpressItem newItem = new ExpressItem(trackingNumber, recipient, phone); - System.out.println(service.addPackage(newItem) - ? "入库成功!\n取件码:" + newItem.getPickupCode() - : "该运单号已存在!"); - } - - private static void pickupPackage() { - System.out.println("\n--- 快递出库 ---"); - String trackingNumber = getNonEmptyInput("请输入运单号:"); - String inputCode = getNonEmptyInput("请输入取件码:"); - - ExpressItem item = service.getPackage(trackingNumber); - if (item == null) { - System.out.println("运单号不存在!"); - return; - } - - System.out.println(inputCode.equals(item.getPickupCode()) - ? service.markAsPickedUp(trackingNumber) - ? "取件成功!" - : "该包裹已取件!" - : "取件码错误!"); - } - - // 辅助方法区域 - private static String getNonEmptyInput(String prompt) { - while (true) { - String input = scanner.nextLine().trim(); - if (!input.isEmpty()) return input; - System.out.print("输入不能为空,请重新输入:"); - } - } - - private static String getValidPhone() { - while (true) { - String phone = scanner.nextLine().trim(); - if (phone.matches("1[3-9]\\d{9}")) return phone; // 中国手机号正则 - System.out.print("手机号格式不正确,请重新输入:"); - } - } - - private static int getIntInput(String prompt) { - while (true) { - try { - return Integer.parseInt(scanner.nextLine().trim()); - } catch (NumberFormatException e) { - System.out.print("请输入有效数字:"); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/controller/ExpressIteml.java b/src/main/java/com/controller/ExpressIteml.java deleted file mode 100644 index 71107e0..0000000 --- a/src/main/java/com/controller/ExpressIteml.java +++ /dev/null @@ -1,261 +0,0 @@ -import java.io.*; -import java.util.*; -import java.util.stream.Collectors; -import com.google.gson.Gson; // 需要gson库支持(添加依赖) - -/** - * 快递实体类增强版 - * 新增:包裹重量、尺寸、存放天数等属性 - */ -class ExpressIteml { - // ... [原有属性保持不变] - private double weight; // 包裹重量(kg) - private Dimension dimension; // 包裹尺寸(cm) - private int storageDays; // 存放天数 - - public ExpressItem(String trackingNumber, String recipient, String phone, - double weight, int length, int width, int height) { - // ... [原有初始化代码] - this.weight = weight; - this.dimension = new Dimension(length, width, height); - this.storageDays = 0; - } - - // 新增内部类:包裹尺寸 - static class Dimension { - int length; - int width; - int height; - - Dimension(int l, int w, int h) { - this.length = l; - this.width = w; - this.height = h; - } - - @Override - public String toString() { - return String.format("%dx%dx%d cm", length, width, height); - } - } - - // 新增业务方法:计算体积重量(航空件常用算法) - public double calculateVolumetricWeight() { - // 体积重量(kg) = 长(cm)*宽(cm)*高(cm)/6000 - return (dimension.length * dimension.width * dimension.height) / 6000.0; - } - - // Getter/Setter 区域(新增属性) - public double getWeight() { return weight; } - public Dimension getDimension() { return dimension; } - public int getStorageDays() { return storageDays; } - public void setStorageDays(int days) { this.storageDays = days; } -} - -/** - * 快递业务逻辑增强版 - * 新增:数据持久化、超时提醒、高级查询等功能 - */ -class ExpressService { - // ... [原有属性保持不变] - private final DataPersistence persistence = new DataPersistence(); - private static final int MAX_STORAGE_DAYS = 7; // 最大免费存放天数 - - public ExpressService() { - // 启动时加载持久化数据 - database = persistence.loadData(); - // 更新所有包裹的存放天数(模拟每日自动更新) - updateStorageDays(); - } - - // 新增方法:更新所有包裹的存放天数 - private void updateStorageDays() { - long today = new Date().getTime() / (24 * 3600 * 1000); - database.values().forEach(item -> { - long arrivalDay = item.getArrivalTime().getTime() / (24 * 3600 * 1000); - item.setStorageDays((int) (today - arrivalDay)); - }); - } - - // 新增方法:获取超时包裹列表 - public List getOverduePackages() { - return database.values().stream() - .filter(item -> item.getStorageDays() > MAX_STORAGE_DAYS) - .collect(Collectors.toList()); - } - - // 新增方法:按体积重量排序查询 - public List searchByVolumetricWeight(double min, double max) { - return database.values().stream() - .filter(item -> { - double volWeight = item.calculateVolumetricWeight(); - return volWeight >= min && volWeight <= max; - }) - .sorted(Comparator.comparingDouble(ExpressItem::calculateVolumetricWeight).reversed()) - .collect(Collectors.toList()); - } - - // 新增方法:批量标记为已取件 - public int batchMarkAsPickedUp(List trackingNumbers) { - return (int) trackingNumbers.stream() - .filter(tn -> { - ExpressItem item = database.get(tn); - return item != null && "待取件".equals(item.getStatus()); - }) - .peek(tn -> database.get(tn).setStatus("已取件")) - .count(); - } - - // 新增方法:获取仓库使用率统计 - public Map getStorageUsage() { - Map usage = new HashMap<>(); - long totalVolume = database.values().stream() - .mapToLong(item -> - item.getDimension().length * - item.getDimension().width * - item.getDimension().height - ).sum(); - - usage.put("totalVolume", (double) totalVolume); - usage.put("averageVolume", totalVolume / (double) database.size()); - return usage; - } - - // 新增方法:数据持久化 - public void saveData() { - persistence.saveData(database); - } -} - -/** - * 数据持久化服务类 - * 使用JSON格式进行数据存储 - */ -class DataPersistence { - private static final String DATA_FILE = "express_data.json"; - private final Gson gson = new Gson(); - - public Map loadData() { - try (Reader reader = new FileReader(DATA_FILE)) { - Type type = new com.google.gson.reflect.TypeToken>() {}.getType(); - return gson.fromJson(reader, type); - } catch (FileNotFoundException e) { - return new HashMap<>(); // 首次运行无数据文件 - } catch (Exception e) { - System.err.println("数据加载错误: " + e.getMessage()); - return new HashMap<>(); - } - } - - public void saveData(Map data) { - try (Writer writer = new FileWriter(DATA_FILE)) { - gson.toJson(data, writer); - } catch (Exception e) { - System.err.println("数据保存错误: " + e.getMessage()); - } - } -} - -/** - * 控制台交互层增强版 - * 新增:超时提醒、批量操作、数据统计等功能 - */ -public class ExpressManagementSystem { - // ... [原有属性保持不变] - private static final ExpressService service = new ExpressService(); - - private static void printAdvancedMenu() { - System.out.println(""" - ===== 高级功能菜单 ===== - 6. 批量取件操作 - 7. 查询超时包裹 - 8. 体积重量查询 - 9. 仓库使用统计 - 10. 保存并退出 - """); - } - - private static void batchPickup() { - System.out.println("\n--- 批量取件 ---"); - List trackingNumbers = new ArrayList<>(); - while (true) { - String tn = getNonEmptyInput("输入运单号(输入0结束):"); - if ("0".equals(tn)) break; - trackingNumbers.add(tn); - } - - int successCount = service.batchMarkAsPickedUp(trackingNumbers); - System.out.printf("成功取件%d个包裹\n", successCount); - } - - private static void showOverduePackages() { - System.out.println("\n--- 超时包裹列表 ---"); - List overdue = service.getOverduePackages(); - if (overdue.isEmpty()) { - System.out.println("当前没有超时包裹"); - return; - } - overdue.forEach(item -> - System.out.printf("运单号:%s 超时%d天\n", - item.getTrackingNumber(), - item.getStorageDays() - ExpressService.MAX_STORAGE_DAYS)); - } - - private static void volumetricSearch() { - System.out.println("\n--- 体积重量查询 ---"); - double min = getDoubleInput("最小体积重量(kg):"); - double max = getDoubleInput("最大体积重量(kg):"); - - List results = service.searchByVolumetricWeight(min, max); - if (results.isEmpty()) { - System.out.println("未找到匹配包裹"); - return; - } - results.forEach(item -> - System.out.printf("运单号:%s 体积重量:%.2fkg\n", - item.getTrackingNumber(), - item.calculateVolumetricWeight())); - } - - private static void showStorageStats() { - System.out.println("\n--- 仓库使用统计 ---"); - Map stats = service.getStorageUsage(); - System.out.printf("总占用体积:%,d cm³\n", stats.get("totalVolume").intValue()); - System.out.printf("平均单件体积:%,.1f cm³\n", stats.get("averageVolume")); - } - - public static void main(String[] args) { - while (true) { - printMenu(); - int choice = getIntInput("请选择操作:"); - - switch (choice) { - case 1 -> addPackage(); - case 2 -> pickupPackage(); - case 3 -> searchPackage(); - case 4 -> showStatistics(); - case 5 -> printAdvancedMenu(); - case 6 -> batchPickup(); - case 7 -> showOverduePackages(); - case 8 -> volumetricSearch(); - case 9 -> showStorageStats(); - case 10 -> { - service.saveData(); - System.exit(0); - } - default -> System.out.println("无效输入!"); - } - } - } - - // 新增方法:获取double类型输入 - private static double getDoubleInput(String prompt) { - while (true) { - try { - return Double.parseDouble(scanner.nextLine().trim()); - } catch (NumberFormatException e) { - System.out.print("请输入有效数字:"); - } - } - } -} \ No newline at end of file diff --git a/src/main/java/com/controller/FileController.java b/src/main/java/com/controller/FileController.java deleted file mode 100644 index 0c32b96..0000000 --- a/src/main/java/com/controller/FileController.java +++ /dev/null @@ -1,83 +0,0 @@ -package com.controller; - -import java.io.File; -import java.io.IOException; -import java.util.Date; - -import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; - -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.entity.ConfigEntity; -import org.apache.commons.io.FileUtils; -import org.apache.commons.io.IOUtils; -import org.apache.commons.lang3.StringUtils; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; -import org.springframework.web.multipart.MultipartFile; - -import com.annotation.IgnoreAuth; -import com.entity.EIException; -import com.service.ConfigService; -import com.utils.R; - -/** - * 上传文件映射表 - */ -@RestController -@RequestMapping("file") -@SuppressWarnings({"unchecked","rawtypes"}) -public class FileController{ - @Autowired - private ConfigService configService; - /** - * 上传文件 - */ - @RequestMapping("/upload") - public R upload(@RequestParam("file") MultipartFile file, String type,HttpServletRequest request) throws Exception { - if (file.isEmpty()) { - throw new EIException("上传文件不能为空"); - } - String fileExt = file.getOriginalFilename().substring(file.getOriginalFilename().lastIndexOf(".")+1); - String fileName = new Date().getTime()+"."+fileExt; - File dest = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName); - file.transferTo(dest); - if(StringUtils.isNotBlank(type) && type.equals("1")) { - ConfigEntity configEntity = configService.selectOne(new EntityWrapper().eq("name", "faceFile")); - if(configEntity==null) { - configEntity = new ConfigEntity(); - configEntity.setName("faceFile"); - configEntity.setValue(fileName); - } else { - configEntity.setValue(fileName); - } - configService.insertOrUpdate(configEntity); - } - return R.ok().put("file", fileName); - } - - /** - * 下载文件 - */ - @IgnoreAuth - @RequestMapping("/download") - public void download(@RequestParam String fileName, HttpServletRequest request, HttpServletResponse response) { - try { - File file = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+fileName); - if (file.exists()) { - response.reset(); - response.setHeader("Content-Disposition", "attachment; filename=\"" + fileName+"\""); - response.setHeader("Cache-Control", "no-cache"); - response.setHeader("Access-Control-Allow-Credentials", "true"); - response.setContentType("application/octet-stream; charset=UTF-8"); - IOUtils.write(FileUtils.readFileToByteArray(file), response.getOutputStream()); - } - - } catch (IOException e) { - e.printStackTrace(); - } - } - -} diff --git a/src/main/java/com/controller/JiedanController.java b/src/main/java/com/controller/JiedanController.java deleted file mode 100644 index 2f327f3..0000000 --- a/src/main/java/com/controller/JiedanController.java +++ /dev/null @@ -1,259 +0,0 @@ -package com.controller; - - -import java.text.SimpleDateFormat; -import com.alibaba.fastjson.JSONObject; -import java.util.*; - -import com.entity.DaiqurenEntity; -import com.entity.YijiedanEntity; -import com.entity.YonghuEntity; -import com.service.*; -import org.springframework.beans.BeanUtils; -import javax.servlet.http.HttpServletRequest; -import org.springframework.web.context.ContextLoader; -import javax.servlet.ServletContext; - -import com.utils.StringUtil; -import java.lang.reflect.InvocationTargetException; - -import org.apache.commons.lang3.StringUtils; -import com.annotation.IgnoreAuth; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.mapper.Wrapper; - -import com.entity.JiedanEntity; - -import com.entity.view.JiedanView; -import com.utils.PageUtils; -import com.utils.R; - -/** - * 快递接单表 - * 后端接口 - * @author - * @email - * @date 2021-03-11 -*/ -@RestController -@Controller -@RequestMapping("/jiedan") -public class JiedanController { - private static final Logger logger = LoggerFactory.getLogger(JiedanController.class); - - @Autowired - private YijiedanService yijiedanService; - - @Autowired - private JiedanService jiedanService; - - @Autowired - private DaiqurenService daiqurenService; - - @Autowired - private YonghuService yonghuService; - - @Autowired - private DictionaryService dictionaryService; - - - //级联表service - - - /** - * 后端列表 - */ - @RequestMapping("/page") - public R page(@RequestParam Map params, HttpServletRequest request){ - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); - String role = String.valueOf(request.getSession().getAttribute("role")); - PageUtils page = null; - if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ - params.put("yonghuId",request.getSession().getAttribute("userId")); - page = jiedanService.queryPage(params); - } - page = jiedanService.queryPage(params); - //字典表数据转换 - List list =(List)page.getList(); - for(JiedanView c:list){ - //修改对应字典表字段 - dictionaryService.dictionaryConvert(c); - } - return R.ok().put("data", page); - } - /** - * 后端详情 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Long id){ - logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); - JiedanEntity jiedan = jiedanService.selectById(id); - if(jiedan !=null){ - //entity转view - JiedanView view = new JiedanView(); - BeanUtils.copyProperties( jiedan , view );//把实体数据重构到view中 - //修改对应字典表字段 - dictionaryService.dictionaryConvert(view); - return R.ok().put("data", view); - }else { - return R.error(511,"查不到数据"); - } - - } - - /** - * 后端保存 - */ - @RequestMapping("/save") - public R save(@RequestBody JiedanEntity jiedan, HttpServletRequest request){ - logger.debug("save方法:,,Controller:{},,jiedan:{}",this.getClass().getName(),jiedan.toString()); - Wrapper queryWrapper = new EntityWrapper() - .eq("addresseename", jiedan.getAddresseename()) - .eq("jdphone", jiedan.getJdphone()) - .eq("jdaddressee", jiedan.getJdaddressee()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper); - if(jiedanEntity==null){ - jiedanService.insert(jiedan); - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody JiedanEntity jiedan, HttpServletRequest request){ - logger.debug("update方法:,,Controller:{},,jiedan:{}",this.getClass().getName(),jiedan.toString()); - //根据字段查询是否有相同数据 - Wrapper queryWrapper = new EntityWrapper() - .notIn("id",jiedan.getId()) - .eq("odd", jiedan.getOdd()) - .eq("daiqukuaidimc", jiedan.getDaiqukuaidimc()) - .eq("jdyonghu_id", jiedan.getJdyonghuId()) - .eq("addresseename", jiedan.getAddresseename()) - .eq("jdphone", jiedan.getJdphone()) - .eq("jdaddressee", jiedan.getJdaddressee()) - .eq("jdtakecode", jiedan.getJdtakecode()) - .eq("jdzt_types", jiedan.getJdztTypes()) - .eq("kdlx_types", jiedan.getKdlxTypes()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper); - jiedan.setInitiateTime(new Date()); - if(jiedanEntity==null){ - jiedanService.updateById(jiedan);//根据id更新 - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - - - /** - * 接单 - */ - @RequestMapping("/receiving") - public R receiving(@RequestBody Integer ids, HttpServletRequest request){ - JiedanEntity jiedan = jiedanService.selectById(ids); - if(jiedan == null){ - return R.error(); - } - if(request.getSession().getAttribute("role").equals("代取人")){ - DaiqurenEntity userId = daiqurenService.selectById((Integer) request.getSession().getAttribute("userId")); - - jiedan.setJdztTypes(2);//以接 - YijiedanEntity yijiedan = new YijiedanEntity(); - yijiedan.setOdd(jiedan.getOdd()); - yijiedan.setYonghuId(jiedan.getJdyonghuId()); - yijiedan.setFbphone(jiedan.getJdphone()); - yijiedan.setDaiqurenId(userId.getId()); - yijiedan.setJdphone(userId.getPhone()); - yijiedan.setInitiateTime(new Date()); - yijiedan.setDdztTypes(1);//1正在路上 - - Wrapper queryWrapper = new EntityWrapper() - .eq("odd", yijiedan.getOdd()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper); - if(yijiedanEntity==null){ - jiedanService.updateById(jiedan); - yijiedanService.insert(yijiedan); - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - return R.error("***"); - } - - - /** - * 删除 - */ - @RequestMapping("/ship") - public R ship(String name, Integer yh, Integer dx, HttpServletRequest request){ - if(name == null && name == "null" && name == ""){ - return R.error("快递名称不能为空"); - } - if(yh == null && yh == 0){ - return R.error("收件人不能为空"); - } - - YonghuEntity yonghu = yonghuService.selectById(yh); - if(yonghu == null){ - return R.error(); - } - if(yonghu.getId() == (Integer)request.getSession().getAttribute("userId")){ - return R.error("发件人和收件人不能相同"); - } - JiedanEntity jiedan = new JiedanEntity(); - jiedan.setOdd(String.valueOf(new Date().getTime())); - jiedan.setDaiqukuaidimc(name); - jiedan.setDx(dx); - jiedan.setJdyonghuId((Integer)request.getSession().getAttribute("userId")); - jiedan.setJdphone(yonghu.getPhone()); - jiedan.setInitiateTime(new Date()); - jiedan.setAddresseename(yonghu.getName()); - jiedan.setJdaddressee("住宿楼栋:"+yonghu.getDormitory()+" ,寝室号:"+yonghu.getDormitory()); - jiedan.setJdtakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6)); - jiedan.setJdztTypes(1);//1未接 - jiedan.setKdlxTypes(2);//2寄件 - Wrapper queryWrapper = new EntityWrapper() - .eq("addresseename", jiedan.getAddresseename()) - .eq("jdphone", jiedan.getJdphone()) - .eq("jdaddressee", jiedan.getJdaddressee()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - JiedanEntity jiedanEntity = jiedanService.selectOne(queryWrapper); - if(jiedanEntity==null){ - jiedanService.insert(jiedan); - return R.ok(); - }else { - return R.error(511,"已经有相同的数据了"); - } - } - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids){ - logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); - jiedanService.deleteBatchIds(Arrays.asList(ids)); - return R.ok(); - } - - -} - diff --git a/src/main/java/com/controller/OverduePackageService.java b/src/main/java/com/controller/OverduePackageService.java deleted file mode 100644 index 01fcf63..0000000 --- a/src/main/java/com/controller/OverduePackageService.java +++ /dev/null @@ -1,235 +0,0 @@ -import java.text.SimpleDateFormat; -import java.util.*; -import java.util.stream.Collectors; - -/** - * 滞留件管理服务类 - * 核心功能:滞留件检测、通知管理、超时处理、统计分析 - */ -public class OverduePackageService { - // 配置参数(可通过配置文件加载) - private static final int MAX_FREE_DAYS = 7; // 最大免费存放天数 - private static final double DAILY_STORAGE_FEE = 1.0; // 每日滞留费用(元) - private static final int NOTICE_INTERVAL = 3; // 提醒间隔天数 - - // 依赖服务注入 - private final ExpressService expressService; - private final NotificationService notificationService; - - // 内部状态管理 - private final Map overdueRecords = new HashMap<>(); - private final SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm"); - - /** - * 构造函数(依赖注入模式) - */ - public OverduePackageService(ExpressService expressService, - NotificationService notificationService) { - this.expressService = expressService; - this.notificationService = notificationService; - initializeOverdueMonitoring(); - } - - /** - * 初始化滞留件监控线程 - */ - private void initializeOverdueMonitoring() { - // 创建定时任务(每24小时执行一次检测) - Timer timer = new Timer(true); - timer.scheduleAtFixedRate(new TimerTask() { - @Override - public void run() { - detectAndProcessOverduePackages(); - } - }, 0, 24 * 60 * 60 * 1000); - } - - /** - * 滞留件检测与处理主逻辑 - */ - public synchronized void detectAndProcessOverduePackages() { - // 1. 获取所有待取件包裹 - List allPackages = expressService.getAllPackages() - .stream() - .filter(item -> "待取件".equals(item.getStatus())) - .collect(Collectors.toList()); - - // 2. 计算存放天数并识别滞留件 - List overduePackages = new ArrayList<>(); - for (ExpressItem item : allPackages) { - int storageDays = calculateStorageDays(item.getArrivalTime()); - item.setStorageDays(storageDays); - - if (storageDays > MAX_FREE_DAYS) { - overduePackages.add(item); - recordOverdueHistory(item, storageDays); - } - } - - // 3. 执行滞留处理流程 - overduePackages.forEach(this::processOverduePackage); - } - - /** - * 计算包裹存放天数(精确到小时) - */ - private int calculateStorageDays(Date arrivalTime) { - long now = System.currentTimeMillis(); - long elapsed = now - arrivalTime.getTime(); - return (int) (elapsed / (24 * 3600 * 1000)); - } - - /** - * 记录滞留历史(防重复处理) - */ - private void recordOverdueHistory(ExpressItem item, int currentDays) { - String trackingNumber = item.getTrackingNumber(); - overdueRecords.putIfAbsent(trackingNumber, new OverdueRecord()); - - OverdueRecord record = overdueRecords.get(trackingNumber); - if (record.getLastNoticeDay() == 0 || - (currentDays - record.getLastNoticeDay()) >= NOTICE_INTERVAL) { - - record.setLastNoticeDay(currentDays); - record.incrementNoticeCount(); - } - } - - /** - * 单个滞留件处理流程 - */ - private void processOverduePackage(ExpressItem item) { - // 1. 费用计算 - double overdueFee = calculateOverdueFee(item.getStorageDays()); - - // 2. 生成通知内容 - String noticeContent = buildNoticeContent(item, overdueFee); - - // 3. 发送通知(支持多通道) - sendMultiChannelNotice(item.getPhone(), noticeContent); - - // 4. 标记为滞留状态(可选扩展) - if (item.getStorageDays() > MAX_FREE_DAYS * 2) { - expressService.markAsOverdue(item.getTrackingNumber()); - } - } - - /** - * 计算滞留费用(简单线性计费) - */ - private double calculateOverdueFee(int storageDays) { - int overdueDays = storageDays - MAX_FREE_DAYS; - return overdueDays > 0 ? overdueDays * DAILY_STORAGE_FEE : 0; - } - - /** - * 构建多格式通知内容 - */ - private String buildNoticeContent(ExpressItem item, double fee) { - return String.format(""" - 【快递滞留提醒】 - 运单号:%s - 收件人:%s - 滞留天数:%d天 - 当前费用:%.2f元 - 请尽快取件避免额外费用! - """, - item.getTrackingNumber(), - item.getRecipient(), - item.getStorageDays(), - fee); - } - - /** - * 多通道通知发送(短信+邮件+系统消息) - */ - private void sendMultiChannelNotice(String phone, String content) { - // 短信通知 - notificationService.sendSMS(phone, content); - - // 邮件通知(需实现邮件服务) - // notificationService.sendEmail(recipientEmail, "快递滞留提醒", content); - - // 系统内消息(需集成消息中心) - // messageCenter.pushSystemNotice(userId, content); - } - - /** - * 滞留件统计报表生成 - */ - public String generateOverdueReport() { - Map dailyCount = overdueRecords.values().stream() - .collect(Collectors.groupingBy( - OverdueRecord::getNoticeCount, - Collectors.counting() - )); - - StringBuilder report = new StringBuilder(); - report.append("===== 滞留件统计报表 =====\n"); - report.append("统计时间:").append(dateFormat.format(new Date())).append("\n"); - report.append("-------------------------\n"); - report.append("总滞留包裹数:").append(overdueRecords.size()).append("\n"); - - dailyCount.forEach((times, count) -> - report.append(String.format("被提醒%d次包裹数:%d\n", times, count))); - - return report.toString(); - } - - /** - * 滞留记录实体类 - */ - private static class OverdueRecord { - private int lastNoticeDay; // 最后一次通知时的存放天数 - private int noticeCount; // 通知发送次数 - - // Getter/Setter - public int getLastNoticeDay() { return lastNoticeDay; } - public void setLastNoticeDay(int day) { this.lastNoticeDay = day; } - public int getNoticeCount() { return noticeCount; } - public void incrementNoticeCount() { this.noticeCount++; } - } - - /** - * 通知服务接口(需具体实现) - */ - public interface NotificationService { - void sendSMS(String phone, String message); - // void sendEmail(String to, String subject, String content); - } - - /** - * 滞留件查询服务 - */ - public List queryOverduePackages(int minDays, int maxDays) { - return expressService.getAllPackages().stream() - .filter(item -> { - int days = item.getStorageDays(); - return days >= minDays && days <= maxDays; - }) - .sorted(Comparator.comparingInt(ExpressItem::getStorageDays).reversed()) - .collect(Collectors.toList()); - } - - /** - * 批量处理滞留件(自动退回) - */ - public int batchReturnOverduePackages(int maxDays) { - List toReturn = queryOverduePackages(maxDays, Integer.MAX_VALUE); - toReturn.forEach(item -> expressService.markAsReturned(item.getTrackingNumber())); - return toReturn.size(); - } - - /** - * 滞留费用明细查询 - */ - public Map getOverdueFees(String trackingNumber) { - OverdueRecord record = overdueRecords.get(trackingNumber); - if (record == null) return Collections.emptyMap(); - - Map feeDetail = new HashMap<>(); - feeDetail.put("baseFee", (double) (record.getNoticeCount() * NOTICE_INTERVAL)); - feeDetail.put("totalFee", calculateOverdueFee(record.getNoticeCount() * NOTICE_INTERVAL)); - return feeDetail; - } -} \ No newline at end of file diff --git a/src/main/java/com/controller/PickupCodeService.java b/src/main/java/com/controller/PickupCodeService.java deleted file mode 100644 index 8603ba6..0000000 --- a/src/main/java/com/controller/PickupCodeService.java +++ /dev/null @@ -1,301 +0,0 @@ -import java.security.*; -import java.util.*; -import java.util.concurrent.*; -import java.util.stream.Collectors; - -/** - * 取件码管理服务类 - * 核心功能:生成/验证/查询取件码、安全控制、过期处理、审计日志 - */ -public class PickupCodeService { - // 配置参数(建议通过配置中心动态加载) - private static final int CODE_LENGTH = 6; // 取件码长度 - private static final int MAX_ATTEMPTS = 3; // 最大尝试次数 - private static final long EXPIRATION_TIME = 24 * 3600; // 有效期(秒) - private static final int CLEANUP_INTERVAL = 60 * 60; // 清理线程间隔(秒) - - // 依赖服务注入 - private final ExpressService expressService; - private final SecureRandom secureRandom; - private final ScheduledExecutorService cleanupScheduler; - - // 核心数据存储(内存数据库,实际应使用Redis等持久化存储) - private final Map codeDatabase = new ConcurrentHashMap<>(); - private final Map attemptCounter = new ConcurrentHashMap<>(); - - /** - * 构造函数(依赖注入模式) - */ - public PickupCodeService(ExpressService expressService) { - this.expressService = expressService; - this.secureRandom = new SecureRandom(); - this.cleanupScheduler = Executors.newSingleThreadScheduledExecutor(); - initializeCleanupTask(); - } - - /** - * 初始化自动清理任务 - */ - private void initializeCleanupTask() { - cleanupScheduler.scheduleAtFixedRate(() -> { - long now = System.currentTimeMillis(); - codeDatabase.entrySet().removeIf(entry -> - entry.getValue().getExpirationTime() < now); - }, CLEANUP_INTERVAL, CLEANUP_INTERVAL, TimeUnit.SECONDS); - } - - /** - * 生成取件码(核心算法) - * @param trackingNumber 关联运单号 - * @return 生成的取件码对象 - * @throws CodeGenerationException 当生成失败时抛出 - */ - public PickupCode generatePickupCode(String trackingNumber) - throws CodeGenerationException { - // 1. 参数验证 - if (!expressService.packageExists(trackingNumber)) { - throw new CodeGenerationException("包裹不存在"); - } - - // 2. 生成唯一码(时间戳+随机数+包裹哈希) - String baseCode = String.format("%d%06d", - System.currentTimeMillis() % 1000000, - secureRandom.nextInt(999999)); - - String hashedCode = hashCode(baseCode + trackingNumber); - String formattedCode = String.format("%s-%s", - hashedCode.substring(0, 3), - hashedCode.substring(3, 6)); - - // 3. 创建记录对象 - PickupCodeRecord record = new PickupCodeRecord( - formattedCode, - trackingNumber, - System.currentTimeMillis() + EXPIRATION_TIME * 1000 - ); - - // 4. 防重存储(CAS操作保证原子性) - codeDatabase.putIfAbsent(formattedCode, record); - return new PickupCode(formattedCode, record.getExpirationTime()); - } - - /** - * 取件码验证(核心安全流程) - * @param inputCode 用户输入的取件码 - * @param phone 用户手机号(二次验证) - * @return 验证结果对象 - */ - public ValidationResult validatePickupCode(String inputCode, String phone) - throws InvalidCodeException { - // 1. 格式预校验 - if (!inputCode.matches("\\d{3}-\\d{3}")) { - throw new InvalidCodeException("格式错误"); - } - - // 2. 防暴力破解计数器 - attemptCounter.merge(phone, 1, Integer::sum); - if (attemptCounter.get(phone) > MAX_ATTEMPTS) { - throw new InvalidCodeException("尝试次数过多,请1小时后重试"); - } - - // 3. 核心验证逻辑 - PickupCodeRecord record = codeDatabase.get(inputCode); - if (record == null) { - throw new InvalidCodeException("无效取件码"); - } - - if (record.isExpired()) { - throw new InvalidCodeException("取件码已过期"); - } - - if (!record.getTrackingNumber().equals( - expressService.getPackageByPhone(phone).getTrackingNumber())) { - - throw new InvalidCodeException("取件码与包裹不匹配"); - } - - // 4. 验证成功后清理计数器 - attemptCounter.remove(phone); - return new ValidationResult(true, record.getTrackingNumber()); - } - - /** - * 取件码哈希算法(防逆向) - */ - private String hashCode(String input) { - try { - MessageDigest md = MessageDigest.getInstance("SHA-256"); - byte[] hashBytes = md.digest(input.getBytes()); - return bytesToHex(hashBytes).substring(0, CODE_LENGTH); - } catch (NoSuchAlgorithmException e) { - throw new RuntimeException("哈希算法不可用", e); - } - } - - /** - * 字节数组转十六进制字符串 - */ - private String bytesToHex(byte[] bytes) { - StringBuilder hexString = new StringBuilder(); - for (byte b : bytes) { - String hex = Integer.toHexString(0xff & b); - if (hex.length() == 1) { - hexString.append('0'); - } - hexString.append(hex); - } - return hexString.toString(); - } - - /** - * 查询取件码信息 - */ - public Optional queryCodeInfo(String code) { - PickupCodeRecord record = codeDatabase.get(code); - if (record == null) return Optional.empty(); - - ExpressItem item = expressService.getPackage(record.getTrackingNumber()); - return Optional.of(new PickupCodeInfo( - code, - item.getRecipient(), - item.getPhone(), - new Date(record.getExpirationTime()), - record.isUsed() - )); - } - - /** - * 标记取件码为已使用 - */ - public void markCodeAsUsed(String code) { - PickupCodeRecord record = codeDatabase.get(code); - if (record != null) { - record.setUsed(true); - } - } - - /** - * 批量生成取件码(用于测试) - */ - public List batchGenerateCodes(int quantity) - throws CodeGenerationException { - return IntStream.range(0, quantity) - .mapToObj(i -> { - try { - return generatePickupCode(generateTrackingNumber()); - } catch (CodeGenerationException e) { - throw new RuntimeException(e); - } - }) - .collect(Collectors.toList()); - } - - /** - * 模拟生成测试运单号 - */ - private String generateTrackingNumber() { - return "TEST" + System.currentTimeMillis() % 1000000; - } - - /** - * 取件码实体类 - */ - public static class PickupCode { - private final String code; - private final long expirationTime; - - PickupCode(String code, long expirationTime) { - this.code = code; - this.expirationTime = expirationTime; - } - - // Getter方法 - public String getCode() { return code; } - public long getExpirationTime() { return expirationTime; } - } - - /** - * 验证结果封装类 - */ - public static class ValidationResult { - private final boolean valid; - private final String trackingNumber; - - ValidationResult(boolean valid, String trackingNumber) { - this.valid = valid; - this.trackingNumber = trackingNumber; - } - - // Getter方法 - public boolean isValid() { return valid; } - public String getTrackingNumber() { return trackingNumber; } - } - - /** - * 取件码信息查询结果类 - */ - public static class PickupCodeInfo { - private final String code; - private final String recipient; - private final String phone; - private final Date expiration; - private final boolean used; - - PickupCodeInfo(String code, String recipient, String phone, - Date expiration, boolean used) { - this.code = code; - this.recipient = recipient; - this.phone = phone; - this.expiration = expiration; - this.used = used; - } - - // Getter方法 - public String getCode() { return code; } - public String getRecipient() { return recipient; } - public String getPhone() { return phone; } - public Date getExpiration() { return expiration; } - public boolean isUsed() { return used; } - } - - /** - * 自定义异常类 - */ - public static class CodeGenerationException extends Exception { - public CodeGenerationException(String message) { - super(message); - } - } - - public static class InvalidCodeException extends Exception { - public InvalidCodeException(String message) { - super(message); - } - } - - /** - * 取件码记录实体(内存存储) - */ - private static class PickupCodeRecord { - private final String code; - private final String trackingNumber; - private final long expirationTime; - private boolean used = false; - - PickupCodeRecord(String code, String trackingNumber, long expirationTime) { - this.code = code; - this.trackingNumber = trackingNumber; - this.expirationTime = expirationTime; - } - - // Getter/Setter - public String getCode() { return code; } - public String getTrackingNumber() { return trackingNumber; } - public long getExpirationTime() { return expirationTime; } - public boolean isExpired() { - return System.currentTimeMillis() > expirationTime; - } - public boolean isUsed() { return used; } - public void setUsed(boolean used) { this.used = used; } - } -} \ No newline at end of file diff --git a/src/main/java/com/controller/UserController.java b/src/main/java/com/controller/UserController.java deleted file mode 100644 index 51ff5db..0000000 --- a/src/main/java/com/controller/UserController.java +++ /dev/null @@ -1,178 +0,0 @@ - -package com.controller; - - -import java.util.Arrays; -import java.util.Calendar; -import java.util.Date; -import java.util.Map; - -import javax.servlet.http.HttpServletRequest; - -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.PathVariable; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.bind.annotation.RestController; - -import com.annotation.IgnoreAuth; -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.entity.TokenEntity; -import com.entity.UserEntity; -import com.service.TokenService; -import com.service.UserService; -import com.utils.CommonUtil; -import com.utils.MPUtil; -import com.utils.PageUtils; -import com.utils.R; -import com.utils.ValidatorUtils; - -/** - * 登录相关 - */ -@RequestMapping("users") -@RestController -public class UserController{ - - @Autowired - private UserService userService; - - @Autowired - private TokenService tokenService; - - /** - * 登录 - */ - @IgnoreAuth - @PostMapping(value = "/login") - public R login(String username, String password, String role, HttpServletRequest request) { - UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); - if(user != null){ - if(!user.getRole().equals(role)){ - return R.error("权限不正常"); - } - if(user==null || !user.getPassword().equals(password)) { - return R.error("账号或密码不正确"); - } - String token = tokenService.generateToken(user.getId(),username, "users", user.getRole()); - return R.ok().put("token", token); - }else{ - return R.error("账号或密码或权限不对"); - } - - } - - /** - * 注册 - */ - @IgnoreAuth - @PostMapping(value = "/register") - public R register(@RequestBody UserEntity user){ -// ValidatorUtils.validateEntity(user); - if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { - return R.error("用户已存在"); - } - userService.insert(user); - return R.ok(); - } - - /** - * 退出 - */ - @GetMapping(value = "logout") - public R logout(HttpServletRequest request) { - request.getSession().invalidate(); - return R.ok("退出成功"); - } - - /** - * 密码重置 - */ - @IgnoreAuth - @RequestMapping(value = "/resetPass") - public R resetPass(String username, HttpServletRequest request){ - UserEntity user = userService.selectOne(new EntityWrapper().eq("username", username)); - if(user==null) { - return R.error("账号不存在"); - } - user.setPassword("123456"); - userService.update(user,null); - return R.ok("密码已重置为:123456"); - } - - /** - * 列表 - */ - @RequestMapping("/page") - public R page(@RequestParam Map params,UserEntity user){ - EntityWrapper ew = new EntityWrapper(); - PageUtils page = userService.queryPage(params, MPUtil.sort(MPUtil.between(MPUtil.allLike(ew, user), params), params)); - return R.ok().put("data", page); - } - - /** - * 列表 - */ - @RequestMapping("/list") - public R list( UserEntity user){ - EntityWrapper ew = new EntityWrapper(); - ew.allEq(MPUtil.allEQMapPre( user, "user")); - return R.ok().put("data", userService.selectListView(ew)); - } - - /** - * 信息 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") String id){ - UserEntity user = userService.selectById(id); - return R.ok().put("data", user); - } - - /** - * 获取用户的session用户信息 - */ - @RequestMapping("/session") - public R getCurrUser(HttpServletRequest request){ - Integer id = (Integer)request.getSession().getAttribute("userId"); - UserEntity user = userService.selectById(id); - return R.ok().put("data", user); - } - - /** - * 保存 - */ - @PostMapping("/save") - public R save(@RequestBody UserEntity user){ -// ValidatorUtils.validateEntity(user); - if(userService.selectOne(new EntityWrapper().eq("username", user.getUsername())) !=null) { - return R.error("用户已存在"); - } - userService.insert(user); - return R.ok(); - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody UserEntity user){ -// ValidatorUtils.validateEntity(user); - userService.updateById(user);//全部更新 - return R.ok(); - } - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids){ - userService.deleteBatchIds(Arrays.asList(ids)); - return R.ok(); - } -} diff --git a/src/main/java/com/controller/UserManagementService.java b/src/main/java/com/controller/UserManagementService.java deleted file mode 100644 index a5b0475..0000000 --- a/src/main/java/com/controller/UserManagementService.java +++ /dev/null @@ -1,263 +0,0 @@ -import java.security.*; -import java.util.*; -import java.util.regex.*; -import javax.crypto.*; -import javax.crypto.spec.SecretKeySpec; - -/** - * 用户管理服务类 - * 实现功能:用户注册/登录、角色权限管理、密码安全、会话管理 - */ -class UserManagementService { - // 内存存储结构(实际项目应使用数据库) - private final Map userDatabase = new HashMap<>(); - private final Map activeSessions = new HashMap<>(); - private static final String SECRET_KEY = "express@Sys#Key2025"; // 加密密钥(生产环境应存储在安全配置) - - /** - * 用户注册 - * @param username 用户名(4-16位字母数字) - * @param password 明文密码(需符合复杂度要求) - * @param role 用户角色(admin/staff/customer) - * @return 注册结果 - */ - public RegistrationResult registerUser(String username, String password, String role) - throws NoSuchAlgorithmException, InvalidKeySpecException { - - // 1. 参数验证 - if (!isValidUsername(username)) { - return new RegistrationResult(false, "用户名需为4-16位字母数字"); - } - if (userDatabase.containsKey(username)) { - return new RegistrationResult(false, "用户名已存在"); - } - if (!isValidPassword(password)) { - return new RegistrationResult(false, "密码需包含大小写字母和数字,至少8位"); - } - if (!isValidRole(role)) { - return new RegistrationResult(false, "无效角色类型"); - } - - // 2. 密码加密处理 - String salt = generateSalt(); - String hashedPwd = hashPassword(password, salt); - - // 3. 创建用户对象 - User newUser = new User(username, hashedPwd, salt, role); - userDatabase.put(username, newUser); - return new RegistrationResult(true, "注册成功", newUser); - } - - /** - * 用户登录认证 - * @param username 用户名 - * @param password 明文密码 - * @return 认证结果(含会话令牌) - */ - public AuthenticationResult authenticate(String username, String password) - throws NoSuchAlgorithmException, InvalidKeySpecException { - - User user = userDatabase.get(username); - if (user == null) { - return new AuthenticationResult(false, "用户不存在"); - } - - // 验证密码 - String testHash = hashPassword(password, user.getSalt()); - if (!testHash.equals(user.getHashedPassword())) { - return new AuthenticationResult(false, "密码错误"); - } - - // 生成会话令牌(JWT风格) - String token = generateSessionToken(username); - activeSessions.put(token, new Session(token, username, new Date())); - - return new AuthenticationResult(true, "认证成功", token); - } - - /** - * 密码复杂度验证 - * @param password 待验证密码 - * @return 是否符合复杂度要求 - */ - private boolean isValidPassword(String password) { - if (password.length() < 8) return false; - - boolean hasUpper = false, hasLower = false, hasDigit = false; - for (char c : password.toCharArray()) { - if (Character.isUpperCase(c)) hasUpper = true; - else if (Character.isLowerCase(c)) hasLower = true; - else if (Character.isDigit(c)) hasDigit = true; - } - return hasUpper && hasLower && hasDigit; - } - - /** - * 生成加密盐值(16字节随机数) - */ - private String generateSalt() { - SecureRandom random = new SecureRandom(); - byte[] salt = new byte[16]; - random.nextBytes(salt); - return Base64.getEncoder().encodeToString(salt); - } - - /** - * PBKDF2密码哈希算法 - */ - private String hashPassword(String password, String salt) - throws NoSuchAlgorithmException, InvalidKeySpecException { - - int iterations = 10000; - int keyLength = 256; - char[] passwordChars = password.toCharArray(); - byte[] saltBytes = Base64.getDecoder().decode(salt); - - PBEKeySpec spec = new PBEKeySpec(passwordChars, saltBytes, iterations, keyLength); - SecretKeyFactory skf = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); - byte[] hash = skf.generateSecret(spec).getEncoded(); - - return String.format("%d$%s$%s", - iterations, - Base64.getEncoder().encodeToString(saltBytes), - Base64.getEncoder().encodeToString(hash)); - } - - /** - * 会话令牌生成(HMAC-SHA256) - */ - private String generateSessionToken(String username) { - try { - Mac sha256_HMAC = Mac.getInstance("HmacSHA256"); - SecretKeySpec secret_key = new SecretKeySpec(SECRET_KEY.getBytes(), "HmacSHA256"); - sha256_HMAC.init(secret_key); - - String baseString = username + new Date().getTime(); - return Base64.getEncoder().encodeToString( - sha256_HMAC.doFinal(baseString.getBytes()) - ); - } catch (Exception e) { - throw new RuntimeException("令牌生成失败", e); - } - } - - /** - * 用户角色验证装饰器 - * @param requiredRole 所需权限等级 - */ - public static class RoleValidator { - private final String currentRole; - - public RoleValidator(String sessionToken) { - // 实际应从会话中获取用户角色 - this.currentRole = "customer"; // 示例值 - } - - public void validate(String requiredRole) throws InsufficientPermissionsException { - if (!currentRole.equals(requiredRole)) { - throw new InsufficientPermissionsException( - String.format("需要%s权限,当前角色:%s", requiredRole, currentRole)); - } - } - } - - /** - * 用户实体类 - */ - static class User { - private final String username; - private final String hashedPassword; - private final String salt; - private final String role; - - User(String username, String hashedPassword, String salt, String role) { - this.username = username; - this.hashedPassword = hashedPassword; - this.salt = salt; - this.role = role; - } - - // Getter方法(根据安全需求限制访问) - public String getUsername() { return username; } - public String getHashedPassword() { return hashedPassword; } - public String getSalt() { return salt; } - public String getRole() { return role; } - } - - /** - * 会话管理类 - */ - static class Session { - private final String token; - private final String username; - private final Date createdAt; - - Session(String token, String username, Date createdAt) { - this.token = token; - this.username = username; - this.createdAt = createdAt; - } - - // Getter方法 - public String getToken() { return token; } - public String getUsername() { return username; } - public Date getCreatedAt() { return createdAt; } - } - - /** - * 注册结果封装类 - */ - static class RegistrationResult { - private final boolean success; - private final String message; - private final User user; - - RegistrationResult(boolean success, String message) { - this(success, message, null); - } - - RegistrationResult(boolean success, String message, User user) { - this.success = success; - this.message = message; - this.user = user; - } - - // Getter方法 - public boolean isSuccess() { return success; } - public String getMessage() { return message; } - public User getUser() { return user; } - } - - /** - * 认证结果封装类 - */ - static class AuthenticationResult { - private final boolean success; - private final String message; - private final String token; - - AuthenticationResult(boolean success, String message) { - this(success, message, null); - } - - AuthenticationResult(boolean success, String message, String token) { - this.success = success; - this.message = message; - this.token = token; - } - - // Getter方法 - public boolean isSuccess() { return success; } - public String getMessage() { return message; } - public String getToken() { return token; } - } - - /** - * 权限不足异常 - */ - static class InsufficientPermissionsException extends SecurityException { - public InsufficientPermissionsException(String message) { - super(message); - } - } -} \ No newline at end of file diff --git a/src/main/java/com/controller/YijiedanController.java b/src/main/java/com/controller/YijiedanController.java deleted file mode 100644 index 4d11efe..0000000 --- a/src/main/java/com/controller/YijiedanController.java +++ /dev/null @@ -1,246 +0,0 @@ -package com.controller; - - -import java.text.SimpleDateFormat; -import com.alibaba.fastjson.JSONObject; -import java.util.*; - -import com.entity.*; -import com.service.*; -import org.springframework.beans.BeanUtils; -import javax.servlet.http.HttpServletRequest; -import org.springframework.web.context.ContextLoader; -import javax.servlet.ServletContext; - -import com.utils.StringUtil; -import java.lang.reflect.InvocationTargetException; - -import org.apache.commons.lang3.StringUtils; -import com.annotation.IgnoreAuth; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.mapper.Wrapper; - -import com.entity.view.YijiedanView; -import com.utils.PageUtils; -import com.utils.R; - -/** - * 已接单表 - * 后端接口 - * @author - * @email - * @date 2021-03-11 -*/ -@RestController -@Controller -@RequestMapping("/yijiedan") -public class YijiedanController { - private static final Logger logger = LoggerFactory.getLogger(YijiedanController.class); - - @Autowired - private YijiedanService yijiedanService; - - @Autowired - private JiedanService jiedanService; - - @Autowired - private DictionaryService dictionaryService; - - @Autowired - private DaiquService daiquService; - - //级联表service - @Autowired - private DaiqurenService daiqurenService; - - @Autowired - private YonghuService yonghuService; - - - @Autowired - private ZhandianService zhandianService; - - /** - * 后端列表 - */ - @RequestMapping("/page") - public R page(@RequestParam Map params, HttpServletRequest request){ - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); - String role = String.valueOf(request.getSession().getAttribute("role")); - PageUtils page = null; - if(StringUtil.isNotEmpty(role) && "用户".equals(role)){ - params.put("yonghuId",request.getSession().getAttribute("userId")); - page = yijiedanService.queryPage(params); - }else if(StringUtil.isNotEmpty(role) && "代取人".equals(role)){ - params.put("daiqurenId",request.getSession().getAttribute("userId")); - page = yijiedanService.queryPage(params); - } - page = yijiedanService.queryPage(params); - - //字典表数据转换 - List list =(List)page.getList(); - for(YijiedanView c:list){ - //修改对应字典表字段 - dictionaryService.dictionaryConvert(c); - } - return R.ok().put("data", page); - } - /** - * 后端详情 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Long id){ - logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); - YijiedanEntity yijiedan = yijiedanService.selectById(id); - if(yijiedan !=null){ - //entity转view - YijiedanView view = new YijiedanView(); - BeanUtils.copyProperties( yijiedan , view );//把实体数据重构到view中 - - //级联表 - DaiqurenEntity daiquren = daiqurenService.selectById(yijiedan.getDaiqurenId()); - if(daiquren != null){ - view.setDaiqurenId(daiquren.getId()); - view.setYhname(daiquren.getName()); - } - //级联表 - YonghuEntity yonghu = yonghuService.selectById(yijiedan.getYonghuId()); - if(yonghu != null){ - BeanUtils.copyProperties( yonghu , view ,new String[]{ "id", "createDate"});//把级联的数据添加到view中,并排除id和创建时间字段 - view.setYonghuId(yonghu.getId()); - } - //修改对应字典表字段 - dictionaryService.dictionaryConvert(view); - return R.ok().put("data", view); - }else { - return R.error(511,"查不到数据"); - } - - } - - /** - * 后端保存 - */ - @RequestMapping("/save") - public R save(@RequestBody YijiedanEntity yijiedan, HttpServletRequest request){ - logger.debug("save方法:,,Controller:{},,yijiedan:{}",this.getClass().getName(),yijiedan.toString()); - Wrapper queryWrapper = new EntityWrapper() - .eq("odd", yijiedan.getOdd()) - .eq("yonghu_id", yijiedan.getYonghuId()) - .eq("fbphone", yijiedan.getFbphone()) - .eq("daiquren_id", yijiedan.getDaiqurenId()) - .eq("jdphone", yijiedan.getJdphone()) - .eq("ddzt_types", yijiedan.getDdztTypes()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper); - if(yijiedanEntity==null){ - // String role = String.valueOf(request.getSession().getAttribute("role")); - // if("".equals(role)){ - // yijiedan.set - // } - yijiedanService.insert(yijiedan); - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody YijiedanEntity yijiedan, HttpServletRequest request){ - logger.debug("update方法:,,Controller:{},,yijiedan:{}",this.getClass().getName(),yijiedan.toString()); - //根据字段查询是否有相同数据 - Wrapper queryWrapper = new EntityWrapper() - .notIn("id",yijiedan.getId()) - .eq("odd", yijiedan.getOdd()) - .eq("yonghu_id", yijiedan.getYonghuId()) - .eq("fbphone", yijiedan.getFbphone()) - .eq("daiquren_id", yijiedan.getDaiqurenId()) - .eq("jdphone", yijiedan.getJdphone()) - .eq("ddzt_types", yijiedan.getDdztTypes()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - YijiedanEntity yijiedanEntity = yijiedanService.selectOne(queryWrapper); - yijiedan.setInitiateTime(new Date()); - if(yijiedanEntity==null){ - // String role = String.valueOf(request.getSession().getAttribute("role")); - // if("".equals(role)){ - // yijiedan.set - // } - yijiedanService.updateById(yijiedan);//根据id更新 - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - - /** - * 完成 - */ - @RequestMapping("/accomplish") - public R accomplish(@RequestBody Integer ids){ - YijiedanEntity yijiedan = yijiedanService.selectById(ids); - if(yijiedan == null){ - return R.error(); - } - JiedanEntity odd = jiedanService.selectOne(new EntityWrapper().eq("odd", yijiedan.getOdd())); - if(odd == null){ - return R.error(); - } - if(odd.getKdlxTypes() == 1){ - DaiquEntity takecode = daiquService.selectOne(new EntityWrapper().eq("takecode", odd.getJdtakecode())); - if(takecode == null){ - return R.error(); - } - takecode.setKdztTypes(2); - - takecode.setPickupTime(new Date()); - daiquService.updateById(takecode); - }else{ - DaiquEntity daiqu = new DaiquEntity(); - List zhandian = zhandianService.selectList(null); - int max=zhandian.size()-1,min=0; - int ran2 = (int) (Math.random()*(max-min)+min); - //随机站点 - daiqu.setZhandianId(zhandian.get(ran2).getId()); - //快递名称 - daiqu.setDqname(odd.getDaiqukuaidimc()); - //快递大小 - daiqu.setKddxTypes(odd.getDx()); - daiqu.setKdztTypes(1); - //收件用户id - YonghuEntity name = yonghuService.selectOne(new EntityWrapper().eq("name", odd.getAddresseename())); - daiqu.setYonghuId(name.getId()); - //手机号 - daiqu.setDqphone(name.getPhone()); - //取件码 - daiqu.setTakecode(UUID.randomUUID().toString().toString().replace("-","").substring(0,6)); - daiquService.insert(daiqu); - } - yijiedan.setDdztTypes(2);//2已完成 - yijiedanService.updateById(yijiedan); - return R.ok(); - } - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids){ - logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); - yijiedanService.deleteBatchIds(Arrays.asList(ids)); - return R.ok(); - } - - -} - diff --git a/src/main/java/com/controller/YonghuController.java b/src/main/java/com/controller/YonghuController.java deleted file mode 100644 index 5511dec..0000000 --- a/src/main/java/com/controller/YonghuController.java +++ /dev/null @@ -1,242 +0,0 @@ -package com.controller; - - -import java.text.SimpleDateFormat; -import com.alibaba.fastjson.JSONObject; -import java.util.*; -import org.springframework.beans.BeanUtils; -import javax.servlet.http.HttpServletRequest; -import org.springframework.web.context.ContextLoader; -import javax.servlet.ServletContext; -import com.service.TokenService; -import com.utils.StringUtil; -import java.lang.reflect.InvocationTargetException; - -import com.service.DictionaryService; -import org.apache.commons.lang3.StringUtils; -import com.annotation.IgnoreAuth; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.mapper.Wrapper; - -import com.entity.YonghuEntity; - -import com.service.YonghuService; -import com.entity.view.YonghuView; -import com.utils.PageUtils; -import com.utils.R; - -/** - * - * 后端接口 - * @author - * @email - * @date 2021-03-11 -*/ -@RestController -@Controller -@RequestMapping("/yonghu") -public class YonghuController { - private static final Logger logger = LoggerFactory.getLogger(YonghuController.class); - - @Autowired - private YonghuService yonghuService; - - @Autowired - private TokenService tokenService; - - @Autowired - private DictionaryService dictionaryService; - - - /** - * 后端列表 - */ - @RequestMapping("/page") - public R page(@RequestParam Map params, HttpServletRequest request){ - logger.debug("page方法:,,Controller:{},,params:{}",this.getClass().getName(),JSONObject.toJSONString(params)); - PageUtils page = yonghuService.queryPage(params); - - //字典表数据转换 - List list =(List)page.getList(); - for(YonghuView c:list){ - //修改对应字典表字段 - dictionaryService.dictionaryConvert(c); - } - return R.ok().put("data", page); - } - /** - * 后端详情 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Long id){ - logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); - YonghuEntity yonghu = yonghuService.selectById(id); - if(yonghu !=null){ - //entity转view - YonghuView view = new YonghuView(); - BeanUtils.copyProperties( yonghu , view );//把实体数据重构到view中 - - //修改对应字典表字段 - dictionaryService.dictionaryConvert(view); - return R.ok().put("data", view); - }else { - return R.error(511,"查不到数据"); - } - - } - - /** - * 后端保存 - */ - @IgnoreAuth - @RequestMapping("/save") - public R save(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ - logger.debug("save方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString()); - Wrapper queryWrapper = new EntityWrapper() - .eq("studentnumber", yonghu.getStudentnumber()) - .eq("name", yonghu.getName()) - .eq("username", yonghu.getUsername()) - .eq("password", yonghu.getPassword()) - .eq("sex_types", yonghu.getSexTypes()) - .eq("phone", yonghu.getPhone()) - .eq("zhuSuLou", yonghu.getZhuSuLou()) - .eq("dormitory", yonghu.getDormitory()) - .eq("role", yonghu.getRole()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper); - if(yonghuEntity==null){ - if(yonghu.getPassword()== "" || yonghu.getPassword() == null){ - yonghu.setPassword("123456"); - } - yonghu.setRole("用户"); - yonghuService.insert(yonghu); - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - /** - * 修改 - */ - @RequestMapping("/update") - public R update(@RequestBody YonghuEntity yonghu, HttpServletRequest request){ - logger.debug("update方法:,,Controller:{},,yonghu:{}",this.getClass().getName(),yonghu.toString()); - //根据字段查询是否有相同数据 - Wrapper queryWrapper = new EntityWrapper() - .notIn("id",yonghu.getId()) - .eq("studentnumber", yonghu.getStudentnumber()) - .eq("name", yonghu.getName()) - .eq("username", yonghu.getUsername()) - .eq("password", yonghu.getPassword()) - .eq("sex_types", yonghu.getSexTypes()) - .eq("phone", yonghu.getPhone()) - .eq("zhuSuLou", yonghu.getZhuSuLou()) - .eq("dormitory", yonghu.getDormitory()) - .eq("role", yonghu.getRole()) - ; - logger.info("sql语句:"+queryWrapper.getSqlSegment()); - YonghuEntity yonghuEntity = yonghuService.selectOne(queryWrapper); - if("".equals(yonghu.getImgPhoto()) || "null".equals(yonghu.getImgPhoto())){ - yonghu.setImgPhoto(null); - } - if(yonghuEntity==null){ - yonghuService.updateById(yonghu);//根据id更新 - return R.ok(); - }else { - return R.error(511,"表中有相同数据"); - } - } - - - /** - * 删除 - */ - @RequestMapping("/delete") - public R delete(@RequestBody Integer[] ids){ - logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); - yonghuService.deleteBatchIds(Arrays.asList(ids)); - return R.ok(); - } - - /** - * 同意注册 - */ - @RequestMapping("/yanz") - public R delete(Integer ids){ - YonghuEntity yonghu = yonghuService.selectById(ids); - if(yonghu!= null){ - return R.error(); - } - yonghu.setYanzheng(1); - yonghuService.updateById(yonghu); - return R.ok(); - } - - - /** - * 登录 - */ - @IgnoreAuth - @PostMapping(value = "/login") - public R login(String username, String password, String role, HttpServletRequest request) { - YonghuEntity yonghu = yonghuService.selectOne(new EntityWrapper().eq("username", username)); - if(yonghu==null || !yonghu.getPassword().equals(password)) { - return R.error("账号或密码不正确"); - } - if(yonghu.getYanzheng() != 1){ - return R.error("还未通过验证请耐心等待"); - } - if(!role.equals(yonghu.getRole())){ - return R.error("权限不正确"); - } - String token = tokenService.generateToken(yonghu.getId(),username, "yonghu", "用户"); - R r = R.ok(); - r.put("token", token); - r.put("role","用户"); - r.put("userId",yonghu.getId()); - return r; - } - - /** - * 注册 - */ - @IgnoreAuth - @PostMapping(value = "/register") - public R register(@RequestBody YonghuEntity yonghu){ - // ValidatorUtils.validateEntity(user); - if(yonghuService.selectOne(new EntityWrapper().eq("username", yonghu.getUsername()).orNew().eq("phone",yonghu.getPhone())) !=null) { - return R.error("用户已存在或手机号身份证号已经被使用"); - } - yonghuService.insert(yonghu); - return R.ok(); - } - - /** - * 获取用户的session用户信息 - */ - @RequestMapping("/session") - public R getCurrYonghu(HttpServletRequest request){ - Integer id = (Integer)request.getSession().getAttribute("userId"); - YonghuEntity yonghu = yonghuService.selectById(id); - return R.ok().put("data", yonghu); - } - - - /** - * 退出 - */ - @GetMapping(value = "logout") - public R logout(HttpServletRequest request) { - request.getSession().invalidate(); - return R.ok("退出成功"); - } - -} - diff --git a/src/main/java/com/controller/ZhandianController.java b/src/main/java/com/controller/ZhandianController.java deleted file mode 100644 index 5e0484f..0000000 --- a/src/main/java/com/controller/ZhandianController.java +++ /dev/null @@ -1,182 +0,0 @@ -package com.controller; - - -import java.text.SimpleDateFormat; -import com.alibaba.fastjson.JSONObject; -import java.util.*; -import org.springframework.beans.BeanUtils; -import javax.servlet.http.HttpServletRequest; -import org.springframework.web.context.ContextLoader; -import javax.servlet.ServletContext; -import com.service.TokenService; -import com.utils.StringUtil; -import java.lang.reflect.InvocationTargetException; - -import com.service.DictionaryService; -import org.apache.commons.lang3.StringUtils; -import com.annotation.IgnoreAuth; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.stereotype.Controller; -import org.springframework.web.bind.annotation.*; -import com.baomidou.mybatisplus.mapper.EntityWrapper; -import com.baomidou.mybatisplus.mapper.Wrapper; - -import com.entity.ZhandianEntity; - -import com.service.ZhandianService; -import com.entity.view.ZhandianView; -import com.utils.PageUtils; -import com.utils.R; - -/** - * 快递站点 - * 后端接口 - * @author - * @email - * @date 2021-03-11 -*/ -/** - * 快递站点管理控制器 - * 处理站点数据的CRUD操作及数据展示 - * - * 核心功能: - * 1. 分页查询(支持权限过滤) - * 2. 详情查看(含数据字典转换) - * 3. 集成权限校验与日志记录 - * - * @author - * @email - * @date 2021-03-11 - */ -@RestController -@RequestMapping("/zhandian") -public class ZhandianController { - private static final Logger logger = LoggerFactory.getLogger(ZhandianController.class); - - @Autowired private ZhandianService zhandianService; // 站点核心业务服务 - @Autowired private TokenService tokenService; // 用户认证服务 - @Autowired private DictionaryService dictionaryService; // 数据字典服务 - - /** - * 分页查询站点列表 - * @param params 查询参数(包含page/limit分页参数及业务条件) - * @param request HTTP请求对象(用于获取用户会话信息) - * @return 分页结果对象(含数据列表和分页元信息) - */ - @RequestMapping("/page") - public R page(@RequestParam Map params, HttpServletRequest request) { - // 日志记录:输出调试信息(使用参数化日志避免字符串拼接) - logger.debug("分页查询参数: {}", JSONObject.toJSONString(params)); - - // 用户权限校验:普通用户只能查看关联数据 - if("用户".equals(request.getSession().getAttribute("role"))) { - params.put("yonghuId", request.getSession().getAttribute("userId")); - } - - // 执行分页查询 - PageUtils page = zhandianService.queryPage(params); - - // 数据转换:将实体列表转为视图对象并处理字典值 - ((List)page.getList()).forEach(dictionaryService::dictionaryConvert); - - return R.ok().put("data", page); - } - - /** - * 获取站点详情信息 - * @param id 站点唯一标识ID - * @return 包含站点详情的视图对象(自动转换数据字典) - * @throws 业务异常 511状态码表示数据不存在 - */ - @RequestMapping("/info/{id}") - public R info(@PathVariable("id") Long id) { - logger.debug("查询站点详情, ID: {}", id); - - ZhandianEntity entity = zhandianService.selectById(id); - if(entity == null) return R.error(511, "查不到数据"); - - // 实体转视图:过滤敏感字段并准备返回数据 - ZhandianView view = new ZhandianView(); - BeanUtils.copyProperties(entity, view); - - // 字典值转换:将编码值转为可读文本 - dictionaryService.dictionaryConvert(view); - - return R.ok().put("data", view); - } -} - - /** - * 后端保存 - */ -/** - * 新增站点信息 - * @param zhandian 站点实体对象(需包含zdname/address等必填字段) - * @param request HTTP请求对象(预留权限校验接口) - * @return 操作结果响应(成功返回200,重复数据返回511) - * - * @apiNote 校验逻辑: - * 1. 检查zdname+address组合唯一性 - * 2. 预留用户角色校验接口(当前注释状态) - */ -@RequestMapping("/add") -public R add(@RequestBody ZhandianEntity zhandian, HttpServletRequest request) { - // 唯一性校验(名称+地址组合唯一) - Wrapper queryWrapper = new EntityWrapper() - .eq("zdname", zhandian.getZdname()) - .eq("address", zhandian.getAddress()); - - if(zhandianService.selectOne(queryWrapper) == null) { - // 权限校验预留接口(当前注释状态) - zhandianService.insert(zhandian); - return R.ok(); - } - return R.error(511, "表中有相同数据"); -} - -/** - * 更新站点信息 - * @param zhandian 包含更新数据的实体对象(必须包含有效id) - * @param request HTTP请求对象(预留权限校验接口) - * @return 操作结果响应(成功返回200,重复数据返回511) - * - * @apiNote 处理流程: - * 1. 排除当前记录校验唯一性(id不同但zdname+address相同) - * 2. 执行更新操作 - * 3. 预留权限校验接口(当前注释状态) - */ -@RequestMapping("/update") -public R update(@RequestBody ZhandianEntity zhandian, HttpServletRequest request) { - // 唯一性校验(排除当前记录) - Wrapper queryWrapper = new EntityWrapper() - .notIn("id", zhandian.getId()) - .eq("zdname", zhandian.getZdname()) - .eq("address", zhandian.getAddress()); - - logger.info("生成的SQL片段: {}", queryWrapper.getSqlSegment()); - - if(zhandianService.selectOne(queryWrapper) == null) { - zhandianService.updateById(zhandian); - return R.ok(); - } - return R.error(511, "表中有相同数据"); -} - -/** - * 批量删除站点记录 - * @param ids 要删除的记录ID数组(支持批量删除) - * @return 操作结果响应(显示成功删除数量) - * - * @apiNote 注意事项: - * 1. 物理删除操作(谨慎使用) - * 2. 返回受影响的记录数 - * 3. 日志记录删除操作 - */ -@RequestMapping("/delete") -public R delete(@RequestBody Integer[] ids) { - logger.debug("待删除ID列表: {}", Arrays.toString(ids)); - int affectRows = zhandianService.deleteBatchIds(Arrays.asList(ids)); - return R.ok().put("data", "成功删除"+affectRows+"条记录"); -} \ No newline at end of file diff --git a/src/main/java/com/dao/CommonDao.java b/src/main/java/com/dao/CommonDao.java deleted file mode 100644 index bf3656e..0000000 --- a/src/main/java/com/dao/CommonDao.java +++ /dev/null @@ -1,26 +0,0 @@ - -package com.dao; - -import java.util.List; -import java.util.Map; - -/** - * 通用接口 - */ -public interface CommonDao{ - List getOption(Map params); - - Map getFollowByOption(Map params); - - List getFollowByOption2(Map params); - - void sh(Map params); - - int remindCount(Map params); - - Map selectCal(Map params); - - List> selectGroup(Map params); - - List> selectValue(Map params); -} diff --git a/src/main/java/com/dao/ConfigDao.java b/src/main/java/com/dao/ConfigDao.java deleted file mode 100644 index e11e63d..0000000 --- a/src/main/java/com/dao/ConfigDao.java +++ /dev/null @@ -1,13 +0,0 @@ - -package com.dao; - - -import com.baomidou.mybatisplus.mapper.BaseMapper; -import com.entity.ConfigEntity; - -/** - * 配置 - */ -public interface ConfigDao extends BaseMapper { - -} diff --git a/src/main/java/com/dao/DaiquDao.java b/src/main/java/com/dao/DaiquDao.java deleted file mode 100644 index 8131f6e..0000000 --- a/src/main/java/com/dao/DaiquDao.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.dao; - -import com.entity.DaiquEntity; -import com.baomidou.mybatisplus.mapper.BaseMapper; -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; - -import org.apache.ibatis.annotations.Param; -import com.entity.view.DaiquView; - -/** - * 待取件表 Dao 接口 - * - * @author - * @since 2021-03-11 - */ -public interface DaiquDao extends BaseMapper { - - List selectListView(Pagination page,@Param("params")Map params); - -} diff --git a/src/main/java/com/dao/DaiqurenDao.java b/src/main/java/com/dao/DaiqurenDao.java deleted file mode 100644 index 0e8ef6a..0000000 --- a/src/main/java/com/dao/DaiqurenDao.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.dao; - -import com.entity.DaiqurenEntity; -import com.baomidou.mybatisplus.mapper.BaseMapper; -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; - -import org.apache.ibatis.annotations.Param; -import com.entity.view.DaiqurenView; - -/** - * Dao 接口 - * - * @author - * @since 2021-03-11 - */ -public interface DaiqurenDao extends BaseMapper { - - List selectListView(Pagination page,@Param("params")Map params); - -} diff --git a/src/main/java/com/dao/DictionaryDao.java b/src/main/java/com/dao/DictionaryDao.java deleted file mode 100644 index 8bf2668..0000000 --- a/src/main/java/com/dao/DictionaryDao.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.dao; - -import com.entity.DictionaryEntity; -import com.baomidou.mybatisplus.mapper.BaseMapper; -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; - -import org.apache.ibatis.annotations.Param; -import com.entity.view.DictionaryView; - -/** - * 字典表 Dao 接口 - * - * @author - * @since 2021-03-11 - */ -public interface DictionaryDao extends BaseMapper { - - List selectListView(Pagination page,@Param("params")Map params); - -} diff --git a/src/main/java/com/dao/JiedanDao.java b/src/main/java/com/dao/JiedanDao.java deleted file mode 100644 index ec9b116..0000000 --- a/src/main/java/com/dao/JiedanDao.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.dao; - -import com.entity.JiedanEntity; -import com.baomidou.mybatisplus.mapper.BaseMapper; -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; - -import org.apache.ibatis.annotations.Param; -import com.entity.view.JiedanView; - -/** - * 快递接单表 Dao 接口 - * - * @author - * @since 2021-03-11 - */ -public interface JiedanDao extends BaseMapper { - - List selectListView(Pagination page,@Param("params")Map params); - -} diff --git a/src/main/java/com/dao/TokenDao.java b/src/main/java/com/dao/TokenDao.java deleted file mode 100644 index 4e7145b..0000000 --- a/src/main/java/com/dao/TokenDao.java +++ /dev/null @@ -1,22 +0,0 @@ - -package com.dao; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.baomidou.mybatisplus.mapper.BaseMapper; -import com.baomidou.mybatisplus.mapper.Wrapper; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; -import com.entity.TokenEntity; - -/** - * token - */ -public interface TokenDao extends BaseMapper { - - List selectListView(@Param("ew") Wrapper wrapper); - - List selectListView(Pagination page, @Param("ew") Wrapper wrapper); - -} diff --git a/src/main/java/com/dao/UserDao.java b/src/main/java/com/dao/UserDao.java deleted file mode 100644 index e65fc3e..0000000 --- a/src/main/java/com/dao/UserDao.java +++ /dev/null @@ -1,22 +0,0 @@ - -package com.dao; - -import java.util.List; - -import org.apache.ibatis.annotations.Param; - -import com.baomidou.mybatisplus.mapper.BaseMapper; -import com.baomidou.mybatisplus.mapper.Wrapper; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; -import com.entity.UserEntity; - -/** - * 用户 - */ -public interface UserDao extends BaseMapper { - - List selectListView(@Param("ew") Wrapper wrapper); - - List selectListView(Pagination page, @Param("ew") Wrapper wrapper); - -} diff --git a/src/main/java/com/dao/YijiedanDao.java b/src/main/java/com/dao/YijiedanDao.java deleted file mode 100644 index a92a6b1..0000000 --- a/src/main/java/com/dao/YijiedanDao.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.dao; - -import com.entity.YijiedanEntity; -import com.baomidou.mybatisplus.mapper.BaseMapper; -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; - -import org.apache.ibatis.annotations.Param; -import com.entity.view.YijiedanView; - -/** - * 已接单表 Dao 接口 - * - * @author - * @since 2021-03-11 - */ -public interface YijiedanDao extends BaseMapper { - - List selectListView(Pagination page,@Param("params")Map params); - -} diff --git a/src/main/java/com/dao/YonghuDao.java b/src/main/java/com/dao/YonghuDao.java deleted file mode 100644 index 99c100b..0000000 --- a/src/main/java/com/dao/YonghuDao.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.dao; - -import com.entity.YonghuEntity; -import com.baomidou.mybatisplus.mapper.BaseMapper; -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; - -import org.apache.ibatis.annotations.Param; -import com.entity.view.YonghuView; - -/** - * Dao 接口 - * - * @author - * @since 2021-03-11 - */ -public interface YonghuDao extends BaseMapper { - - List selectListView(Pagination page,@Param("params")Map params); - -} diff --git a/src/main/java/com/dao/ZhandianDao.java b/src/main/java/com/dao/ZhandianDao.java deleted file mode 100644 index bdf50f1..0000000 --- a/src/main/java/com/dao/ZhandianDao.java +++ /dev/null @@ -1,22 +0,0 @@ -package com.dao; - -import com.entity.ZhandianEntity; -import com.baomidou.mybatisplus.mapper.BaseMapper; -import java.util.List; -import java.util.Map; -import com.baomidou.mybatisplus.plugins.pagination.Pagination; - -import org.apache.ibatis.annotations.Param; -import com.entity.view.ZhandianView; - -/** - * 快递站点 Dao 接口 - * - * @author - * @since 2021-03-11 - */ -public interface ZhandianDao extends BaseMapper { - - List selectListView(Pagination page,@Param("params")Map params); - -}