From 057910103209b0aa68f8cdf58003c2830e0885cd Mon Sep 17 00:00:00 2001 From: sunyuchao Date: Mon, 16 Mar 2020 16:16:53 +0800 Subject: [PATCH] =?UTF-8?q?=E6=95=B0=E6=8D=AE=E5=BA=93=E8=A1=A8=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E7=94=9F=E6=88=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/epmet/dto/GridLatestDTO.java | 101 +++++++++++++++++ .../java/com/epmet/dto/GridVisitedDTO.java | 101 +++++++++++++++++ .../controller/GridLatestController.java | 94 ++++++++++++++++ .../controller/GridVisitedController.java | 94 ++++++++++++++++ .../java/com/epmet/dao/GridLatestDao.java | 33 ++++++ .../java/com/epmet/dao/GridVisitedDao.java | 33 ++++++ .../com/epmet/entity/GridLatestEntity.java | 71 ++++++++++++ .../com/epmet/entity/GridVisitedEntity.java | 71 ++++++++++++ .../java/com/epmet/excel/GridLatestExcel.java | 74 +++++++++++++ .../com/epmet/excel/GridVisitedExcel.java | 74 +++++++++++++ .../java/com/epmet/redis/GridLatestRedis.java | 47 ++++++++ .../com/epmet/redis/GridVisitedRedis.java | 47 ++++++++ .../com/epmet/service/GridLatestService.java | 95 ++++++++++++++++ .../com/epmet/service/GridVisitedService.java | 95 ++++++++++++++++ .../service/impl/GridLatestServiceImpl.java | 104 ++++++++++++++++++ .../service/impl/GridVisitedServiceImpl.java | 104 ++++++++++++++++++ .../main/resources/mapper/GridLatestDao.xml | 23 ++++ .../main/resources/mapper/GridVisitedDao.xml | 23 ++++ 18 files changed, 1284 insertions(+) create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridLatestDTO.java create mode 100644 epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridVisitedDTO.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridLatestEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridVisitedEntity.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridLatestExcel.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridVisitedExcel.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml create mode 100644 epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridLatestDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridLatestDTO.java new file mode 100644 index 0000000000..98a6176f5f --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridLatestDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class GridLatestDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 网格表Id(CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 用户Id(CUSTOMER_USER.id) + */ + private String customerUserId; + + /** + * 所属地区码 (数据统计字段) + */ + private String areaCode; + + /** + * 上级组织ID (数据统计字段) + */ + private String pid; + + /** + * 最近访问时间 + */ + private Date latestTime; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridVisitedDTO.java b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridVisitedDTO.java new file mode 100644 index 0000000000..cf2c85a332 --- /dev/null +++ b/epmet-user/epmet-user-client/src/main/java/com/epmet/dto/GridVisitedDTO.java @@ -0,0 +1,101 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dto; + +import java.io.Serializable; +import java.util.Date; +import lombok.Data; + + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class GridVisitedDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + /** + * 唯一标识 + */ + private String id; + + /** + * 是否注册(0:否 1:是) + */ + private Integer isRegister; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格表Id (CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 用户Id + */ + private String customerUserId; + + /** + * 是否首次位置授权(0:否 1:是) + */ + private Integer isAuthorized; + + /** + * 访问时间 一个用户一天访问一个网格只有一条记录 + */ + private Date visitTime; + + /** + * 删除标识:0.未删除 1.已删除 + */ + private Integer delFlag; + + /** + * 乐观锁 + */ + private Integer revision; + + /** + * 创建人 + */ + private String createdBy; + + /** + * 创建时间 + */ + private Date createdTime; + + /** + * 更新人 + */ + private String updatedBy; + + /** + * 更新时间 + */ + private Date updatedTime; + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java new file mode 100644 index 0000000000..a6c1500b02 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridLatestController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.GridLatestDTO; +import com.epmet.excel.GridLatestExcel; +import com.epmet.service.GridLatestService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@RestController +@RequestMapping("gridlatest") +public class GridLatestController { + + @Autowired + private GridLatestService gridLatestService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = gridLatestService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + GridLatestDTO data = gridLatestService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody GridLatestDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + gridLatestService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody GridLatestDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + gridLatestService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + gridLatestService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = gridLatestService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, GridLatestExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java new file mode 100644 index 0000000000..a960c39e20 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/controller/GridVisitedController.java @@ -0,0 +1,94 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.controller; + +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ExcelUtils; +import com.epmet.commons.tools.utils.Result; +import com.epmet.commons.tools.validator.AssertUtils; +import com.epmet.commons.tools.validator.ValidatorUtils; +import com.epmet.commons.tools.validator.group.AddGroup; +import com.epmet.commons.tools.validator.group.UpdateGroup; +import com.epmet.commons.tools.validator.group.DefaultGroup; +import com.epmet.dto.GridVisitedDTO; +import com.epmet.excel.GridVisitedExcel; +import com.epmet.service.GridVisitedService; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.web.bind.annotation.*; + +import javax.servlet.http.HttpServletResponse; +import java.util.List; +import java.util.Map; + + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@RestController +@RequestMapping("gridvisited") +public class GridVisitedController { + + @Autowired + private GridVisitedService gridVisitedService; + + @GetMapping("page") + public Result> page(@RequestParam Map params){ + PageData page = gridVisitedService.page(params); + return new Result>().ok(page); + } + + @GetMapping("{id}") + public Result get(@PathVariable("id") String id){ + GridVisitedDTO data = gridVisitedService.get(id); + return new Result().ok(data); + } + + @PostMapping + public Result save(@RequestBody GridVisitedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); + gridVisitedService.save(dto); + return new Result(); + } + + @PutMapping + public Result update(@RequestBody GridVisitedDTO dto){ + //效验数据 + ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); + gridVisitedService.update(dto); + return new Result(); + } + + @DeleteMapping + public Result delete(@RequestBody String[] ids){ + //效验数据 + AssertUtils.isArrayEmpty(ids, "id"); + gridVisitedService.delete(ids); + return new Result(); + } + + @GetMapping("export") + public void export(@RequestParam Map params, HttpServletResponse response) throws Exception { + List list = gridVisitedService.list(params); + ExcelUtils.exportExcelToTarget(response, null, list, GridVisitedExcel.class); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java new file mode 100644 index 0000000000..2b31a4b1a8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridLatestDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.GridLatestEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface GridLatestDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java new file mode 100644 index 0000000000..e51d88956d --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/dao/GridVisitedDao.java @@ -0,0 +1,33 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.dao; + +import com.epmet.commons.mybatis.dao.BaseDao; +import com.epmet.entity.GridVisitedEntity; +import org.apache.ibatis.annotations.Mapper; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Mapper +public interface GridVisitedDao extends BaseDao { + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridLatestEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridLatestEntity.java new file mode 100644 index 0000000000..254829c16f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridLatestEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("grid_latest") +public class GridLatestEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 客户Id CUSTOMER.id + */ + private String customerId; + + /** + * 网格表Id(CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 用户Id(CUSTOMER_USER.id) + */ + private String customerUserId; + + /** + * 所属地区码 (数据统计字段) + */ + private String areaCode; + + /** + * 上级组织ID (数据统计字段) + */ + private String pid; + + /** + * 最近访问时间 + */ + private Date latestTime; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridVisitedEntity.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridVisitedEntity.java new file mode 100644 index 0000000000..9fb79ca7af --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/entity/GridVisitedEntity.java @@ -0,0 +1,71 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.entity; + +import com.baomidou.mybatisplus.annotation.TableName; + +import com.epmet.commons.mybatis.entity.BaseEpmetEntity; +import lombok.Data; +import lombok.EqualsAndHashCode; + +import java.util.Date; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +@EqualsAndHashCode(callSuper=false) +@TableName("grid_visited") +public class GridVisitedEntity extends BaseEpmetEntity { + + private static final long serialVersionUID = 1L; + + /** + * 是否注册(0:否 1:是) + */ + private Integer isRegister; + + /** + * 客户ID + */ + private String customerId; + + /** + * 网格表Id (CUSTOMER_GRID.id) + */ + private String gridId; + + /** + * 用户Id + */ + private String customerUserId; + + /** + * 是否首次位置授权(0:否 1:是) + */ + private Integer isAuthorized; + + /** + * 访问时间 一个用户一天访问一个网格只有一条记录 + */ + private Date visitTime; + +} diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridLatestExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridLatestExcel.java new file mode 100644 index 0000000000..e4d6000914 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridLatestExcel.java @@ -0,0 +1,74 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class GridLatestExcel { + + @Excel(name = "唯一标识") + private String id; + + @Excel(name = "客户Id CUSTOMER.id") + private String customerId; + + @Excel(name = "网格表Id(CUSTOMER_GRID.id)") + private String gridId; + + @Excel(name = "用户Id(CUSTOMER_USER.id)") + private String customerUserId; + + @Excel(name = "所属地区码 (数据统计字段)") + private String areaCode; + + @Excel(name = "上级组织ID (数据统计字段)") + private String pid; + + @Excel(name = "最近访问时间") + private Date latestTime; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridVisitedExcel.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridVisitedExcel.java new file mode 100644 index 0000000000..13c5fefc26 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/excel/GridVisitedExcel.java @@ -0,0 +1,74 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.excel; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.Date; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Data +public class GridVisitedExcel { + + @Excel(name = "唯一标识") + private String id; + + @Excel(name = "是否注册(0:否 1:是)") + private Integer isRegister; + + @Excel(name = "客户ID") + private String customerId; + + @Excel(name = "网格表Id (CUSTOMER_GRID.id)") + private String gridId; + + @Excel(name = "用户Id") + private String customerUserId; + + @Excel(name = "是否首次位置授权(0:否 1:是)") + private Integer isAuthorized; + + @Excel(name = "访问时间 一个用户一天访问一个网格只有一条记录") + private Date visitTime; + + @Excel(name = "删除标识:0.未删除 1.已删除") + private Integer delFlag; + + @Excel(name = "乐观锁") + private Integer revision; + + @Excel(name = "创建人") + private String createdBy; + + @Excel(name = "创建时间") + private Date createdTime; + + @Excel(name = "更新人") + private String updatedBy; + + @Excel(name = "更新时间") + private Date updatedTime; + + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java new file mode 100644 index 0000000000..41bf0cfb49 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridLatestRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Component +public class GridLatestRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java new file mode 100644 index 0000000000..9316d6f3c7 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/redis/GridVisitedRedis.java @@ -0,0 +1,47 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.redis; + +import com.epmet.commons.tools.redis.RedisUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Component; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Component +public class GridVisitedRedis { + @Autowired + private RedisUtils redisUtils; + + public void delete(Object[] ids) { + + } + + public void set(){ + + } + + public String get(String id){ + return null; + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java new file mode 100644 index 0000000000..1ddbb716a8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridLatestService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.GridLatestDTO; +import com.epmet.entity.GridLatestEntity; + +import java.util.List; +import java.util.Map; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +public interface GridLatestService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GridLatestDTO + * @author generator + * @date 2020-03-16 + */ + GridLatestDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-16 + */ + void save(GridLatestDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-16 + */ + void update(GridLatestDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-16 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java new file mode 100644 index 0000000000..d081fab310 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/GridVisitedService.java @@ -0,0 +1,95 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service; + +import com.epmet.commons.mybatis.service.BaseService; +import com.epmet.commons.tools.page.PageData; +import com.epmet.dto.GridVisitedDTO; +import com.epmet.entity.GridVisitedEntity; + +import java.util.List; +import java.util.Map; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +public interface GridVisitedService extends BaseService { + + /** + * 默认分页 + * + * @param params + * @return PageData + * @author generator + * @date 2020-03-16 + */ + PageData page(Map params); + + /** + * 默认查询 + * + * @param params + * @return java.util.List + * @author generator + * @date 2020-03-16 + */ + List list(Map params); + + /** + * 单条查询 + * + * @param id + * @return GridVisitedDTO + * @author generator + * @date 2020-03-16 + */ + GridVisitedDTO get(String id); + + /** + * 默认保存 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-16 + */ + void save(GridVisitedDTO dto); + + /** + * 默认更新 + * + * @param dto + * @return void + * @author generator + * @date 2020-03-16 + */ + void update(GridVisitedDTO dto); + + /** + * 批量删除 + * + * @param ids + * @return void + * @author generator + * @date 2020-03-16 + */ + void delete(String[] ids); +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java new file mode 100644 index 0000000000..1ab4bac35f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridLatestServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.GridLatestDao; +import com.epmet.dto.GridLatestDTO; +import com.epmet.entity.GridLatestEntity; +import com.epmet.redis.GridLatestRedis; +import com.epmet.service.GridLatestService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 最近访问网格表 记录用户访问网格的最近一次记录,对同一网格只记录一条记录,同一网格每次只更新最近一次访问的时间 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Service +public class GridLatestServiceImpl extends BaseServiceImpl implements GridLatestService { + + @Autowired + private GridLatestRedis gridLatestRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GridLatestDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GridLatestDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public GridLatestDTO get(String id) { + GridLatestEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GridLatestDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GridLatestDTO dto) { + GridLatestEntity entity = ConvertUtils.sourceToTarget(dto, GridLatestEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GridLatestDTO dto) { + GridLatestEntity entity = ConvertUtils.sourceToTarget(dto, GridLatestEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java new file mode 100644 index 0000000000..fdf5bd0a2f --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/GridVisitedServiceImpl.java @@ -0,0 +1,104 @@ +/** + * Copyright 2018 人人开源 https://www.renren.io + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + *

+ * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + *

+ * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package com.epmet.service.impl; + +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; +import com.baomidou.mybatisplus.core.metadata.IPage; +import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; +import com.epmet.commons.tools.page.PageData; +import com.epmet.commons.tools.utils.ConvertUtils; +import com.epmet.commons.tools.constant.FieldConstant; +import com.epmet.dao.GridVisitedDao; +import com.epmet.dto.GridVisitedDTO; +import com.epmet.entity.GridVisitedEntity; +import com.epmet.redis.GridVisitedRedis; +import com.epmet.service.GridVisitedService; +import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Transactional; + +import java.util.Arrays; +import java.util.List; +import java.util.Map; + +/** + * 网格访问记录表 用户对网格访问的一个记录,只有在访问网格首页时才存储数据,一个用户一天对一个网格的访问只有一条记录 + * + * @author generator generator@elink-cn.com + * @since v1.0.0 2020-03-16 + */ +@Service +public class GridVisitedServiceImpl extends BaseServiceImpl implements GridVisitedService { + + @Autowired + private GridVisitedRedis gridVisitedRedis; + + @Override + public PageData page(Map params) { + IPage page = baseDao.selectPage( + getPage(params, FieldConstant.CREATED_TIME, false), + getWrapper(params) + ); + return getPageData(page, GridVisitedDTO.class); + } + + @Override + public List list(Map params) { + List entityList = baseDao.selectList(getWrapper(params)); + + return ConvertUtils.sourceToTarget(entityList, GridVisitedDTO.class); + } + + private QueryWrapper getWrapper(Map params){ + String id = (String)params.get(FieldConstant.ID_HUMP); + + QueryWrapper wrapper = new QueryWrapper<>(); + wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); + + return wrapper; + } + + @Override + public GridVisitedDTO get(String id) { + GridVisitedEntity entity = baseDao.selectById(id); + return ConvertUtils.sourceToTarget(entity, GridVisitedDTO.class); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void save(GridVisitedDTO dto) { + GridVisitedEntity entity = ConvertUtils.sourceToTarget(dto, GridVisitedEntity.class); + insert(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(GridVisitedDTO dto) { + GridVisitedEntity entity = ConvertUtils.sourceToTarget(dto, GridVisitedEntity.class); + updateById(entity); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(String[] ids) { + // 逻辑删除(@TableLogic 注解) + baseDao.deleteBatchIds(Arrays.asList(ids)); + } + +} \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml new file mode 100644 index 0000000000..c05db815e8 --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GridLatestDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml b/epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml new file mode 100644 index 0000000000..2ea9a363db --- /dev/null +++ b/epmet-user/epmet-user-server/src/main/resources/mapper/GridVisitedDao.xml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file