diff --git a/.idea/vcs.xml b/.idea/vcs.xml index 243e943..35eb1dd 100644 --- a/.idea/vcs.xml +++ b/.idea/vcs.xml @@ -1,7 +1,6 @@ - - + \ No newline at end of file diff --git a/example.txt b/example.txt new file mode 100644 index 0000000..e69de29 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/ServletContextListener/DictionaryServletContextListener.java b/src/main/java/com/ServletContextListener/DictionaryServletContextListener.java new file mode 100644 index 0000000..0a9e9bf --- /dev/null +++ b/src/main/java/com/ServletContextListener/DictionaryServletContextListener.java @@ -0,0 +1,86 @@ +package com.ServletContextListener; + +// 导入MyBatis-Plus的EntityWrapper类,用于构建实体查询条件 +import com.baomidou.mybatisplus.mapper.EntityWrapper; +// 导入字典实体类,用于表示字典表中的数据 +import com.entity.DictionaryEntity; +// 导入字典服务接口,用于操作字典数据 +import com.service.DictionaryService; +// 导入日志记录器接口 +import org.slf4j.Logger; +// 导入日志记录器工厂类,用于创建日志记录器 +import org.slf4j.LoggerFactory; +// 导入Spring的应用上下文接口,代表Spring应用的上下文环境 +import org.springframework.context.ApplicationContext; +// 导入Spring的Web应用上下文工具类,用于从Servlet上下文获取Spring应用上下文 +import org.springframework.web.context.support.WebApplicationContextUtils; + +// 导入Servlet上下文监听器接口 +import javax.servlet.ServletContextListener; +// 导入Servlet上下文事件类,代表Servlet上下文的事件 +import javax.servlet.ServletContextEvent; +// 导入HashMap类,用于存储键值对 +import java.util.HashMap; +// 导入List接口,用于存储有序集合 +import java.util.List; +// 导入Map接口,用于存储键值对映射 +import java.util.Map; + +/** + * 字典初始化监视器 用的是服务器监听,每次项目启动,都会调用这个类 + */ +public class DictionaryServletContextListener implements ServletContextListener { + + // 创建一个静态的日志记录器,用于记录该类的日志信息 + private static final Logger logger = LoggerFactory.getLogger(DictionaryServletContextListener.class); + // 这里注释掉的@Autowired和DictionaryServiceImpl的声明,原本是想自动注入字典服务实现类,但可能因为在ServletContextListener中不能直接使用@Autowired,所以采用其他方式获取服务 +// @Autowired +// private DictionaryServiceImpl dictionaryService; + + /** + * 当Servlet上下文销毁时调用此方法 + * @param sce Servlet上下文事件对象,包含Servlet上下文销毁的相关信息 + */ + @Override + public void contextDestroyed(ServletContextEvent sce) { + // 记录服务器停止的日志信息 + logger.info("----------服务器停止----------"); + } + + /** + * 当Servlet上下文初始化时调用此方法 + * @param sce Servlet上下文事件对象,包含Servlet上下文初始化的相关信息 + */ + @Override + public void contextInitialized(ServletContextEvent sce) { + // 从Servlet上下文获取Spring的应用上下文 + ApplicationContext appContext = WebApplicationContextUtils.getWebApplicationContext(sce.getServletContext()); + + // 记录字典表初始化开始的日志信息 + logger.info("----------字典表初始化开始----------"); + // 从Spring应用上下文中获取字典服务实例 + DictionaryService dictionaryService = (DictionaryService)appContext.getBean("dictionaryService"); + // 使用字典服务查询所有的字典实体数据 + List dictionaryEntities = dictionaryService.selectList(new EntityWrapper()); + // 创建一个嵌套的Map,用于存储字典数据,外层键为字典代码,内层键为代码索引,值为索引名称 + Map> map = new HashMap<>(); + // 遍历查询到的所有字典实体数据 + for(DictionaryEntity d :dictionaryEntities){ + // 根据字典代码从外层Map中获取内层Map + Map m = map.get(d.getDicCode()); + // 如果内层Map为空或者不存在,则创建一个新的内层Map + if(m ==null || m.isEmpty()){ + m = new HashMap<>(); + } + // 将代码索引和索引名称存入内层Map + m.put(d.getCodeIndex(),d.getIndexName()); + // 将内层Map存入外层Map,键为字典代码 + map.put(d.getDicCode(),m); + } + // 将处理好的字典数据存储到Servlet上下文中,键为"dictionaryMap" + sce.getServletContext().setAttribute("dictionaryMap", map); + // 记录字典表初始化完成的日志信息 + logger.info("----------字典表初始化完成----------"); + } + +} diff --git a/src/main/java/com/annotation/APPLoginUser.java b/src/main/java/com/annotation/APPLoginUser.java new file mode 100644 index 0000000..21d41b9 --- /dev/null +++ b/src/main/java/com/annotation/APPLoginUser.java @@ -0,0 +1,15 @@ +package com.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 登录用户信息 + */ +@Target(ElementType.PARAMETER) +@Retention(RetentionPolicy.RUNTIME) +public @interface APPLoginUser { + +} diff --git a/src/main/java/com/controller/IgnoreAuth.java b/src/main/java/com/annotation/IgnoreAuth.java similarity index 87% rename from src/main/java/com/controller/IgnoreAuth.java rename to src/main/java/com/annotation/IgnoreAuth.java index 210f8ad..7c3cc55 100644 --- a/src/main/java/com/controller/IgnoreAuth.java +++ b/src/main/java/com/annotation/IgnoreAuth.java @@ -1,4 +1,4 @@ -package com.controller; +package com.annotation; import java.lang.annotation.*; diff --git a/src/main/java/com/annotation/LoginUser.java b/src/main/java/com/annotation/LoginUser.java new file mode 100644 index 0000000..3d808d3 --- /dev/null +++ b/src/main/java/com/annotation/LoginUser.java @@ -0,0 +1,15 @@ +package com.annotation; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 登录用户信息 + */ +@Target(ElementType.PARAMETER) +@Retention(RetentionPolicy.RUNTIME) +public @interface LoginUser { + +} diff --git a/src/main/java/com/config/MyMetaObjectHandler.java b/src/main/java/com/config/MyMetaObjectHandler.java new file mode 100644 index 0000000..2f9e793 --- /dev/null +++ b/src/main/java/com/config/MyMetaObjectHandler.java @@ -0,0 +1,28 @@ +package com.config; + +import java.util.Date; + +import org.apache.ibatis.reflection.MetaObject; + +import com.baomidou.mybatisplus.mapper.MetaObjectHandler; + +/** + * 自定义填充处理器 + */ +public class MyMetaObjectHandler extends MetaObjectHandler { + + @Override + public void insertFill(MetaObject metaObject) { + this.setFieldValByName("ctime", new Date(), metaObject); + } + + @Override + public boolean openUpdateFill() { + return false; + } + + @Override + public void updateFill(MetaObject metaObject) { + // 关闭更新填充、这里不执行 + } +} 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 index 72977de..61ed655 100644 --- a/src/main/java/com/controller/CommonController.java +++ b/src/main/java/com/controller/CommonController.java @@ -33,318 +33,208 @@ 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 { +public class CommonController{ @Autowired - private CommonService commonService; // 通用业务逻辑服务 - + 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时返回错误 - */ + private ConfigService configService; + + private static AipFace client = null; + + private static String BAIDU_DITU_AK = null; + @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)) { + public R location(String lng,String lat) { + if(BAIDU_DITU_AK==null) { + BAIDU_DITU_AK = configService.selectOne(new EntityWrapper().eq("name", "baidu_ditu_ak")).getValue(); + if(BAIDU_DITU_AK==null) { 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 文件异常 当图片文件不存在时返回错误 + * 人脸比对 + * + * @param face1 人脸1 + * @param face2 人脸2 + * @return */ @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(); - + if(client==null) { + /*String AppID = configService.selectOne(new EntityWrapper().eq("name", "AppID")).getValue();*/ + 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) { + if(token==null) { return R.error("请在配置管理中正确配置APIKey和SecretKey"); } - client = new AipFace(null, APIKey, SecretKey); - client.setConnectionTimeoutInMillis(2000); // 连接超时2秒 - client.setSocketTimeoutInMillis(60000); // 数据传输超时60秒 + client.setConnectionTimeoutInMillis(2000); + client.setSocketTimeoutInMillis(60000); } - + JSONObject res = null; try { - // 构建服务器文件路径(从web应用根目录获取) - String uploadPath = request.getSession() - .getServletContext() - .getRealPath("/upload"); - - File file1 = new File(uploadPath, face1); - File file2 = new File(uploadPath, face2); - - // 图片转Base64编码 + File file1 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face1); + File file2 = new File(request.getSession().getServletContext().getRealPath("/upload")+"/"+face2); 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<>(); + 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()) - ); - + res = client.match(requests); + System.out.println(res.get("result")); } catch (FileNotFoundException e) { - return R.error("文件不存在:" + e.getMessage()); + e.printStackTrace(); + return R.error("文件不存在"); } catch (IOException e) { - return R.error("文件处理失败:" + e.getMessage()); - } + e.printStackTrace(); + } + return R.ok().put("data", com.alibaba.fastjson.JSONObject.parse(res.get("result").toString())); } - + /** - * 联动下拉选项接口 - * 根据表名和列名获取动态下拉选项数据(支持多级联动) - * - * @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 + * 获取table表中的column列表(联动接口) + * @param table + * @param column + * @return */ @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<>(); + @IgnoreAuth + public R getOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName,String level,String parent) { + Map params = new HashMap(); params.put("table", tableName); params.put("column", columnName); - - // 添加可选参数 - if (StringUtils.isNotBlank(level)) { + if(StringUtils.isNotBlank(level)) { params.put("level", level); } - if (StringUtils.isNotBlank(parent)) { + 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())); + @RequestMapping("/follow/{tableName}/{columnName}") + @IgnoreAuth + public R getFollowByOption(@PathVariable("tableName") String tableName, @PathVariable("columnName") 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); + } + + /** + * 修改table表的sfsh状态 + * @param table + * @param map + * @return + */ + @RequestMapping("/sh/{tableName}") + public R sh(@PathVariable("tableName") String tableName, @RequestBody Map map) { + map.put("table", tableName); + commonService.sh(map); + return R.ok(); + } + + /** + * 获取需要提醒的记录数 + * @param tableName + * @param columnName + * @param type 1:数字 2:日期 + * @param map + * @return + */ + @RequestMapping("/remind/{tableName}/{columnName}/{type}") + @IgnoreAuth + public R remindCount(@PathVariable("tableName") String tableName, @PathVariable("columnName") String columnName, + @PathVariable("type") String type,@RequestParam Map map) { + map.put("table", tableName); + map.put("column", columnName); + map.put("type", type); + + if(type.equals("2")) { + SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); + Calendar c = Calendar.getInstance(); + Date remindStartDate = null; + Date remindEndDate = null; + if(map.get("remindstart")!=null) { + Integer remindStart = Integer.parseInt(map.get("remindstart").toString()); + c.setTime(new Date()); + c.add(Calendar.DAY_OF_MONTH,remindStart); + remindStartDate = c.getTime(); + map.put("remindstart", sdf.format(remindStartDate)); + } + if(map.get("remindend")!=null) { + Integer remindEnd = Integer.parseInt(map.get("remindend").toString()); + c.setTime(new Date()); + c.add(Calendar.DAY_OF_MONTH,remindEnd); + remindEndDate = c.getTime(); + map.put("remindend", sdf.format(remindEndDate)); + } } + + int count = commonService.remindCount(map); + return R.ok().put("count", count); } - - 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); + + /** + * 单列求和 + */ + @RequestMapping("/cal/{tableName}/{columnName}") + @IgnoreAuth + public R cal(@PathVariable("tableName") String tableName, @PathVariable("columnName") 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); + } + + /** + * 分组统计 + */ + @RequestMapping("/group/{tableName}/{columnName}") + @IgnoreAuth + public R group(@PathVariable("tableName") String tableName, @PathVariable("columnName") 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); + } + + /** + * (按值统计) + */ + @RequestMapping("/value/{tableName}/{xColumnName}/{yColumnName}") + @IgnoreAuth + public R value(@PathVariable("tableName") String tableName, @PathVariable("yColumnName") String yColumnName, @PathVariable("xColumnName") 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/ZhandianController.java b/src/main/java/com/controller/ZhandianController.java index 5e0484f..1f9a6b3 100644 --- a/src/main/java/com/controller/ZhandianController.java +++ b/src/main/java/com/controller/ZhandianController.java @@ -37,146 +37,127 @@ import com.utils.R; * @email * @date 2021-03-11 */ -/** - * 快递站点管理控制器 - * 处理站点数据的CRUD操作及数据展示 - * - * 核心功能: - * 1. 分页查询(支持权限过滤) - * 2. 详情查看(含数据字典转换) - * 3. 集成权限校验与日志记录 - * - * @author - * @email - * @date 2021-03-11 - */ @RestController +@Controller @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; // 数据字典服务 + @Autowired + private ZhandianService zhandianService; + + + @Autowired + private TokenService tokenService; + @Autowired + private DictionaryService dictionaryService; + + + //级联表service + /** - * 分页查询站点列表 - * @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")); + 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 = zhandianService.queryPage(params); - // 数据转换:将实体列表转为视图对象并处理字典值 - ((List)page.getList()).forEach(dictionaryService::dictionaryConvert); - + //字典表数据转换 + List list =(List)page.getList(); + for(ZhandianView c:list){ + //修改对应字典表字段 + dictionaryService.dictionaryConvert(c); + } 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); + public R info(@PathVariable("id") Long id){ + logger.debug("info方法:,,Controller:{},,id:{}",this.getClass().getName(),id); + ZhandianEntity zhandian = zhandianService.selectById(id); + if(zhandian !=null){ + //entity转view + ZhandianView view = new ZhandianView(); + BeanUtils.copyProperties( zhandian , view );//把实体数据重构到view中 + + //修改对应字典表字段 + dictionaryService.dictionaryConvert(view); + return R.ok().put("data", view); + }else { + return R.error(511,"查不到数据"); + } - 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() + @RequestMapping("/save") + public R save(@RequestBody ZhandianEntity zhandian, HttpServletRequest request){ + logger.debug("save方法:,,Controller:{},,zhandian:{}",this.getClass().getName(),zhandian.toString()); + Wrapper queryWrapper = new EntityWrapper() .eq("zdname", zhandian.getZdname()) - .eq("address", zhandian.getAddress()); - - if(zhandianService.selectOne(queryWrapper) == null) { - // 权限校验预留接口(当前注释状态) - zhandianService.insert(zhandian); - return R.ok(); + .eq("address", zhandian.getAddress()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + ZhandianEntity zhandianEntity = zhandianService.selectOne(queryWrapper); + if(zhandianEntity==null){ + // String role = String.valueOf(request.getSession().getAttribute("role")); + // if("".equals(role)){ + // zhandian.set + // } + zhandianService.insert(zhandian); + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } } - 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()) + /** + * 修改 + */ + @RequestMapping("/update") + public R update(@RequestBody ZhandianEntity zhandian, HttpServletRequest request){ + logger.debug("update方法:,,Controller:{},,zhandian:{}",this.getClass().getName(),zhandian.toString()); + //根据字段查询是否有相同数据 + Wrapper queryWrapper = new EntityWrapper() + .notIn("id",zhandian.getId()) .eq("zdname", zhandian.getZdname()) - .eq("address", zhandian.getAddress()); + .eq("address", zhandian.getAddress()) + ; + logger.info("sql语句:"+queryWrapper.getSqlSegment()); + ZhandianEntity zhandianEntity = zhandianService.selectOne(queryWrapper); + if(zhandianEntity==null){ + // String role = String.valueOf(request.getSession().getAttribute("role")); + // if("".equals(role)){ + // zhandian.set + // } + zhandianService.updateById(zhandian);//根据id更新 + return R.ok(); + }else { + return R.error(511,"表中有相同数据"); + } + } - logger.info("生成的SQL片段: {}", queryWrapper.getSqlSegment()); - if(zhandianService.selectOne(queryWrapper) == null) { - zhandianService.updateById(zhandian); + /** + * 删除 + */ + @RequestMapping("/delete") + public R delete(@RequestBody Integer[] ids){ + logger.debug("delete:,,Controller:{},,ids:{}",this.getClass().getName(),ids.toString()); + zhandianService.deleteBatchIds(Arrays.asList(ids)); 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/entity/ConfigEntity.java b/src/main/java/com/entity/ConfigEntity.java new file mode 100644 index 0000000..7078bc2 --- /dev/null +++ b/src/main/java/com/entity/ConfigEntity.java @@ -0,0 +1,55 @@ +package com.entity; + +import java.io.Serializable; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +/** +* @author yangliyuan +* @version 创建时间:2020年2月7日 下午8:36:05 +* 类说明 : +*/ +@TableName("config") +public class ConfigEntity implements Serializable{ +private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Long id; + + /** + * key + */ + private String name; + + /** + * value + */ + private String value; + + public Long getId() { + return id; + } + + public void setId(Long id) { + this.id = id; + } + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + public String getValue() { + return value; + } + + public void setValue(String value) { + this.value = value; + } + +} diff --git a/src/main/java/com/entity/DaiquEntity.java b/src/main/java/com/entity/DaiquEntity.java new file mode 100644 index 0000000..9355aac --- /dev/null +++ b/src/main/java/com/entity/DaiquEntity.java @@ -0,0 +1,274 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * 待取件表 + * + * @author + * @email + * @date 2021-03-11 + */ +@TableName("daiqu") +public class DaiquEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public DaiquEntity() { + + } + + public DaiquEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + @TableField(value = "id") + + private Integer id; + + + /** + * 快递名称 + */ + @TableField(value = "dqname") + + private String dqname; + + + /** + * 站点 + */ + @TableField(value = "zhandian_id") + + private Integer zhandianId; + + + /** + * 用户 + */ + @TableField(value = "yonghu_id") + + private Integer yonghuId; + + + /** + * 快递大小 + */ + @TableField(value = "kddx_types") + + private Integer kddxTypes; + + + /** + * 手机号 + */ + @TableField(value = "dqphone") + + private String dqphone; + + + /** + * 取件码 + */ + @TableField(value = "takecode") + + private String takecode; + + + /** + * 快递状态 + */ + @TableField(value = "kdzt_types") + + private Integer kdztTypes; + + + /** + * 取件时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy年MM月dd日 HH时mm分") + @DateTimeFormat + @TableField(value = "pickup_time",fill = FieldFill.UPDATE) + + private Date pickupTime; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:快递名称 + */ + public String getDqname() { + return dqname; + } + + + /** + * 获取:快递名称 + */ + + public void setDqname(String dqname) { + this.dqname = dqname; + } + /** + * 设置:站点 + */ + public Integer getZhandianId() { + return zhandianId; + } + + + /** + * 获取:站点 + */ + + public void setZhandianId(Integer zhandianId) { + this.zhandianId = zhandianId; + } + /** + * 设置:用户 + */ + public Integer getYonghuId() { + return yonghuId; + } + + + /** + * 获取:用户 + */ + + public void setYonghuId(Integer yonghuId) { + this.yonghuId = yonghuId; + } + /** + * 设置:快递大小 + */ + public Integer getKddxTypes() { + return kddxTypes; + } + + + /** + * 获取:快递大小 + */ + + public void setKddxTypes(Integer kddxTypes) { + this.kddxTypes = kddxTypes; + } + /** + * 设置:手机号 + */ + public String getDqphone() { + return dqphone; + } + + + /** + * 获取:手机号 + */ + + public void setDqphone(String dqphone) { + this.dqphone = dqphone; + } + /** + * 设置:取件码 + */ + public String getTakecode() { + return takecode; + } + + + /** + * 获取:取件码 + */ + + public void setTakecode(String takecode) { + this.takecode = takecode; + } + /** + * 设置:快递状态 + */ + public Integer getKdztTypes() { + return kdztTypes; + } + + + /** + * 获取:快递状态 + */ + + public void setKdztTypes(Integer kdztTypes) { + this.kdztTypes = kdztTypes; + } + /** + * 设置:取件时间 + */ + public Date getPickupTime() { + return pickupTime; + } + + + /** + * 获取:取件时间 + */ + + public void setPickupTime(Date pickupTime) { + this.pickupTime = pickupTime; + } + + @Override + public String toString() { + return "Daiqu{" + + "id=" + id + + ", dqname=" + dqname + + ", zhandianId=" + zhandianId + + ", yonghuId=" + yonghuId + + ", kddxTypes=" + kddxTypes + + ", dqphone=" + dqphone + + ", takecode=" + takecode + + ", kdztTypes=" + kdztTypes + + ", pickupTime=" + pickupTime + + "}"; + } +} diff --git a/src/main/java/com/entity/DaiqurenEntity.java b/src/main/java/com/entity/DaiqurenEntity.java new file mode 100644 index 0000000..d036f8a --- /dev/null +++ b/src/main/java/com/entity/DaiqurenEntity.java @@ -0,0 +1,248 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * + * + * @author + * @email + * @date 2021-03-11 + */ +@TableName("daiquren") +public class DaiqurenEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public DaiqurenEntity() { + + } + + public DaiqurenEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + /** + * id + */ + @TableId(type = IdType.AUTO) + @TableField(value = "id") + + private Integer id; + + + /** + * 用户名称 + */ + @TableField(value = "name") + + private String name; + + + /** + * 账号 + */ + @TableField(value = "username") + + private String username; + + + /** + * 密码 + */ + @TableField(value = "password") + + private String password; + + + /** + * 性别 + */ + @TableField(value = "sex_types") + + private Integer sexTypes; + + + /** + * 头像 + */ + @TableField(value = "img_photo") + + private String imgPhoto; + + + /** + * 联系电话 + */ + @TableField(value = "phone") + + private String phone; + + + /** + * 身份 + */ + @TableField(value = "role") + + private String role; + + + /** + * 设置:id + */ + public Integer getId() { + return id; + } + + + /** + * 获取:id + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:用户名称 + */ + public String getName() { + return name; + } + + + /** + * 获取:用户名称 + */ + + public void setName(String name) { + this.name = name; + } + /** + * 设置:账号 + */ + public String getUsername() { + return username; + } + + + /** + * 获取:账号 + */ + + public void setUsername(String username) { + this.username = username; + } + /** + * 设置:密码 + */ + public String getPassword() { + return password; + } + + + /** + * 获取:密码 + */ + + public void setPassword(String password) { + this.password = password; + } + /** + * 设置:性别 + */ + public Integer getSexTypes() { + return sexTypes; + } + + + /** + * 获取:性别 + */ + + public void setSexTypes(Integer sexTypes) { + this.sexTypes = sexTypes; + } + /** + * 设置:头像 + */ + public String getImgPhoto() { + return imgPhoto; + } + + + /** + * 获取:头像 + */ + + public void setImgPhoto(String imgPhoto) { + this.imgPhoto = imgPhoto; + } + /** + * 设置:联系电话 + */ + public String getPhone() { + return phone; + } + + + /** + * 获取:联系电话 + */ + + public void setPhone(String phone) { + this.phone = phone; + } + /** + * 设置:身份 + */ + public String getRole() { + return role; + } + + + /** + * 获取:身份 + */ + + public void setRole(String role) { + this.role = role; + } + + @Override + public String toString() { + return "Daiquren{" + + "id=" + id + + ", name=" + name + + ", username=" + username + + ", password=" + password + + ", sexTypes=" + sexTypes + + ", imgPhoto=" + imgPhoto + + ", phone=" + phone + + ", role=" + role + + "}"; + } +} diff --git a/src/main/java/com/entity/DictionaryEntity.java b/src/main/java/com/entity/DictionaryEntity.java new file mode 100644 index 0000000..2012f48 --- /dev/null +++ b/src/main/java/com/entity/DictionaryEntity.java @@ -0,0 +1,226 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * 字典表 + * + * @author + * @email + * @date 2021-03-11 + */ +@TableName("dictionary") +public class DictionaryEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public DictionaryEntity() { + + } + + public DictionaryEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + @TableField(value = "id") + + private Integer id; + + + /** + * 字段 + */ + @TableField(value = "dic_code") + + private String dicCode; + + + /** + * 字段名 + */ + @TableField(value = "dic_name") + + private String dicName; + + + /** + * 编码 + */ + @TableField(value = "code_index") + + private Integer codeIndex; + + + /** + * 编码名字 + */ + @TableField(value = "index_name") + + private String indexName; + + + /** + * 父字段id + */ + @TableField(value = "super_id") + + private Integer superId; + + + /** + * 创建时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + @TableField(value = "create_time",fill = FieldFill.INSERT) + + private Date createTime; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:字段 + */ + public String getDicCode() { + return dicCode; + } + + + /** + * 获取:字段 + */ + + public void setDicCode(String dicCode) { + this.dicCode = dicCode; + } + /** + * 设置:字段名 + */ + public String getDicName() { + return dicName; + } + + + /** + * 获取:字段名 + */ + + public void setDicName(String dicName) { + this.dicName = dicName; + } + /** + * 设置:编码 + */ + public Integer getCodeIndex() { + return codeIndex; + } + + + /** + * 获取:编码 + */ + + public void setCodeIndex(Integer codeIndex) { + this.codeIndex = codeIndex; + } + /** + * 设置:编码名字 + */ + public String getIndexName() { + return indexName; + } + + + /** + * 获取:编码名字 + */ + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + /** + * 设置:父字段id + */ + public Integer getSuperId() { + return superId; + } + + + /** + * 获取:父字段id + */ + + public void setSuperId(Integer superId) { + this.superId = superId; + } + /** + * 设置:创建时间 + */ + public Date getCreateTime() { + return createTime; + } + + + /** + * 获取:创建时间 + */ + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + @Override + public String toString() { + return "Dictionary{" + + "id=" + id + + ", dicCode=" + dicCode + + ", dicName=" + dicName + + ", codeIndex=" + codeIndex + + ", indexName=" + indexName + + ", superId=" + superId + + ", createTime=" + createTime + + "}"; + } +} diff --git a/src/main/java/com/entity/EIException.java b/src/main/java/com/entity/EIException.java new file mode 100644 index 0000000..2ebfb56 --- /dev/null +++ b/src/main/java/com/entity/EIException.java @@ -0,0 +1,52 @@ + +package com.entity; + +/** + * 自定义异常 + */ +public class EIException extends RuntimeException { + private static final long serialVersionUID = 1L; + + private String msg; + private int code = 500; + + public EIException(String msg) { + super(msg); + this.msg = msg; + } + + public EIException(String msg, Throwable e) { + super(msg, e); + this.msg = msg; + } + + public EIException(String msg, int code) { + super(msg); + this.msg = msg; + this.code = code; + } + + public EIException(String msg, int code, Throwable e) { + super(msg, e); + this.msg = msg; + this.code = code; + } + + public String getMsg() { + return msg; + } + + public void setMsg(String msg) { + this.msg = msg; + } + + public int getCode() { + return code; + } + + public void setCode(int code) { + this.code = code; + } + + +} diff --git a/src/main/java/com/entity/JiedanEntity.java b/src/main/java/com/entity/JiedanEntity.java new file mode 100644 index 0000000..e411285 --- /dev/null +++ b/src/main/java/com/entity/JiedanEntity.java @@ -0,0 +1,328 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * 快递接单表 + * + * @author + * @email + * @date 2021-03-11 + */ +@TableName("jiedan") +public class JiedanEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public JiedanEntity() { + + } + + public JiedanEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + @TableField(value = "id") + + private Integer id; + + + /** + * 单号 + */ + @TableField(value = "odd") + + private String odd; + /** + * 单号 + */ + @TableField(value = "dx") + + private Integer dx; + + + /** + * 快递名称 + */ + @TableField(value = "daiqukuaidimc") + private String daiqukuaidimc; + + public String getDaiqukuaidimc() { + return daiqukuaidimc; + } + + public void setDaiqukuaidimc(String daiqukuaidimc) { + this.daiqukuaidimc = daiqukuaidimc; + } + + /** + * 发布人 + */ + @TableField(value = "jdyonghu_id") + + private Integer jdyonghuId; + + + /** + * 发布时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + @TableField(value = "initiate_time",fill = FieldFill.UPDATE) + + private Date initiateTime; + + + /** + * 收件人名称 + */ + @TableField(value = "addresseename") + + private String addresseename; + + + /** + * 电话 + */ + @TableField(value = "jdphone") + + private String jdphone; + + + /** + * 地址 + */ + @TableField(value = "jdaddressee") + + private String jdaddressee; + + + /** + * (取/寄)件码 + */ + @TableField(value = "jdtakecode") + + private String jdtakecode; + + + /** + * 快递状态 + */ + @TableField(value = "jdzt_types") + + private Integer jdztTypes; + + /** + * 快递类型 + */ + @TableField(value = "kdlx_types") + + private Integer kdlxTypes; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:单号 + */ + public String getOdd() { + return odd; + } + + + /** + * 获取:单号 + */ + + public void setOdd(String odd) { + this.odd = odd; + } + + /** + * 设置:发布人 + */ + public Integer getJdyonghuId() { + return jdyonghuId; + } + + + /** + * 获取:发布人 + */ + + public void setJdyonghuId(Integer jdyonghuId) { + this.jdyonghuId = jdyonghuId; + } + /** + * 设置:发布时间 + */ + public Date getInitiateTime() { + return initiateTime; + } + + + + /** + * 获取:发布时间 + */ + + public void setInitiateTime(Date initiateTime) { + this.initiateTime = initiateTime; + } + /** + * 设置:收件人名称 + */ + public String getAddresseename() { + return addresseename; + } + + + /** + * 获取:收件人名称 + */ + + public void setAddresseename(String addresseename) { + this.addresseename = addresseename; + } + /** + * 设置:电话 + */ + public String getJdphone() { + return jdphone; + } + + + /** + * 获取:电话 + */ + + public void setJdphone(String jdphone) { + this.jdphone = jdphone; + } + /** + * 设置:地址 + */ + public String getJdaddressee() { + return jdaddressee; + } + + + /** + * 获取:地址 + */ + + public void setJdaddressee(String jdaddressee) { + this.jdaddressee = jdaddressee; + } + /** + * 设置:(取/寄)件码 + */ + public String getJdtakecode() { + return jdtakecode; + } + + + public Integer getDx() { + return dx; + } + + public void setDx(Integer dx) { + this.dx = dx; + } + + /** + * 获取:(取/寄)件码 + */ + + public void setJdtakecode(String jdtakecode) { + this.jdtakecode = jdtakecode; + } + /** + * 设置:快递状态 + */ + public Integer getJdztTypes() { + return jdztTypes; + } + + + /** + * 获取:快递状态 + */ + + public void setJdztTypes(Integer jdztTypes) { + this.jdztTypes = jdztTypes; + } + /** + * 设置:快递类型 + */ + public Integer getKdlxTypes() { + return kdlxTypes; + } + + + /** + * 获取:快递类型 + */ + + public void setKdlxTypes(Integer kdlxTypes) { + this.kdlxTypes = kdlxTypes; + } + + @Override + public String toString() { + return "Jiedan{" + + "id=" + id + + ", odd=" + odd + + ", daiqukuaidimc=" + daiqukuaidimc + + ", jdyonghuId=" + jdyonghuId + + ", initiateTime=" + initiateTime + + ", addresseename=" + addresseename + + ", jdphone=" + jdphone + + ", jdaddressee=" + jdaddressee + + ", jdtakecode=" + jdtakecode + + ", jdztTypes=" + jdztTypes + + ", kdlxTypes=" + kdlxTypes + + "}"; + } +} diff --git a/src/main/java/com/entity/TokenEntity.java b/src/main/java/com/entity/TokenEntity.java new file mode 100644 index 0000000..6f90a63 --- /dev/null +++ b/src/main/java/com/entity/TokenEntity.java @@ -0,0 +1,132 @@ +package com.entity; + +import java.io.Serializable; +import java.util.Date; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * token表 + */ +@TableName("token") +public class TokenEntity implements Serializable { + private static final Long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 用户id + */ + private Integer userid; + + /** + * 用户名 + */ + private String username; + + /** + * 表名 + */ + private String tablename; + + /** + * 角色 + */ + private String role; + + /** + * token + */ + private String token; + + /** + * 过期时间 + */ + private Date expiratedtime; + + /** + * 新增时间 + */ + private Date addtime; + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public Integer getUserid() { + return userid; + } + + public void setUserid(Integer userid) { + this.userid = userid; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public String getToken() { + return token; + } + + public String getTablename() { + return tablename; + } + + public void setTablename(String tablename) { + this.tablename = tablename; + } + + public void setToken(String token) { + this.token = token; + } + + public Date getExpiratedtime() { + return expiratedtime; + } + + public void setExpiratedtime(Date expiratedtime) { + this.expiratedtime = expiratedtime; + } + + public Date getAddtime() { + return addtime; + } + + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public TokenEntity(Integer userid, String username, String tablename,String role, String token, Date expiratedtime) { + super(); + this.userid = userid; + this.username = username; + this.tablename = tablename; + this.role = role; + this.token = token; + this.expiratedtime = expiratedtime; + } + + public TokenEntity() { + } + +} diff --git a/src/main/java/com/entity/UserEntity.java b/src/main/java/com/entity/UserEntity.java new file mode 100644 index 0000000..7bea646 --- /dev/null +++ b/src/main/java/com/entity/UserEntity.java @@ -0,0 +1,73 @@ +package com.entity; + +import java.io.Serializable; +import java.util.Date; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * 用户 + */ +@TableName("users") +public class UserEntity implements Serializable { + private static final long serialVersionUID = 1L; + + @TableId(type = IdType.AUTO) + private Integer id; + + /** + * 用户账号 + */ + private String username; + + /** + * 密码 + */ + private String password; + + /** + * 用户类型 + */ + private String role; + + private Date addtime; + + public String getUsername() { + return username; + } + + public void setUsername(String username) { + this.username = username; + } + + public String getPassword() { + return password; + } + + public void setPassword(String password) { + this.password = password; + } + + public String getRole() { + return role; + } + + public void setRole(String role) { + this.role = role; + } + + public Date getAddtime() { + return addtime; + } + + public void setAddtime(Date addtime) { + this.addtime = addtime; + } + + public Integer getId() { + return id; + } + +} diff --git a/src/main/java/com/entity/YijiedanEntity.java b/src/main/java/com/entity/YijiedanEntity.java new file mode 100644 index 0000000..1f37501 --- /dev/null +++ b/src/main/java/com/entity/YijiedanEntity.java @@ -0,0 +1,250 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * 已接单表 + * + * @author + * @email + * @date 2021-03-11 + */ +@TableName("yijiedan") +public class YijiedanEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public YijiedanEntity() { + + } + + public YijiedanEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + @TableField(value = "id") + + private Integer id; + + + /** + * 单号 + */ + @TableField(value = "odd") + + private String odd; + + + /** + * 发布人 + */ + @TableField(value = "yonghu_id") + + private Integer yonghuId; + + + /** + * 手机号 + */ + @TableField(value = "fbphone") + + private String fbphone; + + + /** + * 接单人 + */ + @TableField(value = "daiquren_id") + + private Integer daiqurenId; + + + /** + * 手机号 + */ + @TableField(value = "jdphone") + + private String jdphone; + + + /** + * 接单时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + @TableField(value = "initiate_time",fill = FieldFill.UPDATE) + + private Date initiateTime; + + + /** + * 订单状态 + */ + @TableField(value = "ddzt_types") + + private Integer ddztTypes; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:单号 + */ + public String getOdd() { + return odd; + } + + + /** + * 获取:单号 + */ + + public void setOdd(String odd) { + this.odd = odd; + } + /** + * 设置:发布人 + */ + public Integer getYonghuId() { + return yonghuId; + } + + + /** + * 获取:发布人 + */ + + public void setYonghuId(Integer yonghuId) { + this.yonghuId = yonghuId; + } + /** + * 设置:手机号 + */ + public String getFbphone() { + return fbphone; + } + + + /** + * 获取:手机号 + */ + + public void setFbphone(String fbphone) { + this.fbphone = fbphone; + } + /** + * 设置:接单人 + */ + public Integer getDaiqurenId() { + return daiqurenId; + } + + + /** + * 获取:接单人 + */ + + public void setDaiqurenId(Integer daiqurenId) { + this.daiqurenId = daiqurenId; + } + /** + * 设置:手机号 + */ + public String getJdphone() { + return jdphone; + } + + + /** + * 获取:手机号 + */ + + public void setJdphone(String jdphone) { + this.jdphone = jdphone; + } + /** + * 设置:接单时间 + */ + public Date getInitiateTime() { + return initiateTime; + } + + + /** + * 获取:接单时间 + */ + + public void setInitiateTime(Date initiateTime) { + this.initiateTime = initiateTime; + } + /** + * 设置:订单状态 + */ + public Integer getDdztTypes() { + return ddztTypes; + } + + + /** + * 获取:订单状态 + */ + + public void setDdztTypes(Integer ddztTypes) { + this.ddztTypes = ddztTypes; + } + + @Override + public String toString() { + return "Yijiedan{" + + "id=" + id + + ", odd=" + odd + + ", yonghuId=" + yonghuId + + ", fbphone=" + fbphone + + ", daiqurenId=" + daiqurenId + + ", jdphone=" + jdphone + + ", initiateTime=" + initiateTime + + ", ddztTypes=" + ddztTypes + + "}"; + } +} diff --git a/src/main/java/com/entity/YonghuEntity.java b/src/main/java/com/entity/YonghuEntity.java new file mode 100644 index 0000000..52ab9c1 --- /dev/null +++ b/src/main/java/com/entity/YonghuEntity.java @@ -0,0 +1,329 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * + * + * @author + * @email + * @date 2021-03-11 + */ +@TableName("yonghu") +public class YonghuEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public YonghuEntity() { + + } + + public YonghuEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + /** + * id + */ + @TableId(type = IdType.AUTO) + @TableField(value = "id") + + private Integer id; + + + /** + * 学号 + */ + @TableField(value = "studentnumber") + + private String studentnumber; + + + /** + * 用户名称 + */ + @TableField(value = "name") + + private String name; + + + /** + * 账号 + */ + @TableField(value = "username") + + private String username; + + + /** + * 密码 + */ + @TableField(value = "password") + + private String password; + + + /** + * 性别 + */ + @TableField(value = "sex_types") + + private Integer sexTypes; + @TableField(value = "yanzheng") + private Integer yanzheng; + + public Integer getYanzheng() { + return yanzheng; + } + + public void setYanzheng(Integer yanzheng) { + this.yanzheng = yanzheng; + } + + /** + * 头像 + */ + @TableField(value = "img_photo") + + private String imgPhoto; + + + /** + * 联系电话 + */ + @TableField(value = "phone") + + private String phone; + + + /** + * 住宿楼栋 + */ + @TableField(value = "zhuSuLou") + + private String zhuSuLou; + + + /** + * 寝室号 + */ + @TableField(value = "dormitory") + + private String dormitory; + + + /** + * 身份 + */ + @TableField(value = "role") + + private String role; + + + /** + * 设置:id + */ + public Integer getId() { + return id; + } + + + /** + * 获取:id + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:学号 + */ + public String getStudentnumber() { + return studentnumber; + } + + + /** + * 获取:学号 + */ + + public void setStudentnumber(String studentnumber) { + this.studentnumber = studentnumber; + } + /** + * 设置:用户名称 + */ + public String getName() { + return name; + } + + + /** + * 获取:用户名称 + */ + + public void setName(String name) { + this.name = name; + } + /** + * 设置:账号 + */ + public String getUsername() { + return username; + } + + + /** + * 获取:账号 + */ + + public void setUsername(String username) { + this.username = username; + } + /** + * 设置:密码 + */ + public String getPassword() { + return password; + } + + + /** + * 获取:密码 + */ + + public void setPassword(String password) { + this.password = password; + } + /** + * 设置:性别 + */ + public Integer getSexTypes() { + return sexTypes; + } + + + /** + * 获取:性别 + */ + + public void setSexTypes(Integer sexTypes) { + this.sexTypes = sexTypes; + } + /** + * 设置:头像 + */ + public String getImgPhoto() { + return imgPhoto; + } + + + /** + * 获取:头像 + */ + + public void setImgPhoto(String imgPhoto) { + this.imgPhoto = imgPhoto; + } + /** + * 设置:联系电话 + */ + public String getPhone() { + return phone; + } + + + /** + * 获取:联系电话 + */ + + public void setPhone(String phone) { + this.phone = phone; + } + /** + * 设置:住宿楼栋 + */ + public String getZhuSuLou() { + return zhuSuLou; + } + + + /** + * 获取:住宿楼栋 + */ + + public void setZhuSuLou(String zhuSuLou) { + this.zhuSuLou = zhuSuLou; + } + /** + * 设置:寝室号 + */ + public String getDormitory() { + return dormitory; + } + + + /** + * 获取:寝室号 + */ + + public void setDormitory(String dormitory) { + this.dormitory = dormitory; + } + /** + * 设置:身份 + */ + public String getRole() { + return role; + } + + + /** + * 获取:身份 + */ + + public void setRole(String role) { + this.role = role; + } + + @Override + public String toString() { + return "Yonghu{" + + "id=" + id + + ", studentnumber=" + studentnumber + + ", name=" + name + + ", username=" + username + + ", password=" + password + + ", sexTypes=" + sexTypes + + ", imgPhoto=" + imgPhoto + + ", phone=" + phone + + ", zhuSuLou=" + zhuSuLou + + ", dormitory=" + dormitory + + ", role=" + role + + "}"; + } +} diff --git a/src/main/java/com/entity/ZhandianEntity.java b/src/main/java/com/entity/ZhandianEntity.java new file mode 100644 index 0000000..060dde3 --- /dev/null +++ b/src/main/java/com/entity/ZhandianEntity.java @@ -0,0 +1,128 @@ +package com.entity; + +import com.baomidou.mybatisplus.annotations.TableId; +import com.baomidou.mybatisplus.annotations.TableName; +import javax.validation.constraints.NotBlank; +import javax.validation.constraints.NotEmpty; +import javax.validation.constraints.NotNull; + +import com.fasterxml.jackson.annotation.JsonIgnoreProperties; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; +import java.util.List; + +import org.springframework.format.annotation.DateTimeFormat; +import com.fasterxml.jackson.annotation.JsonFormat; +import org.apache.commons.beanutils.BeanUtils; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.enums.FieldFill; +import com.baomidou.mybatisplus.enums.IdType; + +/** + * 快递站点 + * + * @author + * @email + * @date 2021-03-11 + */ +@TableName("zhandian") +public class ZhandianEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + public ZhandianEntity() { + + } + + public ZhandianEntity(T t) { + try { + BeanUtils.copyProperties(this, t); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + /** + * 主键 + */ + @TableId(type = IdType.AUTO) + @TableField(value = "id") + + private Integer id; + + + /** + * 站点名称 + */ + @TableField(value = "zdname") + + private String zdname; + + + /** + * 站点地址 + */ + @TableField(value = "address") + + private String address; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:站点名称 + */ + public String getZdname() { + return zdname; + } + + + /** + * 获取:站点名称 + */ + + public void setZdname(String zdname) { + this.zdname = zdname; + } + /** + * 设置:站点地址 + */ + public String getAddress() { + return address; + } + + + /** + * 获取:站点地址 + */ + + public void setAddress(String address) { + this.address = address; + } + + @Override + public String toString() { + return "Zhandian{" + + "id=" + id + + ", zdname=" + zdname + + ", address=" + address + + "}"; + } +} diff --git a/src/main/java/com/entity/model/DaiquModel.java b/src/main/java/com/entity/model/DaiquModel.java new file mode 100644 index 0000000..10c412f --- /dev/null +++ b/src/main/java/com/entity/model/DaiquModel.java @@ -0,0 +1,210 @@ +package com.entity.model; + +import com.entity.DaiquEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * 待取件表 + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2021-03-11 + */ +public class DaiquModel implements Serializable { + private static final long serialVersionUID = 1L; + + + + + /** + * 主键 + */ + private Integer id; + + + /** + * 快递名称 + */ + private String dqname; + + + /** + * 站点 + */ + private Integer zhandianId; + + + /** + * 用户 + */ + private Integer yonghuId; + + + /** + * 快递大小 + */ + private Integer kddxTypes; + + + /** + * 手机号 + */ + private Integer dqphone; + + + /** + * 取件码 + */ + private String takecode; + + + /** + * 快递状态 + */ + private Integer kdztTypes; + + + /** + * 取件时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + private Date pickupTime; + + + /** + * 获取:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 设置:主键 + */ + public void setId(Integer id) { + this.id = id; + } + /** + * 获取:快递名称 + */ + public String getDqname() { + return dqname; + } + + + /** + * 设置:快递名称 + */ + public void setDqname(String dqname) { + this.dqname = dqname; + } + /** + * 获取:站点 + */ + public Integer getZhandianId() { + return zhandianId; + } + + + /** + * 设置:站点 + */ + public void setZhandianId(Integer zhandianId) { + this.zhandianId = zhandianId; + } + /** + * 获取:用户 + */ + public Integer getYonghuId() { + return yonghuId; + } + + + /** + * 设置:用户 + */ + public void setYonghuId(Integer yonghuId) { + this.yonghuId = yonghuId; + } + /** + * 获取:快递大小 + */ + public Integer getKddxTypes() { + return kddxTypes; + } + + + /** + * 设置:快递大小 + */ + public void setKddxTypes(Integer kddxTypes) { + this.kddxTypes = kddxTypes; + } + /** + * 获取:手机号 + */ + public Integer getDqphone() { + return dqphone; + } + + + /** + * 设置:手机号 + */ + public void setDqphone(Integer dqphone) { + this.dqphone = dqphone; + } + /** + * 获取:取件码 + */ + public String getTakecode() { + return takecode; + } + + + /** + * 设置:取件码 + */ + public void setTakecode(String takecode) { + this.takecode = takecode; + } + /** + * 获取:快递状态 + */ + public Integer getKdztTypes() { + return kdztTypes; + } + + + /** + * 设置:快递状态 + */ + public void setKdztTypes(Integer kdztTypes) { + this.kdztTypes = kdztTypes; + } + /** + * 获取:取件时间 + */ + public Date getPickupTime() { + return pickupTime; + } + + + /** + * 设置:取件时间 + */ + public void setPickupTime(Date pickupTime) { + this.pickupTime = pickupTime; + } + + } diff --git a/src/main/java/com/entity/model/DaiqurenModel.java b/src/main/java/com/entity/model/DaiqurenModel.java new file mode 100644 index 0000000..d952e97 --- /dev/null +++ b/src/main/java/com/entity/model/DaiqurenModel.java @@ -0,0 +1,188 @@ +package com.entity.model; + +import com.entity.DaiqurenEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2021-03-11 + */ +public class DaiqurenModel implements Serializable { + private static final long serialVersionUID = 1L; + + + + + /** + * id + */ + private Integer id; + + + /** + * 用户名称 + */ + private String name; + + + /** + * 账号 + */ + private String username; + + + /** + * 密码 + */ + private String password; + + + /** + * 性别 + */ + private Integer sexTypes; + + + /** + * 头像 + */ + private String imgPhoto; + + + /** + * 联系电话 + */ + private String phone; + + + /** + * 身份 + */ + private String role; + + + /** + * 获取:id + */ + public Integer getId() { + return id; + } + + + /** + * 设置:id + */ + public void setId(Integer id) { + this.id = id; + } + /** + * 获取:用户名称 + */ + public String getName() { + return name; + } + + + /** + * 设置:用户名称 + */ + public void setName(String name) { + this.name = name; + } + /** + * 获取:账号 + */ + public String getUsername() { + return username; + } + + + /** + * 设置:账号 + */ + public void setUsername(String username) { + this.username = username; + } + /** + * 获取:密码 + */ + public String getPassword() { + return password; + } + + + /** + * 设置:密码 + */ + public void setPassword(String password) { + this.password = password; + } + /** + * 获取:性别 + */ + public Integer getSexTypes() { + return sexTypes; + } + + + /** + * 设置:性别 + */ + public void setSexTypes(Integer sexTypes) { + this.sexTypes = sexTypes; + } + /** + * 获取:头像 + */ + public String getImgPhoto() { + return imgPhoto; + } + + + /** + * 设置:头像 + */ + public void setImgPhoto(String imgPhoto) { + this.imgPhoto = imgPhoto; + } + /** + * 获取:联系电话 + */ + public String getPhone() { + return phone; + } + + + /** + * 设置:联系电话 + */ + public void setPhone(String phone) { + this.phone = phone; + } + /** + * 获取:身份 + */ + public String getRole() { + return role; + } + + + /** + * 设置:身份 + */ + public void setRole(String role) { + this.role = role; + } + + } diff --git a/src/main/java/com/entity/model/DictionaryModel.java b/src/main/java/com/entity/model/DictionaryModel.java new file mode 100644 index 0000000..9e2d9ee --- /dev/null +++ b/src/main/java/com/entity/model/DictionaryModel.java @@ -0,0 +1,170 @@ +package com.entity.model; + +import com.entity.DictionaryEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * 字典表 + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2021-03-11 + */ +public class DictionaryModel implements Serializable { + private static final long serialVersionUID = 1L; + + + + + /** + * 主键 + */ + private Integer id; + + + /** + * 字段 + */ + private String dicCode; + + + /** + * 字段名 + */ + private String dicName; + + + /** + * 编码 + */ + private Integer codeIndex; + + + /** + * 编码名字 + */ + private String indexName; + + + /** + * 父字段id + */ + private Integer superId; + + + /** + * 创建时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + private Date createTime; + + + /** + * 获取:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 设置:主键 + */ + public void setId(Integer id) { + this.id = id; + } + /** + * 获取:字段 + */ + public String getDicCode() { + return dicCode; + } + + + /** + * 设置:字段 + */ + public void setDicCode(String dicCode) { + this.dicCode = dicCode; + } + /** + * 获取:字段名 + */ + public String getDicName() { + return dicName; + } + + + /** + * 设置:字段名 + */ + public void setDicName(String dicName) { + this.dicName = dicName; + } + /** + * 获取:编码 + */ + public Integer getCodeIndex() { + return codeIndex; + } + + + /** + * 设置:编码 + */ + public void setCodeIndex(Integer codeIndex) { + this.codeIndex = codeIndex; + } + /** + * 获取:编码名字 + */ + public String getIndexName() { + return indexName; + } + + + /** + * 设置:编码名字 + */ + public void setIndexName(String indexName) { + this.indexName = indexName; + } + /** + * 获取:父字段id + */ + public Integer getSuperId() { + return superId; + } + + + /** + * 设置:父字段id + */ + public void setSuperId(Integer superId) { + this.superId = superId; + } + /** + * 获取:创建时间 + */ + public Date getCreateTime() { + return createTime; + } + + + /** + * 设置:创建时间 + */ + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + + } diff --git a/src/main/java/com/entity/model/JiedanModel.java b/src/main/java/com/entity/model/JiedanModel.java new file mode 100644 index 0000000..fe3b15e --- /dev/null +++ b/src/main/java/com/entity/model/JiedanModel.java @@ -0,0 +1,250 @@ +package com.entity.model; + +import com.entity.JiedanEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * 快递接单表 + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2021-03-11 + */ +public class JiedanModel implements Serializable { + private static final long serialVersionUID = 1L; + + + + + /** + * 主键 + */ + private Integer id; + + + /** + * 单号 + */ + private String odd; + + + /** + * 快递名称 + */ + private Integer daiqukuaidiId; + + + /** + * 发布人 + */ + private Integer jdyonghuId; + + + /** + * 发布时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + private Date initiateTime; + + + /** + * 收件人名称 + */ + private String addresseename; + + + /** + * 电话 + */ + private String jdphone; + + + /** + * 地址 + */ + private String jdaddressee; + + + /** + * (取/寄)件码 + */ + private String jdtakecode; + + + /** + * 快递状态 + */ + private Integer jdztTypes; + + + /** + * 快递类型 + */ + private Integer kdlxTypes; + + + /** + * 获取:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 设置:主键 + */ + public void setId(Integer id) { + this.id = id; + } + /** + * 获取:单号 + */ + public String getOdd() { + return odd; + } + + + /** + * 设置:单号 + */ + public void setOdd(String odd) { + this.odd = odd; + } + /** + * 获取:快递名称 + */ + public Integer getDaiqukuaidiId() { + return daiqukuaidiId; + } + + + /** + * 设置:快递名称 + */ + public void setDaiqukuaidiId(Integer daiqukuaidiId) { + this.daiqukuaidiId = daiqukuaidiId; + } + /** + * 获取:发布人 + */ + public Integer getJdyonghuId() { + return jdyonghuId; + } + + + /** + * 设置:发布人 + */ + public void setJdyonghuId(Integer jdyonghuId) { + this.jdyonghuId = jdyonghuId; + } + /** + * 获取:发布时间 + */ + public Date getInitiateTime() { + return initiateTime; + } + + + /** + * 设置:发布时间 + */ + public void setInitiateTime(Date initiateTime) { + this.initiateTime = initiateTime; + } + /** + * 获取:收件人名称 + */ + public String getAddresseename() { + return addresseename; + } + + + /** + * 设置:收件人名称 + */ + public void setAddresseename(String addresseename) { + this.addresseename = addresseename; + } + /** + * 获取:电话 + */ + public String getJdphone() { + return jdphone; + } + + + /** + * 设置:电话 + */ + public void setJdphone(String jdphone) { + this.jdphone = jdphone; + } + /** + * 获取:地址 + */ + public String getJdaddressee() { + return jdaddressee; + } + + + /** + * 设置:地址 + */ + public void setJdaddressee(String jdaddressee) { + this.jdaddressee = jdaddressee; + } + /** + * 获取:(取/寄)件码 + */ + public String getJdtakecode() { + return jdtakecode; + } + + + /** + * 设置:(取/寄)件码 + */ + public void setJdtakecode(String jdtakecode) { + this.jdtakecode = jdtakecode; + } + /** + * 获取:快递状态 + */ + public Integer getJdztTypes() { + return jdztTypes; + } + + + /** + * 设置:快递状态 + */ + public void setJdztTypes(Integer jdztTypes) { + this.jdztTypes = jdztTypes; + } + /** + * 获取:快递类型 + */ + public Integer getKdlxTypes() { + return kdlxTypes; + } + + + /** + * 设置:快递类型 + */ + public void setKdlxTypes(Integer kdlxTypes) { + this.kdlxTypes = kdlxTypes; + } + + } diff --git a/src/main/java/com/entity/model/YijiedanModel.java b/src/main/java/com/entity/model/YijiedanModel.java new file mode 100644 index 0000000..75c158d --- /dev/null +++ b/src/main/java/com/entity/model/YijiedanModel.java @@ -0,0 +1,190 @@ +package com.entity.model; + +import com.entity.YijiedanEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * 已接单表 + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2021-03-11 + */ +public class YijiedanModel implements Serializable { + private static final long serialVersionUID = 1L; + + + + + /** + * 主键 + */ + private Integer id; + + + /** + * 单号 + */ + private String odd; + + + /** + * 发布人 + */ + private Integer yonghuId; + + + /** + * 手机号 + */ + private String fbphone; + + + /** + * 接单人 + */ + private Integer daiqurenId; + + + /** + * 手机号 + */ + private String jdphone; + + + /** + * 接单时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + private Date initiateTime; + + + /** + * 订单状态 + */ + private Integer ddztTypes; + + + /** + * 获取:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 设置:主键 + */ + public void setId(Integer id) { + this.id = id; + } + /** + * 获取:单号 + */ + public String getOdd() { + return odd; + } + + + /** + * 设置:单号 + */ + public void setOdd(String odd) { + this.odd = odd; + } + /** + * 获取:发布人 + */ + public Integer getYonghuId() { + return yonghuId; + } + + + /** + * 设置:发布人 + */ + public void setYonghuId(Integer yonghuId) { + this.yonghuId = yonghuId; + } + /** + * 获取:手机号 + */ + public String getFbphone() { + return fbphone; + } + + + /** + * 设置:手机号 + */ + public void setFbphone(String fbphone) { + this.fbphone = fbphone; + } + /** + * 获取:接单人 + */ + public Integer getDaiqurenId() { + return daiqurenId; + } + + + /** + * 设置:接单人 + */ + public void setDaiqurenId(Integer daiqurenId) { + this.daiqurenId = daiqurenId; + } + /** + * 获取:手机号 + */ + public String getJdphone() { + return jdphone; + } + + + /** + * 设置:手机号 + */ + public void setJdphone(String jdphone) { + this.jdphone = jdphone; + } + /** + * 获取:接单时间 + */ + public Date getInitiateTime() { + return initiateTime; + } + + + /** + * 设置:接单时间 + */ + public void setInitiateTime(Date initiateTime) { + this.initiateTime = initiateTime; + } + /** + * 获取:订单状态 + */ + public Integer getDdztTypes() { + return ddztTypes; + } + + + /** + * 设置:订单状态 + */ + public void setDdztTypes(Integer ddztTypes) { + this.ddztTypes = ddztTypes; + } + + } diff --git a/src/main/java/com/entity/model/YonghuModel.java b/src/main/java/com/entity/model/YonghuModel.java new file mode 100644 index 0000000..300273d --- /dev/null +++ b/src/main/java/com/entity/model/YonghuModel.java @@ -0,0 +1,248 @@ +package com.entity.model; + +import com.entity.YonghuEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2021-03-11 + */ +public class YonghuModel implements Serializable { + private static final long serialVersionUID = 1L; + + + + + /** + * id + */ + private Integer id; + + + /** + * 学号 + */ + private String studentnumber; + + + /** + * 用户名称 + */ + private String name; + + + /** + * 账号 + */ + private String username; + + + /** + * 密码 + */ + private String password; + + + /** + * 性别 + */ + private Integer sexTypes; + + + /** + * 头像 + */ + private String imgPhoto; + + + /** + * 联系电话 + */ + private String phone; + + + /** + * 住宿楼栋 + */ + private String zhuSuLou; + + + /** + * 寝室号 + */ + private String dormitory; + + + /** + * 身份 + */ + private String role; + + + /** + * 获取:id + */ + public Integer getId() { + return id; + } + + + /** + * 设置:id + */ + public void setId(Integer id) { + this.id = id; + } + /** + * 获取:学号 + */ + public String getStudentnumber() { + return studentnumber; + } + + + /** + * 设置:学号 + */ + public void setStudentnumber(String studentnumber) { + this.studentnumber = studentnumber; + } + /** + * 获取:用户名称 + */ + public String getName() { + return name; + } + + + /** + * 设置:用户名称 + */ + public void setName(String name) { + this.name = name; + } + /** + * 获取:账号 + */ + public String getUsername() { + return username; + } + + + /** + * 设置:账号 + */ + public void setUsername(String username) { + this.username = username; + } + /** + * 获取:密码 + */ + public String getPassword() { + return password; + } + + + /** + * 设置:密码 + */ + public void setPassword(String password) { + this.password = password; + } + /** + * 获取:性别 + */ + public Integer getSexTypes() { + return sexTypes; + } + + + /** + * 设置:性别 + */ + public void setSexTypes(Integer sexTypes) { + this.sexTypes = sexTypes; + } + /** + * 获取:头像 + */ + public String getImgPhoto() { + return imgPhoto; + } + + + /** + * 设置:头像 + */ + public void setImgPhoto(String imgPhoto) { + this.imgPhoto = imgPhoto; + } + /** + * 获取:联系电话 + */ + public String getPhone() { + return phone; + } + + + /** + * 设置:联系电话 + */ + public void setPhone(String phone) { + this.phone = phone; + } + /** + * 获取:住宿楼栋 + */ + public String getZhuSuLou() { + return zhuSuLou; + } + + + /** + * 设置:住宿楼栋 + */ + public void setZhuSuLou(String zhuSuLou) { + this.zhuSuLou = zhuSuLou; + } + /** + * 获取:寝室号 + */ + public String getDormitory() { + return dormitory; + } + + + /** + * 设置:寝室号 + */ + public void setDormitory(String dormitory) { + this.dormitory = dormitory; + } + /** + * 获取:身份 + */ + public String getRole() { + return role; + } + + + /** + * 设置:身份 + */ + public void setRole(String role) { + this.role = role; + } + + } diff --git a/src/main/java/com/entity/model/ZhandianModel.java b/src/main/java/com/entity/model/ZhandianModel.java new file mode 100644 index 0000000..aef534e --- /dev/null +++ b/src/main/java/com/entity/model/ZhandianModel.java @@ -0,0 +1,88 @@ +package com.entity.model; + +import com.entity.ZhandianEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; +import java.io.Serializable; + + +/** + * 快递站点 + * 接收传参的实体类 + *(实际开发中配合移动端接口开发手动去掉些没用的字段, 后端一般用entity就够用了) + * 取自ModelAndView 的model名称 + * @author + * @email + * @date 2021-03-11 + */ +public class ZhandianModel implements Serializable { + private static final long serialVersionUID = 1L; + + + + + /** + * 主键 + */ + private Integer id; + + + /** + * 站点名称 + */ + private String zdname; + + + /** + * 站点地址 + */ + private String address; + + + /** + * 获取:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 设置:主键 + */ + public void setId(Integer id) { + this.id = id; + } + /** + * 获取:站点名称 + */ + public String getZdname() { + return zdname; + } + + + /** + * 设置:站点名称 + */ + public void setZdname(String zdname) { + this.zdname = zdname; + } + /** + * 获取:站点地址 + */ + public String getAddress() { + return address; + } + + + /** + * 设置:站点地址 + */ + public void setAddress(String address) { + this.address = address; + } + + } diff --git a/src/main/java/com/entity/view/DaiquView.java b/src/main/java/com/entity/view/DaiquView.java new file mode 100644 index 0000000..c105bd6 --- /dev/null +++ b/src/main/java/com/entity/view/DaiquView.java @@ -0,0 +1,315 @@ +package com.entity.view; + +import com.entity.DaiquEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; + +/** + * 待取件表 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("daiqu") +public class DaiquView extends DaiquEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 快递大小的值 + */ + private String kddxValue; + /** + * 快递状态的值 + */ + private String kdztValue; + + + + //级联表 yonghu + /** + * 学号 + */ + private String studentnumber; + /** + * 用户名称 + */ + private String name; + /** + * 账号 + */ + private String username; + /** + * 密码 + */ + private String password; + /** + * 性别 + */ + private Integer sexTypes; + /** + * 性别的值 + */ + private String sexValue; + /** + * 头像 + */ + private String imgPhoto; + /** + * 联系电话 + */ + private String phone; + /** + * 住宿楼栋 + */ + private String zhuSuLou; + /** + * 寝室号 + */ + private String dormitory; + /** + * 身份 + */ + private String role; + + //级联表 zhandian + /** + * 站点名称 + */ + private String zdname; + /** + * 站点地址 + */ + private String address; + + public DaiquView() { + + } + + public DaiquView(DaiquEntity daiquEntity) { + try { + BeanUtils.copyProperties(this, daiquEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + /** + * 获取: 快递大小的值 + */ + public String getKddxValue() { + return kddxValue; + } + /** + * 设置: 快递大小的值 + */ + public void setKddxValue(String kddxValue) { + this.kddxValue = kddxValue; + } + /** + * 获取: 快递状态的值 + */ + public String getKdztValue() { + return kdztValue; + } + /** + * 设置: 快递状态的值 + */ + public void setKdztValue(String kdztValue) { + this.kdztValue = kdztValue; + } + + + + + + + + + + + + + + + + + + + + + //级联表的get和set yonghu + /** + * 获取: 学号 + */ + public String getStudentnumber() { + return studentnumber; + } + /** + * 设置: 学号 + */ + public void setStudentnumber(String studentnumber) { + this.studentnumber = studentnumber; + } + /** + * 获取: 用户名称 + */ + public String getName() { + return name; + } + /** + * 设置: 用户名称 + */ + public void setName(String name) { + this.name = name; + } + /** + * 获取: 账号 + */ + public String getUsername() { + return username; + } + /** + * 设置: 账号 + */ + public void setUsername(String username) { + this.username = username; + } + /** + * 获取: 密码 + */ + public String getPassword() { + return password; + } + /** + * 设置: 密码 + */ + public void setPassword(String password) { + this.password = password; + } + /** + * 获取: 性别 + */ + public Integer getSexTypes() { + return sexTypes; + } + /** + * 设置: 性别 + */ + public void setSexTypes(Integer sexTypes) { + this.sexTypes = sexTypes; + } + + + /** + * 获取: 性别的值 + */ + public String getSexValue() { + return sexValue; + } + /** + * 设置: 性别的值 + */ + public void setSexValue(String sexValue) { + this.sexValue = sexValue; + } + /** + * 获取: 头像 + */ + public String getImgPhoto() { + return imgPhoto; + } + /** + * 设置: 头像 + */ + public void setImgPhoto(String imgPhoto) { + this.imgPhoto = imgPhoto; + } + /** + * 获取: 联系电话 + */ + public String getPhone() { + return phone; + } + /** + * 设置: 联系电话 + */ + public void setPhone(String phone) { + this.phone = phone; + } + /** + * 获取: 住宿楼栋 + */ + public String getZhuSuLou() { + return zhuSuLou; + } + /** + * 设置: 住宿楼栋 + */ + public void setZhuSuLou(String zhuSuLou) { + this.zhuSuLou = zhuSuLou; + } + /** + * 获取: 寝室号 + */ + public String getDormitory() { + return dormitory; + } + /** + * 设置: 寝室号 + */ + public void setDormitory(String dormitory) { + this.dormitory = dormitory; + } + /** + * 获取: 身份 + */ + public String getRole() { + return role; + } + /** + * 设置: 身份 + */ + public void setRole(String role) { + this.role = role; + } + + + //级联表的get和set zhandian + /** + * 获取: 站点名称 + */ + public String getZdname() { + return zdname; + } + /** + * 设置: 站点名称 + */ + public void setZdname(String zdname) { + this.zdname = zdname; + } + /** + * 获取: 站点地址 + */ + public String getAddress() { + return address; + } + /** + * 设置: 站点地址 + */ + public void setAddress(String address) { + this.address = address; + } + + + + +} diff --git a/src/main/java/com/entity/view/DaiqurenView.java b/src/main/java/com/entity/view/DaiqurenView.java new file mode 100644 index 0000000..8c48618 --- /dev/null +++ b/src/main/java/com/entity/view/DaiqurenView.java @@ -0,0 +1,67 @@ +package com.entity.view; + +import com.entity.DaiqurenEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("daiquren") +public class DaiqurenView extends DaiqurenEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 性别的值 + */ + private String sexValue; + + + + public DaiqurenView() { + + } + + public DaiqurenView(DaiqurenEntity daiqurenEntity) { + try { + BeanUtils.copyProperties(this, daiqurenEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + /** + * 获取: 性别的值 + */ + public String getSexValue() { + return sexValue; + } + /** + * 设置: 性别的值 + */ + public void setSexValue(String sexValue) { + this.sexValue = sexValue; + } + + + + + + + + + + +} diff --git a/src/main/java/com/entity/view/DictionaryView.java b/src/main/java/com/entity/view/DictionaryView.java new file mode 100644 index 0000000..51a6931 --- /dev/null +++ b/src/main/java/com/entity/view/DictionaryView.java @@ -0,0 +1,59 @@ +package com.entity.view; + +import com.entity.DictionaryEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; + +/** + * 字典表 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("dictionary") +public class DictionaryView extends DictionaryEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + + public DictionaryView() { + + } + + public DictionaryView(DictionaryEntity dictionaryEntity) { + try { + BeanUtils.copyProperties(this, dictionaryEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/com/entity/view/JiedanView.java b/src/main/java/com/entity/view/JiedanView.java new file mode 100644 index 0000000..b699493 --- /dev/null +++ b/src/main/java/com/entity/view/JiedanView.java @@ -0,0 +1,107 @@ +package com.entity.view; + +import com.entity.JiedanEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; + +/** + * 快递接单表 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("jiedan") +public class JiedanView extends JiedanEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 快递状态的值 + */ + private String jdztValue; + /** + * 快递类型的值 + */ + private String kdlxValue; + + private String fbrname; + + + + public JiedanView() { + + } + + public JiedanView(JiedanEntity jiedanEntity) { + try { + BeanUtils.copyProperties(this, jiedanEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + public String getFbrname() { + return fbrname; + } + + public void setFbrname(String fbrname) { + this.fbrname = fbrname; + } + + /** + * 获取: 快递状态的值 + */ + public String getJdztValue() { + return jdztValue; + } + /** + * 设置: 快递状态的值 + */ + public void setJdztValue(String jdztValue) { + this.jdztValue = jdztValue; + } + /** + * 获取: 快递类型的值 + */ + public String getKdlxValue() { + return kdlxValue; + } + /** + * 设置: 快递类型的值 + */ + public void setKdlxValue(String kdlxValue) { + this.kdlxValue = kdlxValue; + } + + + + + + + + + + + + + + + + + + + + + + + + + + +} diff --git a/src/main/java/com/entity/view/YijiedanView.java b/src/main/java/com/entity/view/YijiedanView.java new file mode 100644 index 0000000..8355f18 --- /dev/null +++ b/src/main/java/com/entity/view/YijiedanView.java @@ -0,0 +1,269 @@ +package com.entity.view; + +import com.entity.YijiedanEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; + +/** + * 已接单表 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("yijiedan") +public class YijiedanView extends YijiedanEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 订单状态的值 + */ + private String ddztValue; + + + + //级联表 daiquren + /** + * 用户名称 + */ + private String yhname; + /** + * 账号 + */ + private String username; + /** + * 密码 + */ + private String password; + /** + * 性别 + */ + private Integer sexTypes; + /** + * 性别的值 + */ + private String sexValue; + /** + * 头像 + */ + private String imgPhoto; + /** + * 联系电话 + */ + private String phone; + /** + * 身份 + */ + private String role; + + //级联表 yonghu + /** + * 学号 + */ + private String studentnumber; + + private String name; + + + /** + * 住宿楼栋 + */ + private String zhuSuLou; + /** + * 寝室号 + */ + private String dormitory; + public YijiedanView() { + + } + + public YijiedanView(YijiedanEntity yijiedanEntity) { + try { + BeanUtils.copyProperties(this, yijiedanEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + /** + * 获取: 订单状态的值 + */ + public String getDdztValue() { + return ddztValue; + } + /** + * 设置: 订单状态的值 + */ + public void setDdztValue(String ddztValue) { + this.ddztValue = ddztValue; + } + + + + + + + + + + + + + + //级联表的get和set yonghu + /** + * 获取: 学号 + */ + public String getStudentnumber() { + return studentnumber; + } + /** + * 设置: 学号 + */ + public void setStudentnumber(String studentnumber) { + this.studentnumber = studentnumber; + } + + public String getYhname() { + return yhname; + } + + public void setYhname(String yhname) { + this.yhname = yhname; + } + + + public String getName() { + return name; + } + + public void setName(String name) { + this.name = name; + } + + /** + * 获取: 账号 + */ + public String getUsername() { + return username; + } + /** + * 设置: 账号 + */ + public void setUsername(String username) { + this.username = username; + } + /** + * 获取: 密码 + */ + public String getPassword() { + return password; + } + /** + * 设置: 密码 + */ + public void setPassword(String password) { + this.password = password; + } + /** + * 获取: 性别 + */ + public Integer getSexTypes() { + return sexTypes; + } + /** + * 设置: 性别 + */ + public void setSexTypes(Integer sexTypes) { + this.sexTypes = sexTypes; + } + + + /** + * 获取: 性别的值 + */ + public String getSexValue() { + return sexValue; + } + /** + * 设置: 性别的值 + */ + public void setSexValue(String sexValue) { + this.sexValue = sexValue; + } + /** + * 获取: 头像 + */ + public String getImgPhoto() { + return imgPhoto; + } + /** + * 设置: 头像 + */ + public void setImgPhoto(String imgPhoto) { + this.imgPhoto = imgPhoto; + } + /** + * 获取: 联系电话 + */ + public String getPhone() { + return phone; + } + /** + * 设置: 联系电话 + */ + public void setPhone(String phone) { + this.phone = phone; + } + /** + * 获取: 住宿楼栋 + */ + public String getZhuSuLou() { + return zhuSuLou; + } + /** + * 设置: 住宿楼栋 + */ + public void setZhuSuLou(String zhuSuLou) { + this.zhuSuLou = zhuSuLou; + } + /** + * 获取: 寝室号 + */ + public String getDormitory() { + return dormitory; + } + /** + * 设置: 寝室号 + */ + public void setDormitory(String dormitory) { + this.dormitory = dormitory; + } + /** + * 获取: 身份 + */ + public String getRole() { + return role; + } + /** + * 设置: 身份 + */ + public void setRole(String role) { + this.role = role; + } + + + + + + + +} diff --git a/src/main/java/com/entity/view/YonghuView.java b/src/main/java/com/entity/view/YonghuView.java new file mode 100644 index 0000000..c054983 --- /dev/null +++ b/src/main/java/com/entity/view/YonghuView.java @@ -0,0 +1,67 @@ +package com.entity.view; + +import com.entity.YonghuEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; + +/** + * + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("yonghu") +public class YonghuView extends YonghuEntity implements Serializable { + private static final long serialVersionUID = 1L; + /** + * 性别的值 + */ + private String sexValue; + + + + public YonghuView() { + + } + + public YonghuView(YonghuEntity yonghuEntity) { + try { + BeanUtils.copyProperties(this, yonghuEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + /** + * 获取: 性别的值 + */ + public String getSexValue() { + return sexValue; + } + /** + * 设置: 性别的值 + */ + public void setSexValue(String sexValue) { + this.sexValue = sexValue; + } + + + + + + + + + + +} diff --git a/src/main/java/com/entity/view/ZhandianView.java b/src/main/java/com/entity/view/ZhandianView.java new file mode 100644 index 0000000..d048b95 --- /dev/null +++ b/src/main/java/com/entity/view/ZhandianView.java @@ -0,0 +1,51 @@ +package com.entity.view; + +import com.entity.ZhandianEntity; + +import com.baomidou.mybatisplus.annotations.TableName; +import org.apache.commons.beanutils.BeanUtils; +import java.lang.reflect.InvocationTargetException; + +import java.io.Serializable; +import java.util.Date; + +/** + * 快递站点 + * 后端返回视图实体辅助类 + * (通常后端关联的表或者自定义的字段需要返回使用) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("zhandian") +public class ZhandianView extends ZhandianEntity implements Serializable { + private static final long serialVersionUID = 1L; + + + + public ZhandianView() { + + } + + public ZhandianView(ZhandianEntity zhandianEntity) { + try { + BeanUtils.copyProperties(this, zhandianEntity); + } catch (IllegalAccessException | InvocationTargetException e) { + // TODO Auto-generated catch block + e.printStackTrace(); + } + } + + + + + + + + + + + + + +} diff --git a/src/main/java/com/entity/vo/DaiquVO.java b/src/main/java/com/entity/vo/DaiquVO.java new file mode 100644 index 0000000..fe88a2b --- /dev/null +++ b/src/main/java/com/entity/vo/DaiquVO.java @@ -0,0 +1,235 @@ +package com.entity.vo; + +import com.entity.DaiquEntity; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * 待取件表 + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("daiqu") +public class DaiquVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 主键 + */ + + @TableField(value = "id") + private Integer id; + + + /** + * 快递名称 + */ + + @TableField(value = "dqname") + private String dqname; + + + /** + * 站点 + */ + + @TableField(value = "zhandian_id") + private Integer zhandianId; + + + /** + * 用户 + */ + + @TableField(value = "yonghu_id") + private Integer yonghuId; + + + /** + * 快递大小 + */ + + @TableField(value = "kddx_types") + private Integer kddxTypes; + + + /** + * 手机号 + */ + + @TableField(value = "dqphone") + private Integer dqphone; + + + /** + * 取件码 + */ + + @TableField(value = "takecode") + private String takecode; + + + /** + * 快递状态 + */ + + @TableField(value = "kdzt_types") + private Integer kdztTypes; + + + /** + * 取件时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + + @TableField(value = "pickup_time") + private Date pickupTime; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:快递名称 + */ + public String getDqname() { + return dqname; + } + + + /** + * 获取:快递名称 + */ + + public void setDqname(String dqname) { + this.dqname = dqname; + } + /** + * 设置:站点 + */ + public Integer getZhandianId() { + return zhandianId; + } + + + /** + * 获取:站点 + */ + + public void setZhandianId(Integer zhandianId) { + this.zhandianId = zhandianId; + } + /** + * 设置:用户 + */ + public Integer getYonghuId() { + return yonghuId; + } + + + /** + * 获取:用户 + */ + + public void setYonghuId(Integer yonghuId) { + this.yonghuId = yonghuId; + } + /** + * 设置:快递大小 + */ + public Integer getKddxTypes() { + return kddxTypes; + } + + + /** + * 获取:快递大小 + */ + + public void setKddxTypes(Integer kddxTypes) { + this.kddxTypes = kddxTypes; + } + /** + * 设置:手机号 + */ + public Integer getDqphone() { + return dqphone; + } + + + /** + * 获取:手机号 + */ + + public void setDqphone(Integer dqphone) { + this.dqphone = dqphone; + } + /** + * 设置:取件码 + */ + public String getTakecode() { + return takecode; + } + + + /** + * 获取:取件码 + */ + + public void setTakecode(String takecode) { + this.takecode = takecode; + } + /** + * 设置:快递状态 + */ + public Integer getKdztTypes() { + return kdztTypes; + } + + + /** + * 获取:快递状态 + */ + + public void setKdztTypes(Integer kdztTypes) { + this.kdztTypes = kdztTypes; + } + /** + * 设置:取件时间 + */ + public Date getPickupTime() { + return pickupTime; + } + + + /** + * 获取:取件时间 + */ + + public void setPickupTime(Date pickupTime) { + this.pickupTime = pickupTime; + } + +} diff --git a/src/main/java/com/entity/vo/DaiqurenVO.java b/src/main/java/com/entity/vo/DaiqurenVO.java new file mode 100644 index 0000000..8a67991 --- /dev/null +++ b/src/main/java/com/entity/vo/DaiqurenVO.java @@ -0,0 +1,210 @@ +package com.entity.vo; + +import com.entity.DaiqurenEntity; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("daiquren") +public class DaiqurenVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * id + */ + + @TableField(value = "id") + private Integer id; + + + /** + * 用户名称 + */ + + @TableField(value = "name") + private String name; + + + /** + * 账号 + */ + + @TableField(value = "username") + private String username; + + + /** + * 密码 + */ + + @TableField(value = "password") + private String password; + + + /** + * 性别 + */ + + @TableField(value = "sex_types") + private Integer sexTypes; + + + /** + * 头像 + */ + + @TableField(value = "img_photo") + private String imgPhoto; + + + /** + * 联系电话 + */ + + @TableField(value = "phone") + private String phone; + + + /** + * 身份 + */ + + @TableField(value = "role") + private String role; + + + /** + * 设置:id + */ + public Integer getId() { + return id; + } + + + /** + * 获取:id + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:用户名称 + */ + public String getName() { + return name; + } + + + /** + * 获取:用户名称 + */ + + public void setName(String name) { + this.name = name; + } + /** + * 设置:账号 + */ + public String getUsername() { + return username; + } + + + /** + * 获取:账号 + */ + + public void setUsername(String username) { + this.username = username; + } + /** + * 设置:密码 + */ + public String getPassword() { + return password; + } + + + /** + * 获取:密码 + */ + + public void setPassword(String password) { + this.password = password; + } + /** + * 设置:性别 + */ + public Integer getSexTypes() { + return sexTypes; + } + + + /** + * 获取:性别 + */ + + public void setSexTypes(Integer sexTypes) { + this.sexTypes = sexTypes; + } + /** + * 设置:头像 + */ + public String getImgPhoto() { + return imgPhoto; + } + + + /** + * 获取:头像 + */ + + public void setImgPhoto(String imgPhoto) { + this.imgPhoto = imgPhoto; + } + /** + * 设置:联系电话 + */ + public String getPhone() { + return phone; + } + + + /** + * 获取:联系电话 + */ + + public void setPhone(String phone) { + this.phone = phone; + } + /** + * 设置:身份 + */ + public String getRole() { + return role; + } + + + /** + * 获取:身份 + */ + + public void setRole(String role) { + this.role = role; + } + +} diff --git a/src/main/java/com/entity/vo/DictionaryVO.java b/src/main/java/com/entity/vo/DictionaryVO.java new file mode 100644 index 0000000..c560d09 --- /dev/null +++ b/src/main/java/com/entity/vo/DictionaryVO.java @@ -0,0 +1,189 @@ +package com.entity.vo; + +import com.entity.DictionaryEntity; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * 字典表 + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("dictionary") +public class DictionaryVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 主键 + */ + + @TableField(value = "id") + private Integer id; + + + /** + * 字段 + */ + + @TableField(value = "dic_code") + private String dicCode; + + + /** + * 字段名 + */ + + @TableField(value = "dic_name") + private String dicName; + + + /** + * 编码 + */ + + @TableField(value = "code_index") + private Integer codeIndex; + + + /** + * 编码名字 + */ + + @TableField(value = "index_name") + private String indexName; + + + /** + * 父字段id + */ + + @TableField(value = "super_id") + private Integer superId; + + + /** + * 创建时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + + @TableField(value = "create_time") + private Date createTime; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:字段 + */ + public String getDicCode() { + return dicCode; + } + + + /** + * 获取:字段 + */ + + public void setDicCode(String dicCode) { + this.dicCode = dicCode; + } + /** + * 设置:字段名 + */ + public String getDicName() { + return dicName; + } + + + /** + * 获取:字段名 + */ + + public void setDicName(String dicName) { + this.dicName = dicName; + } + /** + * 设置:编码 + */ + public Integer getCodeIndex() { + return codeIndex; + } + + + /** + * 获取:编码 + */ + + public void setCodeIndex(Integer codeIndex) { + this.codeIndex = codeIndex; + } + /** + * 设置:编码名字 + */ + public String getIndexName() { + return indexName; + } + + + /** + * 获取:编码名字 + */ + + public void setIndexName(String indexName) { + this.indexName = indexName; + } + /** + * 设置:父字段id + */ + public Integer getSuperId() { + return superId; + } + + + /** + * 获取:父字段id + */ + + public void setSuperId(Integer superId) { + this.superId = superId; + } + /** + * 设置:创建时间 + */ + public Date getCreateTime() { + return createTime; + } + + + /** + * 获取:创建时间 + */ + + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + +} diff --git a/src/main/java/com/entity/vo/JiedanVO.java b/src/main/java/com/entity/vo/JiedanVO.java new file mode 100644 index 0000000..ddb67bb --- /dev/null +++ b/src/main/java/com/entity/vo/JiedanVO.java @@ -0,0 +1,275 @@ +package com.entity.vo; + +import com.entity.JiedanEntity; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * 快递接单表 + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("jiedan") +public class JiedanVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 主键 + */ + + @TableField(value = "id") + private Integer id; + + + /** + * 单号 + */ + + @TableField(value = "odd") + private String odd; + + + /** + * 快递名称 + */ + + @TableField(value = "daiqukuaidimc") + private Integer daiqukuaidimc; + + + /** + * 发布人 + */ + + @TableField(value = "jdyonghu_id") + private Integer jdyonghuId; + + + /** + * 发布时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + + @TableField(value = "initiate_time") + private Date initiateTime; + + + /** + * 收件人名称 + */ + + @TableField(value = "addresseename") + private String addresseename; + + + /** + * 电话 + */ + + @TableField(value = "jdphone") + private String jdphone; + + + /** + * 地址 + */ + + @TableField(value = "jdaddressee") + private String jdaddressee; + + + /** + * (取/寄)件码 + */ + + @TableField(value = "jdtakecode") + private String jdtakecode; + + + /** + * 快递状态 + */ + + @TableField(value = "jdzt_types") + private Integer jdztTypes; + + + /** + * 快递类型 + */ + + @TableField(value = "kdlx_types") + private Integer kdlxTypes; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:单号 + */ + public String getOdd() { + return odd; + } + + + /** + * 获取:单号 + */ + + public void setOdd(String odd) { + this.odd = odd; + } + + public Integer getDaiqukuaidimc() { + return daiqukuaidimc; + } + + public void setDaiqukuaidimc(Integer daiqukuaidimc) { + this.daiqukuaidimc = daiqukuaidimc; + } + + /** + * 设置:发布人 + */ + public Integer getJdyonghuId() { + return jdyonghuId; + } + + + /** + * 获取:发布人 + */ + + public void setJdyonghuId(Integer jdyonghuId) { + this.jdyonghuId = jdyonghuId; + } + /** + * 设置:发布时间 + */ + public Date getInitiateTime() { + return initiateTime; + } + + + /** + * 获取:发布时间 + */ + + public void setInitiateTime(Date initiateTime) { + this.initiateTime = initiateTime; + } + /** + * 设置:收件人名称 + */ + public String getAddresseename() { + return addresseename; + } + + + /** + * 获取:收件人名称 + */ + + public void setAddresseename(String addresseename) { + this.addresseename = addresseename; + } + /** + * 设置:电话 + */ + public String getJdphone() { + return jdphone; + } + + + /** + * 获取:电话 + */ + + public void setJdphone(String jdphone) { + this.jdphone = jdphone; + } + /** + * 设置:地址 + */ + public String getJdaddressee() { + return jdaddressee; + } + + + /** + * 获取:地址 + */ + + public void setJdaddressee(String jdaddressee) { + this.jdaddressee = jdaddressee; + } + /** + * 设置:(取/寄)件码 + */ + public String getJdtakecode() { + return jdtakecode; + } + + + /** + * 获取:(取/寄)件码 + */ + + public void setJdtakecode(String jdtakecode) { + this.jdtakecode = jdtakecode; + } + /** + * 设置:快递状态 + */ + public Integer getJdztTypes() { + return jdztTypes; + } + + + /** + * 获取:快递状态 + */ + + public void setJdztTypes(Integer jdztTypes) { + this.jdztTypes = jdztTypes; + } + /** + * 设置:快递类型 + */ + public Integer getKdlxTypes() { + return kdlxTypes; + } + + + /** + * 获取:快递类型 + */ + + public void setKdlxTypes(Integer kdlxTypes) { + this.kdlxTypes = kdlxTypes; + } + +} diff --git a/src/main/java/com/entity/vo/YijiedanVO.java b/src/main/java/com/entity/vo/YijiedanVO.java new file mode 100644 index 0000000..c9f0013 --- /dev/null +++ b/src/main/java/com/entity/vo/YijiedanVO.java @@ -0,0 +1,212 @@ +package com.entity.vo; + +import com.entity.YijiedanEntity; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * 已接单表 + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("yijiedan") +public class YijiedanVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 主键 + */ + + @TableField(value = "id") + private Integer id; + + + /** + * 单号 + */ + + @TableField(value = "odd") + private String odd; + + + /** + * 发布人 + */ + + @TableField(value = "yonghu_id") + private Integer yonghuId; + + + /** + * 手机号 + */ + + @TableField(value = "fbphone") + private String fbphone; + + + /** + * 接单人 + */ + + @TableField(value = "daiquren_id") + private Integer daiqurenId; + + + /** + * 手机号 + */ + + @TableField(value = "jdphone") + private String jdphone; + + + /** + * 接单时间 + */ + @JsonFormat(locale="zh", timezone="GMT+8", pattern="yyyy-MM-dd HH:mm:ss") + @DateTimeFormat + + @TableField(value = "initiate_time") + private Date initiateTime; + + + /** + * 订单状态 + */ + + @TableField(value = "ddzt_types") + private Integer ddztTypes; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:单号 + */ + public String getOdd() { + return odd; + } + + + /** + * 获取:单号 + */ + + public void setOdd(String odd) { + this.odd = odd; + } + /** + * 设置:发布人 + */ + public Integer getYonghuId() { + return yonghuId; + } + + + /** + * 获取:发布人 + */ + + public void setYonghuId(Integer yonghuId) { + this.yonghuId = yonghuId; + } + /** + * 设置:手机号 + */ + public String getFbphone() { + return fbphone; + } + + + /** + * 获取:手机号 + */ + + public void setFbphone(String fbphone) { + this.fbphone = fbphone; + } + /** + * 设置:接单人 + */ + public Integer getDaiqurenId() { + return daiqurenId; + } + + + /** + * 获取:接单人 + */ + + public void setDaiqurenId(Integer daiqurenId) { + this.daiqurenId = daiqurenId; + } + /** + * 设置:手机号 + */ + public String getJdphone() { + return jdphone; + } + + + /** + * 获取:手机号 + */ + + public void setJdphone(String jdphone) { + this.jdphone = jdphone; + } + /** + * 设置:接单时间 + */ + public Date getInitiateTime() { + return initiateTime; + } + + + /** + * 获取:接单时间 + */ + + public void setInitiateTime(Date initiateTime) { + this.initiateTime = initiateTime; + } + /** + * 设置:订单状态 + */ + public Integer getDdztTypes() { + return ddztTypes; + } + + + /** + * 获取:订单状态 + */ + + public void setDdztTypes(Integer ddztTypes) { + this.ddztTypes = ddztTypes; + } + +} diff --git a/src/main/java/com/entity/vo/YonghuVO.java b/src/main/java/com/entity/vo/YonghuVO.java new file mode 100644 index 0000000..1e3466e --- /dev/null +++ b/src/main/java/com/entity/vo/YonghuVO.java @@ -0,0 +1,279 @@ +package com.entity.vo; + +import com.entity.YonghuEntity; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("yonghu") +public class YonghuVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * id + */ + + @TableField(value = "id") + private Integer id; + + + /** + * 学号 + */ + + @TableField(value = "studentnumber") + private String studentnumber; + + + /** + * 用户名称 + */ + + @TableField(value = "name") + private String name; + + + /** + * 账号 + */ + + @TableField(value = "username") + private String username; + + + /** + * 密码 + */ + + @TableField(value = "password") + private String password; + + + /** + * 性别 + */ + + @TableField(value = "sex_types") + private Integer sexTypes; + + + /** + * 头像 + */ + + @TableField(value = "img_photo") + private String imgPhoto; + + + /** + * 联系电话 + */ + + @TableField(value = "phone") + private String phone; + + + /** + * 住宿楼栋 + */ + + @TableField(value = "zhuSuLou") + private String zhuSuLou; + + + /** + * 寝室号 + */ + + @TableField(value = "dormitory") + private String dormitory; + + + /** + * 身份 + */ + + @TableField(value = "role") + private String role; + + + /** + * 设置:id + */ + public Integer getId() { + return id; + } + + + /** + * 获取:id + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:学号 + */ + public String getStudentnumber() { + return studentnumber; + } + + + /** + * 获取:学号 + */ + + public void setStudentnumber(String studentnumber) { + this.studentnumber = studentnumber; + } + /** + * 设置:用户名称 + */ + public String getName() { + return name; + } + + + /** + * 获取:用户名称 + */ + + public void setName(String name) { + this.name = name; + } + /** + * 设置:账号 + */ + public String getUsername() { + return username; + } + + + /** + * 获取:账号 + */ + + public void setUsername(String username) { + this.username = username; + } + /** + * 设置:密码 + */ + public String getPassword() { + return password; + } + + + /** + * 获取:密码 + */ + + public void setPassword(String password) { + this.password = password; + } + /** + * 设置:性别 + */ + public Integer getSexTypes() { + return sexTypes; + } + + + /** + * 获取:性别 + */ + + public void setSexTypes(Integer sexTypes) { + this.sexTypes = sexTypes; + } + /** + * 设置:头像 + */ + public String getImgPhoto() { + return imgPhoto; + } + + + /** + * 获取:头像 + */ + + public void setImgPhoto(String imgPhoto) { + this.imgPhoto = imgPhoto; + } + /** + * 设置:联系电话 + */ + public String getPhone() { + return phone; + } + + + /** + * 获取:联系电话 + */ + + public void setPhone(String phone) { + this.phone = phone; + } + /** + * 设置:住宿楼栋 + */ + public String getZhuSuLou() { + return zhuSuLou; + } + + + /** + * 获取:住宿楼栋 + */ + + public void setZhuSuLou(String zhuSuLou) { + this.zhuSuLou = zhuSuLou; + } + /** + * 设置:寝室号 + */ + public String getDormitory() { + return dormitory; + } + + + /** + * 获取:寝室号 + */ + + public void setDormitory(String dormitory) { + this.dormitory = dormitory; + } + /** + * 设置:身份 + */ + public String getRole() { + return role; + } + + + /** + * 获取:身份 + */ + + public void setRole(String role) { + this.role = role; + } + +} diff --git a/src/main/java/com/entity/vo/ZhandianVO.java b/src/main/java/com/entity/vo/ZhandianVO.java new file mode 100644 index 0000000..ae33ea9 --- /dev/null +++ b/src/main/java/com/entity/vo/ZhandianVO.java @@ -0,0 +1,95 @@ +package com.entity.vo; + +import com.entity.ZhandianEntity; +import com.baomidou.mybatisplus.annotations.TableField; +import com.baomidou.mybatisplus.annotations.TableName; +import com.fasterxml.jackson.annotation.JsonFormat; +import java.util.Date; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; + +/** + * 快递站点 + * 手机端接口返回实体辅助类 + * (主要作用去除一些不必要的字段) + * @author + * @email + * @date 2021-03-11 + */ +@TableName("zhandian") +public class ZhandianVO implements Serializable { + private static final long serialVersionUID = 1L; + + + /** + * 主键 + */ + + @TableField(value = "id") + private Integer id; + + + /** + * 站点名称 + */ + + @TableField(value = "zdname") + private String zdname; + + + /** + * 站点地址 + */ + + @TableField(value = "address") + private String address; + + + /** + * 设置:主键 + */ + public Integer getId() { + return id; + } + + + /** + * 获取:主键 + */ + + public void setId(Integer id) { + this.id = id; + } + /** + * 设置:站点名称 + */ + public String getZdname() { + return zdname; + } + + + /** + * 获取:站点名称 + */ + + public void setZdname(String zdname) { + this.zdname = zdname; + } + /** + * 设置:站点地址 + */ + public String getAddress() { + return address; + } + + + /** + * 获取:站点地址 + */ + + public void setAddress(String address) { + this.address = address; + } + +} diff --git a/src/main/java/com/interceptor/AuthorizationInterceptor.java b/src/main/java/com/interceptor/AuthorizationInterceptor.java new file mode 100644 index 0000000..d0ea286 --- /dev/null +++ b/src/main/java/com/interceptor/AuthorizationInterceptor.java @@ -0,0 +1,122 @@ +package com.interceptor; + +import java.io.IOException; +import java.io.PrintWriter; +import java.util.HashMap; +import java.util.Map; +import com.alibaba.fastjson.JSONObject; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.HandlerInterceptor; + +import com.annotation.IgnoreAuth; +import com.entity.EIException; +import com.entity.TokenEntity; +import com.service.TokenService; +import com.utils.R; + +/** + * 权限(Token)验证 + * 该拦截器用于验证请求中的Token,以确定用户是否具有访问权限 + */ +@Component +public class AuthorizationInterceptor implements HandlerInterceptor { + + // 定义用于在请求头中存储Token的键名 + public static final String LOGIN_TOKEN_KEY = "Token"; + + // 自动注入TokenService,用于处理Token相关业务 + @Autowired + private TokenService tokenService; + + /** + * 在请求处理之前调用此方法,进行权限验证 + * @param request HttpServletRequest对象,包含请求的相关信息 + * @param response HttpServletResponse对象,用于设置响应信息 + * @param handler 处理请求的处理器对象,可能是HandlerMethod或其他类型 + * @return 如果验证通过则返回true,否则返回false + * @throws Exception 可能抛出的异常 + */ + @Override + public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception { + + // 支持跨域请求,设置相关的响应头信息 + // 设置允许的请求方法 + response.setHeader("Access-Control-Allow-Methods", "POST, GET, OPTIONS, DELETE"); + // 设置预检请求的有效期 + response.setHeader("Access-Control-Max-Age", "3600"); + // 设置是否允许携带认证信息(如Cookie) + response.setHeader("Access-Control-Allow-Credentials", "true"); + // 设置允许的请求头字段 + response.setHeader("Access-Control-Allow-Headers", "x-requested-with,request-source,Token, Origin,imgType, Content-Type, cache-control,postman-token,Cookie, Accept,authorization"); + // 设置允许的来源,使用请求头中的Origin字段值 + response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); + + IgnoreAuth annotation; + // 判断处理器是否为HandlerMethod类型 + if (handler instanceof HandlerMethod) { + // 如果是,获取该方法上的IgnoreAuth注解 + annotation = ((HandlerMethod) handler).getMethodAnnotation(IgnoreAuth.class); + } else { + // 如果不是,直接返回true(可能是静态资源等不需要权限验证的情况) + return true; + } + + // 从请求头中获取Token + String token = request.getHeader(LOGIN_TOKEN_KEY); + + /** + * 不需要验证权限的方法直接放过 + */ + // 如果方法上存在IgnoreAuth注解,说明不需要验证权限,直接返回true + if (annotation!= null) { + return true; + } + + TokenEntity tokenEntity = null; + // 如果获取到的Token不为空 + if (StringUtils.isNotBlank(token)) { + // 通过TokenService获取Token对应的TokenEntity对象 + tokenEntity = tokenService.getTokenEntity(token); + } + + // 如果获取到了有效的TokenEntity对象 + if (tokenEntity!= null) { + // 将用户ID存入请求的Session中 + request.getSession().setAttribute("userId", tokenEntity.getUserid()); + // 将用户角色存入请求的Session中 + request.getSession().setAttribute("role", tokenEntity.getRole()); + // 将表名存入请求的Session中 + request.getSession().setAttribute("tableName", tokenEntity.getTablename()); + // 将用户名存入请求的Session中 + request.getSession().setAttribute("username", tokenEntity.getUsername()); + // 验证通过,返回true + return true; + } + + PrintWriter writer = null; + // 设置响应的字符编码为UTF-8 + response.setCharacterEncoding("UTF-8"); + // 设置响应的内容类型为application/json,并指定字符编码为UTF-8 + response.setContentType("application/json; charset=utf-8"); + try { + // 获取用于向客户端写入响应的PrintWriter对象 + writer = response.getWriter(); + // 将包含错误信息的R对象转换为JSON字符串并写入响应 + writer.print(JSONObject.toJSONString(R.error(401, "请先登录"))); + } finally { + // 确保在使用完PrintWriter后关闭它 + if (writer!= null) { + writer.close(); + } + } +// throw new EIException("请先登录", 401); + // 验证不通过,返回false + return false; + } +} \ No newline at end of file diff --git a/src/main/java/com/model/enums/TypeEnum.java b/src/main/java/com/model/enums/TypeEnum.java new file mode 100644 index 0000000..bb991a5 --- /dev/null +++ b/src/main/java/com/model/enums/TypeEnum.java @@ -0,0 +1,53 @@ +package com.model.enums; + +// 导入Serializable接口,该接口用于标记可序列化的类,使得对象可以在网络传输或保存到文件中 +import java.io.Serializable; + +// 导入MyBatis-Plus的IEnum接口,用于将枚举类型映射到数据库字段 +import com.baomidou.mybatisplus.enums.IEnum; + +/** + * 必须现在 IEnum 配置 该包扫描自动注入,查看文件 spring-mybatis.xml 参数 typeEnumsPackage + * 此枚举类表示某种类型的状态,实现了IEnum接口,可用于与数据库字段进行映射 + */ +public enum TypeEnum implements IEnum { + // 定义枚举常量,表示禁用状态,对应的整数值为0,描述为"禁用" + DISABLED(0, "禁用"), + // 定义枚举常量,表示正常状态,对应的整数值为1,描述为"正常" + NORMAL(1, "正常"); + + // 定义一个私有常量,用于存储枚举常量对应的整数值,该值将与数据库字段对应 + private final int value; + // 定义一个私有常量,用于存储枚举常量的中文描述信息 + private final String desc; + + /** + * 枚举类的构造函数,用于初始化枚举常量的整数值和描述信息 + * @param value 枚举常量对应的整数值 + * @param desc 枚举常量的中文描述信息 + */ + TypeEnum(final int value, final String desc) { + this.value = value; + this.desc = desc; + } + + /** + * 实现IEnum接口的方法,用于获取枚举常量对应的整数值 + * 该值将被用于与数据库字段进行映射 + * @return 枚举常量对应的整数值 + */ + @Override + public Serializable getValue() { + return this.value; + } + + /** + * 获取枚举常量的中文描述信息 + * 此方法添加了注释说明在使用Jackson进行JSON序列化时,使用 @JsonValue 注解可将该描述信息作为JSON输出 + * @return 枚举常量的中文描述信息 + */ + // Jackson 注解为 JsonValue 返回中文 json 描述 + public String getDesc() { + return this.desc; + } +} \ No newline at end of file diff --git a/src/main/java/com/service/CommonService.java b/src/main/java/com/service/CommonService.java new file mode 100644 index 0000000..7c78895 --- /dev/null +++ b/src/main/java/com/service/CommonService.java @@ -0,0 +1,60 @@ +package com.service; + +// 导入List接口,用于存储有序集合 +import java.util.List; +// 导入Map接口,用于存储键值对映射 +import java.util.Map; + +/** + * 这是一个通用服务接口,定义了一系列用于数据查询、处理和统计的方法 + */ +public interface CommonService { + + /** + * 根据传入的参数获取选项列表 + * @param params 包含查询条件的参数Map,键为参数名,值为参数值 + * @return 包含选项字符串的列表 + */ + List getOption(Map params); + + /** + * 根据传入的选项参数获取相关的跟进信息 + * @param params 包含查询条件的参数Map,键为参数名,值为参数值 + * @return 包含跟进信息的Map,键为信息的标识,值为具体信息内容 + */ + Map getFollowByOption(Map params); + + /** + * 执行某种审核(sh可能代表审核)操作 + * @param params 包含审核所需参数的Map,键为参数名,值为参数值 + */ + void sh(Map params); + + /** + * 根据传入的参数统计提醒数量 + * @param params 包含统计条件的参数Map,键为参数名,值为参数值 + * @return 提醒的数量 + */ + int remindCount(Map params); + + /** + * 根据传入的参数进行计算并返回计算结果 + * @param params 包含计算所需参数的Map,键为参数名,值为参数值 + * @return 包含计算结果的Map,键为结果的标识,值为具体结果内容 + */ + Map selectCal(Map params); + + /** + * 根据传入的参数进行分组查询并返回查询结果列表 + * @param params 包含查询条件和分组规则的参数Map,键为参数名,值为参数值 + * @return 包含分组查询结果的列表,每个元素是一个Map,代表一组查询结果 + */ + List> selectGroup(Map params); + + /** + * 根据传入的参数查询具体的值并返回查询结果列表 + * @param params 包含查询条件的参数Map,键为参数名,值为参数值 + * @return 包含查询结果的列表,每个元素是一个Map,代表一条查询结果 + */ + List> selectValue(Map params); +} \ No newline at end of file diff --git a/src/main/java/com/service/ConfigService.java b/src/main/java/com/service/ConfigService.java new file mode 100644 index 0000000..6213717 --- /dev/null +++ b/src/main/java/com/service/ConfigService.java @@ -0,0 +1,18 @@ + +package com.service; + +import java.util.Map; + +import com.baomidou.mybatisplus.service.IService; +import com.entity.ConfigEntity; +import com.utils.PageUtils; + + +/** + * 系统用户 + * @author yangliyuan + * @date 2019年10月10日 上午9:18:20 + */ +public interface ConfigService extends IService { + PageUtils queryPage(Map params); +} diff --git a/src/main/java/com/service/DaiquService.java b/src/main/java/com/service/DaiquService.java new file mode 100644 index 0000000..ad370c6 --- /dev/null +++ b/src/main/java/com/service/DaiquService.java @@ -0,0 +1,21 @@ +package com.service; + +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.DaiquEntity; +import java.util.Map; + +/** + * 待取件表 服务类 + * @author + * @since 2021-03-11 + */ +public interface DaiquService extends IService { + + /** + * @param params 查询参数 + * @return 带分页的查询出来的数据 + */ + PageUtils queryPage(Map params); + +} \ No newline at end of file diff --git a/src/main/java/com/service/DaiqurenService.java b/src/main/java/com/service/DaiqurenService.java new file mode 100644 index 0000000..6d5a800 --- /dev/null +++ b/src/main/java/com/service/DaiqurenService.java @@ -0,0 +1,21 @@ +package com.service; + +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.DaiqurenEntity; +import java.util.Map; + +/** + * 服务类 + * @author + * @since 2021-03-11 + */ +public interface DaiqurenService extends IService { + + /** + * @param params 查询参数 + * @return 带分页的查询出来的数据 + */ + PageUtils queryPage(Map params); + +} \ No newline at end of file diff --git a/src/main/java/com/service/DictionaryService.java b/src/main/java/com/service/DictionaryService.java new file mode 100644 index 0000000..7f3fff6 --- /dev/null +++ b/src/main/java/com/service/DictionaryService.java @@ -0,0 +1,26 @@ +package com.service; + +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.DictionaryEntity; +import java.util.Map; + +/** + * 字典表 服务类 + * @author + * @since 2021-03-11 + */ +public interface DictionaryService extends IService { + + /** + * @param params 查询参数 + * @return 带分页的查询出来的数据 + */ + PageUtils queryPage(Map params); + + /** + * 字典表转换 + * @param obj + */ + void dictionaryConvert(Object obj); +} \ No newline at end of file diff --git a/src/main/java/com/service/JiedanService.java b/src/main/java/com/service/JiedanService.java new file mode 100644 index 0000000..ed5bff6 --- /dev/null +++ b/src/main/java/com/service/JiedanService.java @@ -0,0 +1,21 @@ +package com.service; + +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.JiedanEntity; +import java.util.Map; + +/** + * 快递接单表 服务类 + * @author + * @since 2021-03-11 + */ +public interface JiedanService extends IService { + + /** + * @param params 查询参数 + * @return 带分页的查询出来的数据 + */ + PageUtils queryPage(Map params); + +} \ No newline at end of file diff --git a/src/main/java/com/service/TokenService.java b/src/main/java/com/service/TokenService.java new file mode 100644 index 0000000..3d8e19d --- /dev/null +++ b/src/main/java/com/service/TokenService.java @@ -0,0 +1,28 @@ + +package com.service; + +import java.util.List; +import java.util.Map; + +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.service.IService; +import com.entity.TokenEntity; +import com.utils.PageUtils; + + +/** + * token + * @author yangliyuan + * @date 2019年10月10日 上午9:18:20 + */ +public interface TokenService extends IService { + PageUtils queryPage(Map params); + + List selectListView(Wrapper wrapper); + + PageUtils queryPage(Map params, Wrapper wrapper); + + String generateToken(Integer userid, String username, String tableName, String role); + + TokenEntity getTokenEntity(String token); +} diff --git a/src/main/java/com/service/UserService.java b/src/main/java/com/service/UserService.java new file mode 100644 index 0000000..717cccd --- /dev/null +++ b/src/main/java/com/service/UserService.java @@ -0,0 +1,49 @@ + +package com.service; + +// 导入List接口,用于表示有序集合,可存储多个元素 +import java.util.List; +// 导入Map接口,用于存储键值对,键唯一,值可重复 +import java.util.Map; + +// 导入MyBatis的Param注解,用于在Mapper方法中为参数命名 +import org.apache.ibatis.annotations.Param; + +// 导入MyBatis-Plus的Wrapper类,用于构建查询条件 +import com.baomidou.mybatisplus.mapper.Wrapper; +// 导入MyBatis-Plus的IService接口,提供了常用的CRUD操作方法 +import com.baomidou.mybatisplus.service.IService; +// 导入用户实体类,用于表示系统用户的相关属性 +import com.entity.UserEntity; +// 导入分页工具类,用于处理分页查询结果 +import com.utils.PageUtils; + +/** + * 系统用户 + * @author yangliyuan + * @date 2019年10月10日 上午9:18:20 + * 该接口定义了系统用户服务的相关方法,继承自MyBatis-Plus的IService接口,可使用其提供的基础CRUD操作 + */ +public interface UserService extends IService { + /** + * 根据传入的参数进行分页查询系统用户信息 + * @param params 包含查询条件和分页信息的参数Map,键为参数名,值为参数值 + * @return 返回一个PageUtils对象,包含分页后的查询结果 + */ + PageUtils queryPage(Map params); + + /** + * 根据传入的查询条件包装器查询系统用户列表视图 + * @param wrapper 一个Wrapper对象,用于构建查询条件,筛选出符合条件的用户信息 + * @return 返回一个存储UserEntity对象的列表,包含符合查询条件的用户信息 + */ + List selectListView(Wrapper wrapper); + + /** + * 根据传入的参数和查询条件包装器进行分页查询系统用户信息 + * @param params 包含查询条件和分页信息的参数Map,键为参数名,值为参数值 + * @param wrapper 一个Wrapper对象,用于构建查询条件,进一步筛选出符合条件的用户信息 + * @return 返回一个PageUtils对象,包含分页后的查询结果 + */ + PageUtils queryPage(Map params, Wrapper wrapper); +} \ No newline at end of file diff --git a/src/main/java/com/service/YijiedanService.java b/src/main/java/com/service/YijiedanService.java new file mode 100644 index 0000000..c81577f --- /dev/null +++ b/src/main/java/com/service/YijiedanService.java @@ -0,0 +1,21 @@ +package com.service; + +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.YijiedanEntity; +import java.util.Map; + +/** + * 已接单表 服务类 + * @author + * @since 2021-03-11 + */ +public interface YijiedanService extends IService { + + /** + * @param params 查询参数 + * @return 带分页的查询出来的数据 + */ + PageUtils queryPage(Map params); + +} \ No newline at end of file diff --git a/src/main/java/com/service/YonghuService.java b/src/main/java/com/service/YonghuService.java new file mode 100644 index 0000000..8e3b163 --- /dev/null +++ b/src/main/java/com/service/YonghuService.java @@ -0,0 +1,21 @@ +package com.service; + +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.YonghuEntity; +import java.util.Map; + +/** + * 服务类 + * @author + * @since 2021-03-11 + */ +public interface YonghuService extends IService { + + /** + * @param params 查询参数 + * @return 带分页的查询出来的数据 + */ + PageUtils queryPage(Map params); + +} \ No newline at end of file diff --git a/src/main/java/com/service/ZhandianService.java b/src/main/java/com/service/ZhandianService.java new file mode 100644 index 0000000..e61ac5c --- /dev/null +++ b/src/main/java/com/service/ZhandianService.java @@ -0,0 +1,21 @@ +package com.service; + +import com.baomidou.mybatisplus.service.IService; +import com.utils.PageUtils; +import com.entity.ZhandianEntity; +import java.util.Map; + +/** + * 快递站点 服务类 + * @author + * @since 2021-03-11 + */ +public interface ZhandianService extends IService { + + /** + * @param params 查询参数 + * @return 带分页的查询出来的数据 + */ + PageUtils queryPage(Map params); + +} \ No newline at end of file diff --git a/src/main/java/com/service/impl/CommonServiceImpl.java b/src/main/java/com/service/impl/CommonServiceImpl.java new file mode 100644 index 0000000..dea258c --- /dev/null +++ b/src/main/java/com/service/impl/CommonServiceImpl.java @@ -0,0 +1,61 @@ + +package com.service.impl; + + +import java.util.List; +import java.util.Map; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; + +import com.dao.CommonDao; +import com.service.CommonService; + + +/** + * 系统用户 + * @author yangliyuan + * @date 2019年10月10日 上午9:17:59 + */ +@Service("commonService") +public class CommonServiceImpl implements CommonService { + + @Autowired + private CommonDao commonDao; + + @Override + public List getOption(Map params) { + return commonDao.getOption(params); + } + + @Override + public Map getFollowByOption(Map params) { + return commonDao.getFollowByOption(params); + } + + @Override + public void sh(Map params) { + commonDao.sh(params); + } + + @Override + public int remindCount(Map params) { + return commonDao.remindCount(params); + } + + @Override + public Map selectCal(Map params) { + return commonDao.selectCal(params); + } + + @Override + public List> selectGroup(Map params) { + return commonDao.selectGroup(params); + } + + @Override + public List> selectValue(Map params) { + return commonDao.selectValue(params); + } + +} diff --git a/src/main/java/com/service/impl/ConfigServiceImpl.java b/src/main/java/com/service/impl/ConfigServiceImpl.java new file mode 100644 index 0000000..eada726 --- /dev/null +++ b/src/main/java/com/service/impl/ConfigServiceImpl.java @@ -0,0 +1,35 @@ + +package com.service.impl; + + +import java.util.Map; + +import com.entity.ConfigEntity; +import com.utils.Query; +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.dao.ConfigDao; +import com.service.ConfigService; +import com.utils.PageUtils; +import org.springframework.transaction.annotation.Transactional; + + +/** + * 系统用户 + * @author yangliyuan + * @date 2019年10月10日 上午9:17:59 + */ +@Service("configService") +public class ConfigServiceImpl extends ServiceImpl implements ConfigService { + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } +} diff --git a/src/main/java/com/service/impl/DaiquServiceImpl.java b/src/main/java/com/service/impl/DaiquServiceImpl.java new file mode 100644 index 0000000..1c390c6 --- /dev/null +++ b/src/main/java/com/service/impl/DaiquServiceImpl.java @@ -0,0 +1,41 @@ +package com.service.impl; + +import com.utils.StringUtil; +import org.springframework.stereotype.Service; +import java.lang.reflect.Field; +import java.util.*; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; +import com.utils.PageUtils; +import com.utils.Query; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.dao.DaiquDao; +import com.entity.DaiquEntity; +import com.service.DaiquService; +import com.entity.view.DaiquView; + +/** + * 待取件表 服务实现类 + * @author + * @since 2021-03-11 + */ +@Service("daiquService") +@Transactional +public class DaiquServiceImpl extends ServiceImpl implements DaiquService { + + @Override + public PageUtils queryPage(Map params) { + if(params != null && (params.get("limit") == null || params.get("page") == null)){ + params.put("page","1"); + params.put("limit","10"); + } + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,params)); + return new PageUtils(page); + } + + +} diff --git a/src/main/java/com/service/impl/DaiqurenServiceImpl.java b/src/main/java/com/service/impl/DaiqurenServiceImpl.java new file mode 100644 index 0000000..4932c36 --- /dev/null +++ b/src/main/java/com/service/impl/DaiqurenServiceImpl.java @@ -0,0 +1,41 @@ +package com.service.impl; + +import com.utils.StringUtil; +import org.springframework.stereotype.Service; +import java.lang.reflect.Field; +import java.util.*; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; +import com.utils.PageUtils; +import com.utils.Query; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.dao.DaiqurenDao; +import com.entity.DaiqurenEntity; +import com.service.DaiqurenService; +import com.entity.view.DaiqurenView; + +/** + * 服务实现类 + * @author + * @since 2021-03-11 + */ +@Service("daiqurenService") +@Transactional +public class DaiqurenServiceImpl extends ServiceImpl implements DaiqurenService { + + @Override + public PageUtils queryPage(Map params) { + if(params != null && (params.get("limit") == null || params.get("page") == null)){ + params.put("page","1"); + params.put("limit","10"); + } + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,params)); + return new PageUtils(page); + } + + +} diff --git a/src/main/java/com/service/impl/DictionaryServiceImpl.java b/src/main/java/com/service/impl/DictionaryServiceImpl.java new file mode 100644 index 0000000..e768928 --- /dev/null +++ b/src/main/java/com/service/impl/DictionaryServiceImpl.java @@ -0,0 +1,120 @@ +package com.service.impl; + +import com.utils.StringUtil; +import org.springframework.stereotype.Service; +import java.lang.reflect.Field; +import java.util.*; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; +import com.utils.PageUtils; +import com.utils.Query; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.dao.DictionaryDao; +import com.entity.DictionaryEntity; +import com.service.DictionaryService; +import com.entity.view.DictionaryView; + +/** + * 字典表 服务实现类 + * @author + * @since 2021-03-11 + */ +@Service("dictionaryService") +@Transactional +public class DictionaryServiceImpl extends ServiceImpl implements DictionaryService { + + @Override + public PageUtils queryPage(Map params) { + if(params != null && (params.get("limit") == null || params.get("page") == null)){ + params.put("page","1"); + params.put("limit","10"); + } + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,params)); + return new PageUtils(page); + } + + /** + * 赋值给字典表 + * @param obj view对象 + */ + public void dictionaryConvert(Object obj) { + try { + if (obj == null) return; + //当前view和entity中的所有types的字段 + List fieldNameList = new ArrayList<>(); + Class tempClass = obj.getClass(); + while (tempClass !=null) { + Field[] declaredFields = tempClass.getDeclaredFields(); + for (Field f : declaredFields) { + f.setAccessible(true); + if (f.getType().getName().equals("java.lang.Integer") && f.getName().contains("Types")) { + fieldNameList.add(f.getName()); + } + } + tempClass = tempClass.getSuperclass(); //得到父类,然后赋给自己 + } + + // 获取监听器中的字典表 + ServletContext servletContext = ContextLoader.getCurrentWebApplicationContext().getServletContext(); + Map> dictionaryMap= (Map>) servletContext.getAttribute("dictionaryMap"); + + //通过Types的值给Value字段赋值 + for (String s : fieldNameList) { + Field types = null; + if(hasField(obj.getClass(),s)){ + //判断view中有没有这个字段,有就通过反射取出字段 + types= obj.getClass().getDeclaredField(s);//获取Types私有字段 + }else{ + //本表中没有这个字段,说明它是父表中的字段,也就是entity中的字段,从entity中取值 + types=obj.getClass().getSuperclass().getDeclaredField(s); + } + Field value = obj.getClass().getDeclaredField(s.replace("Types", "Value"));//获取value私有字段 + //设置权限 + types.setAccessible(true); + value.setAccessible(true); + + //赋值 + if (StringUtil.isNotEmpty(String.valueOf(types.get(obj)))) { //types的值不为空 + int i = Integer.parseInt(String.valueOf(types.get(obj)));//type + String s1 = s.replace("Types", "_types"); + String s2 = dictionaryMap.get(s1).get(i); + value.set(obj, s2); + } else { + new Exception("字典表赋值出现问题::::"+value.getName()); + value.set(obj, ""); + } + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } catch (NoSuchFieldException e) { + e.printStackTrace(); + } catch (Exception e) { + e.printStackTrace(); + } + } + + /** + * 判断本实体有没有这个字段 + * @param c + * @param fieldName + * @return + */ + public boolean hasField(Class c, String fieldName){ + Field[] fields = c.getDeclaredFields(); + + for (Field f : fields) { + if (fieldName.equals(f.getName())) { + return true; + + } + + } + + return false; + } + +} diff --git a/src/main/java/com/service/impl/JiedanServiceImpl.java b/src/main/java/com/service/impl/JiedanServiceImpl.java new file mode 100644 index 0000000..cae42b5 --- /dev/null +++ b/src/main/java/com/service/impl/JiedanServiceImpl.java @@ -0,0 +1,41 @@ +package com.service.impl; + +import com.utils.StringUtil; +import org.springframework.stereotype.Service; +import java.lang.reflect.Field; +import java.util.*; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; +import com.utils.PageUtils; +import com.utils.Query; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.dao.JiedanDao; +import com.entity.JiedanEntity; +import com.service.JiedanService; +import com.entity.view.JiedanView; + +/** + * 快递接单表 服务实现类 + * @author + * @since 2021-03-11 + */ +@Service("jiedanService") +@Transactional +public class JiedanServiceImpl extends ServiceImpl implements JiedanService { + + @Override + public PageUtils queryPage(Map params) { + if(params != null && (params.get("limit") == null || params.get("page") == null)){ + params.put("page","1"); + params.put("limit","10"); + } + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,params)); + return new PageUtils(page); + } + + +} diff --git a/src/main/java/com/service/impl/TokenServiceImpl.java b/src/main/java/com/service/impl/TokenServiceImpl.java new file mode 100644 index 0000000..7e21a13 --- /dev/null +++ b/src/main/java/com/service/impl/TokenServiceImpl.java @@ -0,0 +1,81 @@ + +package com.service.impl; + + +import java.util.Calendar; +import java.util.Date; +import java.util.List; +import java.util.Map; + +import org.springframework.stereotype.Service; + +import com.baomidou.mybatisplus.mapper.EntityWrapper; +import com.baomidou.mybatisplus.mapper.Wrapper; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import com.dao.TokenDao; +import com.entity.TokenEntity; +import com.entity.TokenEntity; +import com.service.TokenService; +import com.utils.CommonUtil; +import com.utils.PageUtils; +import com.utils.Query; + + +/** + * token + * @author yangliyuan + * @date 2019年10月10日 上午9:17:59 + */ +@Service("tokenService") +public class TokenServiceImpl extends ServiceImpl implements TokenService { + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public PageUtils queryPage(Map params, + Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } + + @Override + public String generateToken(Integer userid,String username, String tableName, String role) { + TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("userid", userid).eq("role", role)); + String token = CommonUtil.getRandomString(32); + Calendar cal = Calendar.getInstance(); + cal.setTime(new Date()); + cal.add(Calendar.HOUR_OF_DAY, 1); + if(tokenEntity!=null) { + tokenEntity.setToken(token); + tokenEntity.setExpiratedtime(cal.getTime()); + this.updateById(tokenEntity); + } else { + this.insert(new TokenEntity(userid,username, tableName, role, token, cal.getTime())); + } + return token; + } + + @Override + public TokenEntity getTokenEntity(String token) { + TokenEntity tokenEntity = this.selectOne(new EntityWrapper().eq("token", token)); + if(tokenEntity == null || tokenEntity.getExpiratedtime().getTime() implements UserService { + + @Override + public PageUtils queryPage(Map params) { + Page page = this.selectPage( + new Query(params).getPage(), + new EntityWrapper() + ); + return new PageUtils(page); + } + + @Override + public List selectListView(Wrapper wrapper) { + return baseMapper.selectListView(wrapper); + } + + @Override + public PageUtils queryPage(Map params, + Wrapper wrapper) { + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,wrapper)); + PageUtils pageUtil = new PageUtils(page); + return pageUtil; + } +} diff --git a/src/main/java/com/service/impl/YijiedanServiceImpl.java b/src/main/java/com/service/impl/YijiedanServiceImpl.java new file mode 100644 index 0000000..54e5ca0 --- /dev/null +++ b/src/main/java/com/service/impl/YijiedanServiceImpl.java @@ -0,0 +1,41 @@ +package com.service.impl; + +import com.utils.StringUtil; +import org.springframework.stereotype.Service; +import java.lang.reflect.Field; +import java.util.*; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; +import com.utils.PageUtils; +import com.utils.Query; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.dao.YijiedanDao; +import com.entity.YijiedanEntity; +import com.service.YijiedanService; +import com.entity.view.YijiedanView; + +/** + * 已接单表 服务实现类 + * @author + * @since 2021-03-11 + */ +@Service("yijiedanService") +@Transactional +public class YijiedanServiceImpl extends ServiceImpl implements YijiedanService { + + @Override + public PageUtils queryPage(Map params) { + if(params != null && (params.get("limit") == null || params.get("page") == null)){ + params.put("page","1"); + params.put("limit","10"); + } + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,params)); + return new PageUtils(page); + } + + +} diff --git a/src/main/java/com/service/impl/YonghuServiceImpl.java b/src/main/java/com/service/impl/YonghuServiceImpl.java new file mode 100644 index 0000000..d7c6c18 --- /dev/null +++ b/src/main/java/com/service/impl/YonghuServiceImpl.java @@ -0,0 +1,41 @@ +package com.service.impl; + +import com.utils.StringUtil; +import org.springframework.stereotype.Service; +import java.lang.reflect.Field; +import java.util.*; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; +import com.utils.PageUtils; +import com.utils.Query; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.dao.YonghuDao; +import com.entity.YonghuEntity; +import com.service.YonghuService; +import com.entity.view.YonghuView; + +/** + * 服务实现类 + * @author + * @since 2021-03-11 + */ +@Service("yonghuService") +@Transactional +public class YonghuServiceImpl extends ServiceImpl implements YonghuService { + + @Override + public PageUtils queryPage(Map params) { + if(params != null && (params.get("limit") == null || params.get("page") == null)){ + params.put("page","1"); + params.put("limit","10"); + } + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,params)); + return new PageUtils(page); + } + + +} diff --git a/src/main/java/com/service/impl/ZhandianServiceImpl.java b/src/main/java/com/service/impl/ZhandianServiceImpl.java new file mode 100644 index 0000000..30a574d --- /dev/null +++ b/src/main/java/com/service/impl/ZhandianServiceImpl.java @@ -0,0 +1,41 @@ +package com.service.impl; + +import com.utils.StringUtil; +import org.springframework.stereotype.Service; +import java.lang.reflect.Field; +import java.util.*; +import com.baomidou.mybatisplus.plugins.Page; +import com.baomidou.mybatisplus.service.impl.ServiceImpl; +import org.springframework.transaction.annotation.Transactional; +import com.utils.PageUtils; +import com.utils.Query; +import org.springframework.web.context.ContextLoader; +import javax.servlet.ServletContext; + +import com.dao.ZhandianDao; +import com.entity.ZhandianEntity; +import com.service.ZhandianService; +import com.entity.view.ZhandianView; + +/** + * 快递站点 服务实现类 + * @author + * @since 2021-03-11 + */ +@Service("zhandianService") +@Transactional +public class ZhandianServiceImpl extends ServiceImpl implements ZhandianService { + + @Override + public PageUtils queryPage(Map params) { + if(params != null && (params.get("limit") == null || params.get("page") == null)){ + params.put("page","1"); + params.put("limit","10"); + } + Page page =new Query(params).getPage(); + page.setRecords(baseMapper.selectListView(page,params)); + return new PageUtils(page); + } + + +} diff --git a/src/main/java/com/utils/BaiduUtil.java b/src/main/java/com/utils/BaiduUtil.java new file mode 100644 index 0000000..ade0f38 --- /dev/null +++ b/src/main/java/com/utils/BaiduUtil.java @@ -0,0 +1,122 @@ +package com.utils; + +import java.io.BufferedReader; +import java.io.InputStreamReader; +import java.net.HttpURLConnection; +import java.net.URL; +import java.util.HashMap; +import java.util.List; +import java.util.Map; + +import org.json.JSONObject; + + +/** + * @author yangliyuan + * @version 创建时间:2020年2月7日 下午9:37:05 + * 类说明 : 该类包含与百度相关功能的工具方法,如根据经纬度获取省市区信息和获取百度API访问token + */ +public class BaiduUtil { + + /** + * 根据经纬度获得省市区信息 + * @param key 百度地图API的ak(API Key) + * @param lng 经度 + * @param lat 纬度 + * @return 包含省、市、区、街道信息的Map,若出现异常则返回null + */ + public static Map getCityByLonLat(String key, String lng, String lat) { + // 将纬度和经度组合成location字符串,格式为 "纬度,经度" + String location = lat + "," + lng; + try { + // 拼装请求百度地图逆地理编码API的URL + String url = "http://api.map.baidu.com/reverse_geocoding/v3/?ak="+key+"&output=json&coordtype=wgs84ll&location="+location; + // 调用HttpClientUtils的doGet方法发送GET请求并获取响应结果 + String result = HttpClientUtils.doGet(url); + // 将响应结果字符串转换为JSONObject对象 + JSONObject o = new JSONObject(result); + // 创建一个HashMap用于存储省、市、区、街道信息 + Map area = new HashMap<>(); + // 从响应结果中提取省份信息并放入Map中 + area.put("province", o.getJSONObject("result").getJSONObject("addressComponent").getString("province")); + // 从响应结果中提取城市信息并放入Map中 + area.put("city", o.getJSONObject("result").getJSONObject("addressComponent").getString("city")); + // 从响应结果中提取区域信息并放入Map中 + area.put("district", o.getJSONObject("result").getJSONObject("addressComponent").getString("district")); + // 从响应结果中提取街道信息并放入Map中 + area.put("street", o.getJSONObject("result").getJSONObject("addressComponent").getString("street")); + // 返回包含省、市、区、街道信息的Map + return area; + } catch (Exception e) { + // 若出现异常,打印异常堆栈信息 + e.printStackTrace(); + } + // 若出现异常,返回null + return null; + } + + /** + * 获取API访问token + * 该token有一定的有效期,需要自行管理,当失效时需重新获取. + * @param ak - 百度云官网获取的 API Key + * @param sk - 百度云官网获取的 Securet Key + * @return assess_token 访问token,若获取失败则返回null + */ + public static String getAuth(String ak, String sk) { + // 定义获取token的请求地址 + String authHost = "https://aip.baidubce.com/oauth/2.0/token?"; + // 拼接完整的获取token的URL + String getAccessTokenUrl = authHost + // 1. grant_type为固定参数 + + "grant_type=client_credentials" + // 2. 官网获取的 API Key + + "&client_id=" + ak + // 3. 官网获取的 Secret Key + + "&client_secret=" + sk; + try { + // 创建URL对象 + URL realUrl = new URL(getAccessTokenUrl); + // 打开和URL之间的连接 + HttpURLConnection connection = (HttpURLConnection) realUrl.openConnection(); + // 设置请求方法为GET + connection.setRequestMethod("GET"); + // 建立连接 + connection.connect(); + // 获取所有响应头字段 + Map> map = connection.getHeaderFields(); + // 遍历所有的响应头字段并打印 + for (String key : map.keySet()) { + System.err.println(key + "--->" + map.get(key)); + } + // 定义 BufferedReader输入流来读取URL的响应 + BufferedReader in = new BufferedReader(new InputStreamReader(connection.getInputStream())); + // 用于存储响应结果的字符串 + String result = ""; + // 用于临时存储每行响应内容的字符串 + String line; + // 逐行读取响应内容并拼接成完整的结果 + while ((line = in.readLine()) != null) { + result += line; + } + /** + * 返回结果示例 + */ + // 打印响应结果 + System.err.println("result:" + result); + // 将响应结果字符串转换为JSONObject对象 + org.json.JSONObject jsonObject = new org.json.JSONObject(result); + // 从JSONObject中提取access_token字段的值 + String access_token = jsonObject.getString("access_token"); + // 返回access_token + return access_token; + } catch (Exception e) { + // 若获取token失败,打印错误提示信息 + System.err.printf("获取token失败!"); + // 打印异常堆栈信息到标准错误输出 + e.printStackTrace(System.err); + } + // 若获取token失败,返回null + return null; + } + +} \ No newline at end of file diff --git a/src/main/java/com/utils/CommonUtil.java b/src/main/java/com/utils/CommonUtil.java new file mode 100644 index 0000000..602e37e --- /dev/null +++ b/src/main/java/com/utils/CommonUtil.java @@ -0,0 +1,33 @@ +package com.utils; + +// 导入Random类,用于生成随机数 +import java.util.Random; + +/** + * 这是一个通用工具类,包含了一些常用的通用方法 + */ +public class CommonUtil { + /** + * 获取指定长度的随机字符串 + * + * @param num 要生成的随机字符串的长度 + * @return 生成的随机字符串 + */ + public static String getRandomString(Integer num) { + // 定义一个包含所有可能字符的基础字符串,由小写字母和数字组成 + String base = "abcdefghijklmnopqrstuvwxyz0123456789"; + // 创建一个Random对象,用于生成随机数 + Random random = new Random(); + // 创建一个StringBuffer对象,用于动态拼接字符 + StringBuffer sb = new StringBuffer(); + // 循环num次,每次生成一个随机字符并添加到StringBuffer中 + for (int i = 0; i < num; i++) { + // 生成一个0到base字符串长度之间的随机整数 + int number = random.nextInt(base.length()); + // 根据随机整数从base字符串中取出对应的字符,并添加到StringBuffer中 + sb.append(base.charAt(number)); + } + // 将StringBuffer对象转换为字符串并返回 + return sb.toString(); + } +} diff --git a/src/main/java/com/utils/FileUtil.java b/src/main/java/com/utils/FileUtil.java new file mode 100644 index 0000000..261c22b --- /dev/null +++ b/src/main/java/com/utils/FileUtil.java @@ -0,0 +1,29 @@ +package com.utils; + +import java.io.ByteArrayOutputStream; +import java.io.File; +import java.io.FileInputStream; +import java.io.IOException; +import java.io.InputStream; + +/** +* @author yangliyuan +* @version 创建时间:2020年2月7日 下午8:01:14 +* 类说明 : +*/ + +public class FileUtil { + public static byte[] FileToByte(File file) throws IOException { + // 将数据转为流 + @SuppressWarnings("resource") + InputStream content = new FileInputStream(file); + ByteArrayOutputStream swapStream = new ByteArrayOutputStream(); + byte[] buff = new byte[100]; + int rc = 0; + while ((rc = content.read(buff, 0, 100)) > 0) { + swapStream.write(buff, 0, rc); + } + // 获得二进制数组 + return swapStream.toByteArray(); + } +} diff --git a/src/main/java/com/utils/HttpClientUtils.java b/src/main/java/com/utils/HttpClientUtils.java new file mode 100644 index 0000000..2a5e327 --- /dev/null +++ b/src/main/java/com/utils/HttpClientUtils.java @@ -0,0 +1,56 @@ +package com.utils; + +// 导入BufferedReader类,用于缓冲字符输入流,提高读取效率 +import java.io.BufferedReader; +// 导入InputStreamReader类,用于将字节流转换为字符流 +import java.io.InputStreamReader; +// 导入HttpURLConnection类,用于创建HTTP连接并进行通信 +import java.net.HttpURLConnection; +// 导入URL类,用于表示统一资源定位符 +import java.net.URL; + +/** + * HttpClient工具类 + * 该类提供了发送HTTP请求的工具方法,目前仅实现了GET请求方式 + */ +public class HttpClientUtils { + + /** + * 以GET请求方式访问指定的URL并获取响应结果 + * @param uri 要访问的URL地址 + * @return 服务器返回的响应内容,如果发生异常则返回null + * @description get请求方式 + * @author: long.he01 + */ + public static String doGet(String uri) { + // 创建一个StringBuilder对象,用于拼接响应结果 + StringBuilder result = new StringBuilder(); + try { + // 定义一个字符串变量,用于存储最终的响应结果 + String res = ""; + // 根据传入的uri创建一个URL对象 + URL url = new URL(uri); + // 打开URL连接并将其转换为HttpURLConnection对象,以便进行HTTP通信 + HttpURLConnection conn = (HttpURLConnection) url.openConnection(); + // 创建一个BufferedReader对象,用于读取服务器响应的输入流,指定字符编码为UTF-8 + BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream(), "UTF-8")); + // 定义一个字符串变量,用于临时存储每行响应内容 + String line; + // 逐行读取服务器响应内容,直到读取完毕 + while ((line = in.readLine()) != null) { + // 将每行响应内容添加到res字符串中,并在末尾添加换行符 + res += line + "\n"; + } + // 关闭BufferedReader对象,释放资源 + in.close(); + // 返回最终的响应结果 + return res; + } catch (Exception e) { + // 若发生异常,打印异常堆栈信息 + e.printStackTrace(); + // 发生异常时返回null + return null; + } + } +} + diff --git a/src/main/java/com/utils/JQPageInfo.java b/src/main/java/com/utils/JQPageInfo.java new file mode 100644 index 0000000..af075a4 --- /dev/null +++ b/src/main/java/com/utils/JQPageInfo.java @@ -0,0 +1,54 @@ +package com.utils; + +public class JQPageInfo{ + private Integer page; + + private Integer limit; + + private String sidx; + + private String order; + + private Integer offset; + + public Integer getPage() { + return page; + } + + public void setPage(Integer page) { + this.page = page; + } + + public Integer getLimit() { + return limit; + } + + public void setLimit(Integer limit) { + this.limit = limit; + } + + public String getSidx() { + return sidx; + } + + public void setSidx(String sidx) { + this.sidx = sidx; + } + + public String getOrder() { + return order; + } + + public void setOrder(String order) { + this.order = order; + } + + public Integer getOffset() { + return offset; + } + + public void setOffset(Integer offset) { + this.offset = offset; + } + +} diff --git a/src/main/java/com/utils/MPUtil.java b/src/main/java/com/utils/MPUtil.java new file mode 100644 index 0000000..5ea2b05 --- /dev/null +++ b/src/main/java/com/utils/MPUtil.java @@ -0,0 +1,276 @@ +package com.utils; + +import java.util.Arrays; +import java.util.HashMap; +import java.util.Iterator; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; + +import cn.hutool.core.bean.BeanUtil; + +import com.baomidou.mybatisplus.mapper.Wrapper; + +/** + * Mybatis-Plus工具类 + * 该类提供了一系列与MyBatis-Plus相关的工具方法,包括条件构造、属性转换等操作 + */ +public class MPUtil { + // 定义一个字符常量,表示下划线字符 + public static final char UNDERLINE = '_'; + + // 将对象的属性转换为Map,并将属性名从驼峰格式转换为下划线格式,同时添加前缀 + // mybatis plus allEQ 表达式转换 + public static Map allEQMapPre(Object bean, String pre) { + // 将对象转换为Map,使用BeanUtil工具类的beanToMap方法 + Map map = BeanUtil.beanToMap(bean); + // 将Map中的键从驼峰格式转换为下划线格式,并添加前缀 + return camelToUnderlineMap(map, pre); + } + + // 将对象的属性转换为Map,并将属性名从驼峰格式转换为下划线格式 + // mybatis plus allEQ 表达式转换 + public static Map allEQMap(Object bean) { + // 将对象转换为Map,使用BeanUtil工具类的beanToMap方法 + Map map = BeanUtil.beanToMap(bean); + // 将Map中的键从驼峰格式转换为下划线格式,不添加前缀 + return camelToUnderlineMap(map, ""); + } + + // 根据对象属性生成模糊查询条件,并添加前缀 + public static Wrapper allLikePre(Wrapper wrapper, Object bean, String pre) { + // 将对象转换为Map,使用BeanUtil工具类的beanToMap方法 + Map map = BeanUtil.beanToMap(bean); + // 将Map中的键从驼峰格式转换为下划线格式,并添加前缀 + Map result = camelToUnderlineMap(map, pre); + // 根据转换后的Map生成模糊查询条件 + return genLike(wrapper, result); + } + + // 根据对象属性生成模糊查询条件 + public static Wrapper allLike(Wrapper wrapper, Object bean) { + // 将对象转换为Map,忽略空值和默认值,使用BeanUtil工具类的beanToMap方法 + Map result = BeanUtil.beanToMap(bean, true, true); + // 根据转换后的Map生成模糊查询条件 + return genLike(wrapper, result); + } + + // 根据Map生成模糊查询条件 + public static Wrapper genLike(Wrapper wrapper, Map param) { + // 获取Map的键值对迭代器 + Iterator> it = param.entrySet().iterator(); + // 初始化计数器 + int i = 0; + // 遍历Map的键值对 + while (it.hasNext()) { + // 如果不是第一个条件,添加逻辑与操作 + if (i > 0) wrapper.and(); + // 获取当前键值对 + Map.Entry entry = it.next(); + // 获取键 + String key = entry.getKey(); + // 获取值 + String value = (String) entry.getValue(); + // 添加模糊查询条件 + wrapper.like(key, value); + // 计数器加1 + i++; + } + // 返回生成好的条件构造器 + return wrapper; + } + + // 根据对象属性生成模糊查询或等于查询条件 + public static Wrapper likeOrEq(Wrapper wrapper, Object bean) { + // 将对象转换为Map,忽略空值和默认值,使用BeanUtil工具类的beanToMap方法 + Map result = BeanUtil.beanToMap(bean, true, true); + // 根据转换后的Map生成模糊查询或等于查询条件 + return genLikeOrEq(wrapper, result); + } + + // 根据Map生成模糊查询或等于查询条件 + public static Wrapper genLikeOrEq(Wrapper wrapper, Map param) { + // 获取Map的键值对迭代器 + Iterator> it = param.entrySet().iterator(); + // 初始化计数器 + int i = 0; + // 遍历Map的键值对 + while (it.hasNext()) { + // 如果不是第一个条件,添加逻辑与操作 + if (i > 0) wrapper.and(); + // 获取当前键值对 + Map.Entry entry = it.next(); + // 获取键 + String key = entry.getKey(); + // 判断值中是否包含百分号(模糊查询标志) + if (entry.getValue().toString().contains("%")) { + // 如果包含百分号,添加模糊查询条件,并去除百分号 + wrapper.like(key, entry.getValue().toString().replace("%", "")); + } else { + // 如果不包含百分号,添加等于查询条件 + wrapper.eq(key, entry.getValue()); + } + // 计数器加1 + i++; + } + // 返回生成好的条件构造器 + return wrapper; + } + + // 根据对象属性生成等于查询条件 + public static Wrapper allEq(Wrapper wrapper, Object bean) { + // 将对象转换为Map,忽略空值和默认值,使用BeanUtil工具类的beanToMap方法 + Map result = BeanUtil.beanToMap(bean, true, true); + // 根据转换后的Map生成等于查询条件 + return genEq(wrapper, result); + } + + // 根据Map生成等于查询条件 + public static Wrapper genEq(Wrapper wrapper, Map param) { + // 获取Map的键值对迭代器 + Iterator> it = param.entrySet().iterator(); + // 初始化计数器 + int i = 0; + // 遍历Map的键值对 + while (it.hasNext()) { + // 如果不是第一个条件,添加逻辑与操作 + if (i > 0) wrapper.and(); + // 获取当前键值对 + Map.Entry entry = it.next(); + // 获取键 + String key = entry.getKey(); + // 添加等于查询条件 + wrapper.eq(key, entry.getValue()); + // 计数器加1 + i++; + } + // 返回生成好的条件构造器 + return wrapper; + } + + // 根据Map中的键值对生成范围查询条件(大于等于和小于等于) + public static Wrapper between(Wrapper wrapper, Map params) { + // 遍历Map的键 + for (String key : params.keySet()) { + // 定义列名变量 + String columnName = ""; + // 如果键以"_start"结尾 + if (key.endsWith("_start")) { + // 提取列名 + columnName = key.substring(0, key.indexOf("_start")); + // 如果值不为空 + if (StringUtils.isNotBlank(params.get(key).toString())) { + // 添加大于等于查询条件 + wrapper.ge(columnName, params.get(key)); + } + } + // 如果键以"_end"结尾 + if (key.endsWith("_end")) { + // 提取列名 + columnName = key.substring(0, key.indexOf("_end")); + // 如果值不为空 + if (StringUtils.isNotBlank(params.get(key).toString())) { + // 添加小于等于查询条件 + wrapper.le(columnName, params.get(key)); + } + } + } + // 返回生成好的条件构造器 + return wrapper; + } + + // 根据Map中的排序参数生成排序条件 + public static Wrapper sort(Wrapper wrapper, Map params) { + // 定义排序方向变量 + String order = ""; + // 如果排序方向参数不为空 + if (params.get("order") != null && StringUtils.isNotBlank(params.get("order").toString())) { + // 获取排序方向 + order = params.get("order").toString(); + } + // 如果排序字段参数不为空 + if (params.get("sort") != null && StringUtils.isNotBlank(params.get("sort").toString())) { + // 如果排序方向为降序 + if (order.equalsIgnoreCase("desc")) { + // 添加降序排序条件 + wrapper.orderDesc(Arrays.asList(params.get("sort"))); + } else { + // 添加升序排序条件 + wrapper.orderAsc(Arrays.asList(params.get("sort"))); + } + } + // 返回生成好的条件构造器 + return wrapper; + } + + /** + * 驼峰格式字符串转换为下划线格式字符串 + * + * @param param 待转换的驼峰格式字符串 + * @return 转换后的下划线格式字符串 + */ + public static String camelToUnderline(String param) { + // 如果参数为空或为空字符串 + if (param == null || "".equals(param.trim())) { + // 返回空字符串 + return ""; + } + // 获取字符串长度 + int len = param.length(); + // 创建一个StringBuilder对象 + StringBuilder sb = new StringBuilder(len); + // 遍历字符串 + for (int i = 0; i < len; i++) { + // 获取当前字符 + char c = param.charAt(i); + // 如果字符是大写字母 + if (Character.isUpperCase(c)) { + // 添加下划线 + sb.append(UNDERLINE); + // 添加转换为小写后的字符 + sb.append(Character.toLowerCase(c)); + } else { + // 添加当前字符 + sb.append(c); + } + } + // 返回转换后的字符串 + return sb.toString(); + } + + // 测试方法,用于测试驼峰转下划线方法 + public static void main(String[] ages) { + // 输出转换后的字符串 + System.out.println(camelToUnderline("ABCddfANM")); + } + + // 将Map中的键从驼峰格式转换为下划线格式,并根据前缀进行处理 + public static Map camelToUnderlineMap(Map param, String pre) { + // 创建一个新的HashMap + Map newMap = new HashMap(); + // 获取Map的键值对迭代器 + Iterator> it = param.entrySet().iterator(); + // 遍历Map的键值对 + while (it.hasNext()) { + // 获取当前键值对 + Map.Entry entry = it.next(); + // 获取键 + String key = entry.getKey(); + // 将键从驼峰格式转换为下划线格式 + String newKey = camelToUnderline(key); + // 根据前缀的情况进行处理 + if (pre.endsWith(".")) { + // 如果前缀以点结尾,直接添加前缀和新键 + newMap.put(pre + newKey, entry.getValue()); + } else if (StringUtils.isEmpty(pre)) { + // 如果前缀为空,只添加新键 + newMap.put(newKey, entry.getValue()); + } else { + // 否则,添加前缀、点和新键 + newMap.put(pre + "." + newKey, entry.getValue()); + } + } + // 返回转换后的Map + return newMap; + } +} diff --git a/src/main/java/com/utils/PageUtils.java b/src/main/java/com/utils/PageUtils.java new file mode 100644 index 0000000..f7356bf --- /dev/null +++ b/src/main/java/com/utils/PageUtils.java @@ -0,0 +1,101 @@ + +package com.utils; + +import java.io.Serializable; +import java.util.List; +import java.util.Map; + +import com.baomidou.mybatisplus.plugins.Page; + +/** + * 分页工具类 + */ +public class PageUtils implements Serializable { + private static final long serialVersionUID = 1L; + //总记录数 + private long total; + //每页记录数 + private int pageSize; + //总页数 + private long totalPage; + //当前页数 + private int currPage; + //列表数据 + private List> list; + + /** + * 分页 + * @param list 列表数据 + * @param totalCount 总记录数 + * @param pageSize 每页记录数 + * @param currPage 当前页数 + */ + public PageUtils(List> list, int totalCount, int pageSize, int currPage) { + this.list = list; + this.total = totalCount; + this.pageSize = pageSize; + this.currPage = currPage; + this.totalPage = (int)Math.ceil((double)totalCount/pageSize); + } + + /** + * 分页 + */ + public PageUtils(Page> page) { + this.list = page.getRecords(); + this.total = page.getTotal(); + this.pageSize = page.getSize(); + this.currPage = page.getCurrent(); + this.totalPage = page.getPages(); + } + + /* + * 空数据的分页 + */ + public PageUtils(Map params) { + Page page =new Query(params).getPage(); + new PageUtils(page); + } + + + public int getPageSize() { + return pageSize; + } + + public void setPageSize(int pageSize) { + this.pageSize = pageSize; + } + + public int getCurrPage() { + return currPage; + } + + public void setCurrPage(int currPage) { + this.currPage = currPage; + } + + public List> getList() { + return list; + } + + public void setList(List> list) { + this.list = list; + } + + public long getTotalPage() { + return totalPage; + } + + public void setTotalPage(long totalPage) { + this.totalPage = totalPage; + } + + public long getTotal() { + return total; + } + + public void setTotal(long total) { + this.total = total; + } + +} diff --git a/src/main/java/com/utils/Query.java b/src/main/java/com/utils/Query.java new file mode 100644 index 0000000..28a5696 --- /dev/null +++ b/src/main/java/com/utils/Query.java @@ -0,0 +1,133 @@ + +package com.utils; + +import java.util.LinkedHashMap; +import java.util.Map; + +import org.apache.commons.lang3.StringUtils; + +import com.baomidou.mybatisplus.plugins.Page; + +/** + * 查询参数 + * 该类继承自LinkedHashMap,用于封装查询参数,包括分页和排序等信息 + */ +public class Query extends LinkedHashMap { + // 序列化版本号,用于兼容不同版本的序列化和反序列化操作 + private static final long serialVersionUID = 1L; + /** + * mybatis-plus分页参数 + * 用于存储MyBatis-Plus的分页对象,包含分页信息 + */ + private Page page; + /** + * 当前页码 + * 表示当前查询的页码,默认为1 + */ + private int currPage = 1; + /** + * 每页条数 + * 表示每页返回的记录数量,默认为10 + */ + private int limit = 10; + + /** + * 构造函数,根据JQPageInfo对象初始化查询参数 + * @param pageInfo 包含分页和排序信息的JQPageInfo对象 + */ + public Query(JQPageInfo pageInfo) { + // 分页参数处理 + // 如果JQPageInfo中的page参数不为空,设置当前页码 + if (pageInfo.getPage()!= null) { + currPage = pageInfo.getPage(); + } + // 如果JQPageInfo中的limit参数不为空,设置每页条数 + if (pageInfo.getLimit()!= null) { + limit = pageInfo.getLimit(); + } + + // 防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) + // 对JQPageInfo中的sidx参数进行SQL注入过滤 + String sidx = SQLFilter.sqlInject(pageInfo.getSidx()); + // 对JQPageInfo中的order参数进行SQL注入过滤 + String order = SQLFilter.sqlInject(pageInfo.getOrder()); + + // mybatis-plus分页 + // 创建MyBatis-Plus的分页对象,传入当前页码和每页条数 + this.page = new Page<>(currPage, limit); + + // 排序 + // 如果sidx和order都不为空,设置排序字段和排序方向 + if (StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)) { + this.page.setOrderByField(sidx); + this.page.setAsc("ASC".equalsIgnoreCase(order)); + } + } + + /** + * 构造函数,根据Map对象初始化查询参数 + * @param params 包含查询参数的Map对象 + */ + public Query(Map params) { + // 将传入的参数Map中的所有键值对放入当前对象中 + this.putAll(params); + + // 分页参数处理 + // 如果params中的page参数不为空,设置当前页码 + if (params.get("page")!= null) { + currPage = Integer.parseInt((String) params.get("page")); + } + // 如果params中的limit参数不为空,设置每页条数 + if (params.get("limit")!= null) { + limit = Integer.parseInt((String) params.get("limit")); + } + + // 计算偏移量并将相关分页参数放入当前对象中 + this.put("offset", (currPage - 1) * limit); + this.put("page", currPage); + this.put("limit", limit); + + // 防止SQL注入(因为sidx、order是通过拼接SQL实现排序的,会有SQL注入风险) + // 对params中的sidx参数进行SQL注入过滤 + String sidx = SQLFilter.sqlInject((String) params.get("sidx")); + // 对params中的order参数进行SQL注入过滤 + String order = SQLFilter.sqlInject((String) params.get("order")); + // 将过滤后的sidx和order参数放入当前对象中 + this.put("sidx", sidx); + this.put("order", order); + + // mybatis-plus分页 + // 创建MyBatis-Plus的分页对象,传入当前页码和每页条数 + this.page = new Page<>(currPage, limit); + + // 排序 + // 如果sidx和order都不为空,设置排序字段和排序方向 + if (StringUtils.isNotBlank(sidx) && StringUtils.isNotBlank(order)) { + this.page.setOrderByField(sidx); + this.page.setAsc("ASC".equalsIgnoreCase(order)); + } + } + + /** + * 获取MyBatis-Plus的分页对象 + * @return MyBatis-Plus的分页对象Page + */ + public Page getPage() { + return page; + } + + /** + * 获取当前页码 + * @return 当前页码 + */ + public int getCurrPage() { + return currPage; + } + + /** + * 获取每页条数 + */ + public int getLimit() { + return limit; + } +} diff --git a/src/main/java/com/utils/R.java b/src/main/java/com/utils/R.java new file mode 100644 index 0000000..c5d8c37 --- /dev/null +++ b/src/main/java/com/utils/R.java @@ -0,0 +1,111 @@ +package com.utils; + +import java.util.HashMap; +import java.util.Map; + +/** + * 返回数据 + * 该类继承自 HashMap,用于封装接口返回的数据,包含状态码、消息和其他自定义数据 + */ +public class R extends HashMap { + // 序列化版本号,用于保证序列化和反序列化过程中类的版本一致性 + private static final long serialVersionUID = 1L; + + /** + * 无参构造函数 + * 初始化时默认设置状态码为 0,表示操作成功 + */ + public R() { + // 向 Map 中放入状态码,0 通常表示成功 + put("code", 0); + } + + /** + * 返回一个表示错误的 R 对象 + * 默认状态码为 500,错误消息为 "未知异常,请联系管理员" + * @return 包含错误信息的 R 对象 + */ + public static R error() { + // 调用另一个 error 方法,传入默认的状态码和错误消息 + return error(500, "未知异常,请联系管理员"); + } + + /** + * 返回一个表示错误的 R 对象,使用自定义的错误消息 + * 默认状态码为 500 + * @param msg 自定义的错误消息 + * @return 包含错误信息的 R 对象 + */ + public static R error(String msg) { + // 调用另一个 error 方法,传入默认的状态码和自定义的错误消息 + return error(500, msg); + } + + /** + * 返回一个表示错误的 R 对象,使用自定义的状态码和错误消息 + * @param code 自定义的状态码 + * @param msg 自定义的错误消息 + * @return 包含错误信息的 R 对象 + */ + public static R error(int code, String msg) { + // 创建一个新的 R 对象 + R r = new R(); + // 向 R 对象中放入自定义的状态码 + r.put("code", code); + // 向 R 对象中放入自定义的错误消息 + r.put("msg", msg); + // 返回包含错误信息的 R 对象 + return r; + } + + /** + * 返回一个表示成功的 R 对象,使用自定义的成功消息 + * @param msg 自定义的成功消息 + * @return 包含成功信息的 R 对象 + */ + public static R ok(String msg) { + // 创建一个新的 R 对象 + R r = new R(); + // 向 R 对象中放入自定义的成功消息 + r.put("msg", msg); + // 返回包含成功信息的 R 对象 + return r; + } + + /** + * 返回一个表示成功的 R 对象,将传入的 Map 中的所有键值对放入 R 对象中 + * @param map 包含自定义数据的 Map + * @return 包含成功信息和自定义数据的 R 对象 + */ + public static R ok(Map map) { + // 创建一个新的 R 对象 + R r = new R(); + // 将传入的 Map 中的所有键值对放入 R 对象中 + r.putAll(map); + // 返回包含成功信息和自定义数据的 R 对象 + return r; + } + + /** + * 返回一个表示成功的 R 对象 + * 使用默认的状态码 0,无额外消息 + * @return 包含成功信息的 R 对象 + */ + public static R ok() { + // 创建并返回一个新的 R 对象 + return new R(); + } + + /** + * 向 R 对象中放入键值对,并返回当前 R 对象,方便链式调用 + * @param key 键 + * @param value 值 + * @return 当前 R 对象 + */ + public R put(String key, Object value) { + // 调用父类的 put 方法,将键值对放入 Map 中 + super.put(key, value); + // 返回当前 R 对象,方便链式调用 + return this; + } +} \ No newline at end of file diff --git a/src/main/java/com/utils/SQLFilter.java b/src/main/java/com/utils/SQLFilter.java new file mode 100644 index 0000000..f6ce05d --- /dev/null +++ b/src/main/java/com/utils/SQLFilter.java @@ -0,0 +1,42 @@ + +package com.utils; + +import org.apache.commons.lang3.StringUtils; + +import com.entity.EIException; + +/** + * SQL过滤 + */ +public class SQLFilter { + + /** + * SQL注入过滤 + * @param str 待验证的字符串 + */ + public static String sqlInject(String str){ + if(StringUtils.isBlank(str)){ + return null; + } + //去掉'|"|;|\字符 + str = StringUtils.replace(str, "'", ""); + str = StringUtils.replace(str, "\"", ""); + str = StringUtils.replace(str, ";", ""); + str = StringUtils.replace(str, "\\", ""); + + //转换成小写 + str = str.toLowerCase(); + + //非法字符 + String[] keywords = {"master", "truncate", "insert", "select", "delete", "update", "declare", "alter", "drop"}; + + //判断是否包含非法字符 + for(String keyword : keywords){ + if(str.indexOf(keyword) != -1){ + throw new EIException("包含非法字符"); + } + } + + return str; + } +} diff --git a/src/main/java/com/utils/SpringContextUtils.java b/src/main/java/com/utils/SpringContextUtils.java new file mode 100644 index 0000000..fd3705b --- /dev/null +++ b/src/main/java/com/utils/SpringContextUtils.java @@ -0,0 +1,43 @@ + +package com.utils; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; +import org.springframework.stereotype.Component; + + +/** + * Spring Context 工具类 + */ +@Component +public class SpringContextUtils implements ApplicationContextAware { + public static ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) + throws BeansException { + SpringContextUtils.applicationContext = applicationContext; + } + + public static Object getBean(String name) { + return applicationContext.getBean(name); + } + + public static T getBean(String name, Class requiredType) { + return applicationContext.getBean(name, requiredType); + } + + public static boolean containsBean(String name) { + return applicationContext.containsBean(name); + } + + public static boolean isSingleton(String name) { + return applicationContext.isSingleton(name); + } + + public static Class extends Object> getType(String name) { + return applicationContext.getType(name); + } + +} \ No newline at end of file diff --git a/src/main/java/com/utils/StringUtil.java b/src/main/java/com/utils/StringUtil.java new file mode 100644 index 0000000..7af954b --- /dev/null +++ b/src/main/java/com/utils/StringUtil.java @@ -0,0 +1,15 @@ +package com.utils; + +public class StringUtil { + + public static boolean isEmpty(String s){ + if(s==null || s.equals("") || s.equals("null")){ + return true; + } + return false; + } + + public static boolean isNotEmpty(String s){ + return !StringUtil.isEmpty(s); + } +} diff --git a/src/main/java/com/utils/ValidatorUtils.java b/src/main/java/com/utils/ValidatorUtils.java new file mode 100644 index 0000000..375895a --- /dev/null +++ b/src/main/java/com/utils/ValidatorUtils.java @@ -0,0 +1,49 @@ + +package com.utils; + +// 导入Set接口,用于存储不重复元素的集合 +import java.util.Set; + +// 导入ConstraintViolation接口,代表约束验证的违规信息 +import javax.validation.ConstraintViolation; +// 导入Validation类,用于创建验证器工厂 +import javax.validation.Validation; +// 导入Validator接口,用于执行验证操作 +import javax.validation.Validator; + +// 导入自定义异常类EIException +import com.entity.EIException; + +/** + * hibernate-validator校验工具类 + * 该类提供了使用Hibernate Validator进行对象校验的功能 + */ +public class ValidatorUtils { + // 定义一个静态的Validator对象,用于执行验证操作 + private static Validator validator; + + // 静态代码块,在类加载时执行,用于初始化Validator对象 + static { + // 通过Validation类构建默认的验证器工厂,并从中获取验证器实例 + validator = Validation.buildDefaultValidatorFactory().getValidator(); + } + + /** + * 校验对象 + * @param object 待校验对象 + * @param groups 待校验的组 + * @throws EIException 校验不通过,则报EIException异常 + */ + public static void validateEntity(Object object, Class>... groups) + throws EIException { + // 调用验证器的validate方法对对象进行验证,返回一个包含约束违规信息的Set集合 + Set> constraintViolations = validator.validate(object, groups); + // 检查约束违规信息集合是否为空 + if (!constraintViolations.isEmpty()) { + // 若集合不为空,获取集合中的第一个约束违规信息 + ConstraintViolation constraint = (ConstraintViolation)constraintViolations.iterator().next(); + // 抛出自定义的EIException异常,并将约束违规信息的消息作为异常信息 + throw new EIException(constraint.getMessage()); + } + } +} diff --git a/src/main/java/main.iml b/src/main/java/main.iml deleted file mode 100644 index b107a2d..0000000 --- a/src/main/java/main.iml +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - - - - - - \ No newline at end of file diff --git a/src/main/webapp/WEB-INF/login.jsp b/src/main/webapp/WEB-INF/login.jsp deleted file mode 100644 index bf42849..0000000 --- a/src/main/webapp/WEB-INF/login.jsp +++ /dev/null @@ -1,107 +0,0 @@ -<%@ page language="java" contentType="text/html; charset=UTF-8" - pageEncoding="UTF-8"%> - - - - - 校园快递一站式服务系统 - - - - - - - - - - - - - - - - - - - 欢迎登录 - - 校园快递一站式服务系统 - - - - - - - - - - - 登录 - - 注册 - - - - - - - - - - - - - - - - - - diff --git a/src/main/webapp/WEB-INF/pay.jsp b/src/main/webapp/WEB-INF/pay.jsp deleted file mode 100644 index a8f8d4e..0000000 --- a/src/main/webapp/WEB-INF/pay.jsp +++ /dev/null @@ -1,179 +0,0 @@ -<%@ 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"%> - - - - - - -
校园快递一站式服务系统