94 changed files with 3714 additions and 293 deletions
@ -0,0 +1,38 @@ |
|||||
|
package com.epmet.dto.form;/** |
||||
|
* Created by 11 on 2020/3/19. |
||||
|
*/ |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.Min; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生人导览查询附近网格传参定义 |
||||
|
* @ClassName ListCustomerGridFormDTO |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.19 15:00 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class ListCustomerGridFormDTO implements Serializable{ |
||||
|
|
||||
|
private static final long serialVersionUID = -1L; |
||||
|
|
||||
|
/** |
||||
|
* 地区编码(城市、区县) |
||||
|
* */ |
||||
|
@NotBlank(message = "地区码不能为空") |
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 当前页 |
||||
|
* */ |
||||
|
@Min(value = 1) |
||||
|
private Integer pageNo; |
||||
|
|
||||
|
/** |
||||
|
* 每页显示数量 |
||||
|
* */ |
||||
|
private Integer pageSize = 20; |
||||
|
} |
||||
@ -0,0 +1,31 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生人搜索网格返回结果 |
||||
|
* @ClassName CustomerGridForStrangerResultDTO |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.19 00:38 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerGridForStrangerResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = -1L; |
||||
|
|
||||
|
/** |
||||
|
* 网格ID |
||||
|
* */ |
||||
|
private String gridId; |
||||
|
|
||||
|
/** |
||||
|
* 客户ID |
||||
|
* */ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 网格名称 |
||||
|
* */ |
||||
|
private String gridName; |
||||
|
} |
||||
@ -0,0 +1,20 @@ |
|||||
|
package com.epmet.exception; |
||||
|
|
||||
|
import com.epmet.commons.tools.exception.ErrorCode; |
||||
|
|
||||
|
/** |
||||
|
* 模块错误编码,由9位数字组成,前6位为模块编码,后3位为业务编码 |
||||
|
* <p> |
||||
|
* 如:100001001(100001代表模块,001代表业务代码) |
||||
|
* </p> |
||||
|
* |
||||
|
* @author Mark sunlightcs@gmail.com |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
public interface ModuleErrorCode extends ErrorCode { |
||||
|
|
||||
|
int ARGS_NOT_ALLOW_NULL_ERROR = 100019001; |
||||
|
|
||||
|
int NOT_STANDARD_AREA_CODE_ERROR = 100019002; |
||||
|
|
||||
|
} |
||||
@ -1,104 +0,0 @@ |
|||||
/** |
|
||||
* Copyright 2018 人人开源 https://www.renren.io
|
|
||||
* <p> |
|
||||
* 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. |
|
||||
* <p> |
|
||||
* 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. |
|
||||
* <p> |
|
||||
* You should have received a copy of the GNU General Public License |
|
||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||
*/ |
|
||||
|
|
||||
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.PdmanDbVersionDao; |
|
||||
import com.epmet.dto.PdmanDbVersionDTO; |
|
||||
import com.epmet.entity.PdmanDbVersionEntity; |
|
||||
import com.epmet.redis.PdmanDbVersionRedis; |
|
||||
import com.epmet.service.PdmanDbVersionService; |
|
||||
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 PdmanDbVersionServiceImpl extends BaseServiceImpl<PdmanDbVersionDao, PdmanDbVersionEntity> implements PdmanDbVersionService { |
|
||||
|
|
||||
@Autowired |
|
||||
private PdmanDbVersionRedis pdmanDbVersionRedis; |
|
||||
|
|
||||
@Override |
|
||||
public PageData<PdmanDbVersionDTO> page(Map<String, Object> params) { |
|
||||
IPage<PdmanDbVersionEntity> page = baseDao.selectPage( |
|
||||
getPage(params, FieldConstant.CREATED_TIME, false), |
|
||||
getWrapper(params) |
|
||||
); |
|
||||
return getPageData(page, PdmanDbVersionDTO.class); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public List<PdmanDbVersionDTO> list(Map<String, Object> params) { |
|
||||
List<PdmanDbVersionEntity> entityList = baseDao.selectList(getWrapper(params)); |
|
||||
|
|
||||
return ConvertUtils.sourceToTarget(entityList, PdmanDbVersionDTO.class); |
|
||||
} |
|
||||
|
|
||||
private QueryWrapper<PdmanDbVersionEntity> getWrapper(Map<String, Object> params){ |
|
||||
String id = (String)params.get(FieldConstant.ID_HUMP); |
|
||||
|
|
||||
QueryWrapper<PdmanDbVersionEntity> wrapper = new QueryWrapper<>(); |
|
||||
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
|
||||
|
|
||||
return wrapper; |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
public PdmanDbVersionDTO get(String id) { |
|
||||
PdmanDbVersionEntity entity = baseDao.selectById(id); |
|
||||
return ConvertUtils.sourceToTarget(entity, PdmanDbVersionDTO.class); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
@Transactional(rollbackFor = Exception.class) |
|
||||
public void save(PdmanDbVersionDTO dto) { |
|
||||
PdmanDbVersionEntity entity = ConvertUtils.sourceToTarget(dto, PdmanDbVersionEntity.class); |
|
||||
insert(entity); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
@Transactional(rollbackFor = Exception.class) |
|
||||
public void update(PdmanDbVersionDTO dto) { |
|
||||
PdmanDbVersionEntity entity = ConvertUtils.sourceToTarget(dto, PdmanDbVersionEntity.class); |
|
||||
updateById(entity); |
|
||||
} |
|
||||
|
|
||||
@Override |
|
||||
@Transactional(rollbackFor = Exception.class) |
|
||||
public void delete(String[] ids) { |
|
||||
// 逻辑删除(@TableLogic 注解)
|
|
||||
baseDao.deleteBatchIds(Arrays.asList(ids)); |
|
||||
} |
|
||||
|
|
||||
} |
|
||||
@ -1,13 +0,0 @@ |
|||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
|
||||
|
|
||||
<mapper namespace="com.epmet.dao.PdmanDbVersionDao"> |
|
||||
|
|
||||
<resultMap type="com.epmet.entity.PdmanDbVersionEntity" id="pdmanDbVersionMap"> |
|
||||
<result property="dbVersion" column="DB_VERSION"/> |
|
||||
<result property="versionDesc" column="VERSION_DESC"/> |
|
||||
<result property="createdTime" column="CREATED_TIME"/> |
|
||||
</resultMap> |
|
||||
|
|
||||
|
|
||||
</mapper> |
|
||||
@ -0,0 +1,25 @@ |
|||||
|
/** |
||||
|
* Copyright (c) 2018 人人开源 All rights reserved. |
||||
|
* <p> |
||||
|
* https://www.renren.io
|
||||
|
* <p> |
||||
|
* 版权所有,侵权必究! |
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.constant; |
||||
|
|
||||
|
/** |
||||
|
* 常量 |
||||
|
* @author sun |
||||
|
* @since 1.0.0 |
||||
|
*/ |
||||
|
public interface OperCustomizeConstant { |
||||
|
/** |
||||
|
* 数据状态-已发布 |
||||
|
*/ |
||||
|
String STATUS = "0"; |
||||
|
/** |
||||
|
* 数据状态-草稿 |
||||
|
*/ |
||||
|
String STATUS_ONE = "1"; |
||||
|
} |
||||
@ -0,0 +1,34 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生人导览-点击网格链接获取客户首页配置入参DTO |
||||
|
* @Author sun |
||||
|
* @Date 2020/3/16 11:27 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerHomeFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 5272251336837515372L; |
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
@NotBlank(message = "客户ID不能为空") |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 所属端类型0.居民端,1.政府端 |
||||
|
*/ |
||||
|
@NotBlank(message = "所属端类型不能为空(0居民端1政府端)") |
||||
|
private String clientType; |
||||
|
|
||||
|
/** |
||||
|
* 状态:0.已发布 1.草稿 |
||||
|
*/ |
||||
|
@NotBlank(message = "状态(0已发布1草稿)") |
||||
|
private String status; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,42 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* 运营端-客户定制化服务-首页设计稿组件上传数据-入参 |
||||
|
* @author zhaoqifeng |
||||
|
* @date 2020/3/16 11:27 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class HomeComponentFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 组件id |
||||
|
*/ |
||||
|
private String componentId; |
||||
|
|
||||
|
/** |
||||
|
* 所属区域:titleList.标题区、topList.置顶区、functionList.功能区、floatingList.悬浮区 |
||||
|
*/ |
||||
|
private String region; |
||||
|
|
||||
|
/** |
||||
|
* 高级配置项 |
||||
|
*/ |
||||
|
private String configuration; |
||||
|
|
||||
|
/** |
||||
|
* 默认数据 |
||||
|
*/ |
||||
|
private String demoData; |
||||
|
|
||||
|
/** |
||||
|
* 显示顺序 |
||||
|
*/ |
||||
|
private Integer displayOrder; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 运营端-客户定制化服务-获取客户首页配置的设计稿-入参 |
||||
|
* @Author yangshaoping |
||||
|
* @Date 2020/3/16 11:27 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class HomeDesignByCustomerFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 5272251336837515372L; |
||||
|
/** |
||||
|
* 客户ID |
||||
|
*/ |
||||
|
@NotBlank(message = "客户ID不能为空") |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 所属端类型0.居民端,1.政府端 |
||||
|
*/ |
||||
|
@NotBlank(message = "所属端类型不能为空(0居民端1政府端)") |
||||
|
private String clientType; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,33 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
/** |
||||
|
* 运营端-客户定制化服务-首页设计稿组件上传数据-入参 |
||||
|
* @author zhaoqifeng |
||||
|
* @date 2020/3/16 11:27 |
||||
|
*/ |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
|
||||
|
@Data |
||||
|
public class HomeDesignFormDTO implements Serializable { |
||||
|
|
||||
|
|
||||
|
private static final long serialVersionUID = -246434129998560246L; |
||||
|
|
||||
|
/** |
||||
|
* 客户id |
||||
|
*/ |
||||
|
private String customerId; |
||||
|
|
||||
|
/** |
||||
|
* 所属端类型 0:居民端 1:政府端 |
||||
|
*/ |
||||
|
private String clientType; |
||||
|
|
||||
|
/** |
||||
|
* 组件集合 |
||||
|
*/ |
||||
|
private List<HomeComponentFormDTO> componentList; |
||||
|
} |
||||
@ -0,0 +1,50 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description 运营端-客户定制化服务-获取客户可用组件列表-返参[commonList(通用组件列表)属性对应DTO] |
||||
|
* @Author yang |
||||
|
* @Date 2020/3/16 12:59 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CommonComponentDesignResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 2971689193155710437L; |
||||
|
|
||||
|
/** |
||||
|
* 组件id |
||||
|
*/ |
||||
|
private String componentId; |
||||
|
|
||||
|
/** |
||||
|
* 组件名称 |
||||
|
*/ |
||||
|
private String componentName; |
||||
|
/** |
||||
|
* 所属区域 |
||||
|
*/ |
||||
|
private String region; |
||||
|
|
||||
|
/** |
||||
|
* 组件前端标识 |
||||
|
*/ |
||||
|
private String componentFrontId; |
||||
|
|
||||
|
/** |
||||
|
* 高级设置 |
||||
|
*/ |
||||
|
private String configuration; |
||||
|
|
||||
|
/** |
||||
|
* 默认数据 |
||||
|
*/ |
||||
|
private String demoData; |
||||
|
|
||||
|
/** |
||||
|
* 显示顺序 |
||||
|
*/ |
||||
|
private int displayOrder; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
package com.epmet.dto.result; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import java.io.Serializable; |
||||
|
import java.util.List; |
||||
|
import java.util.Set; |
||||
|
|
||||
|
/** |
||||
|
* @Description 运营端-客户定制化服务-获取客户首页配置的设计稿返参 |
||||
|
* @Author yang |
||||
|
* @Date 2020/3/16 12:57 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class HomeDesignByCustomerResultDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 1496786567582303921L; |
||||
|
/** |
||||
|
* 标题区 |
||||
|
*/ |
||||
|
private List<CommonComponentDesignResultDTO> titleList; |
||||
|
/** |
||||
|
* 置顶区 |
||||
|
*/ |
||||
|
private List<CommonComponentDesignResultDTO> topList; |
||||
|
/** |
||||
|
* 功能区 |
||||
|
*/ |
||||
|
private List<CommonComponentDesignResultDTO> functionList; |
||||
|
/** |
||||
|
* 悬浮区 |
||||
|
*/ |
||||
|
private List<CommonComponentDesignResultDTO> floatingList; |
||||
|
/** |
||||
|
*用于标识已使用的功能组件id列表(不含通用组件) |
||||
|
*/ |
||||
|
private List<String> usedComponentIdList; |
||||
|
} |
||||
@ -0,0 +1,19 @@ |
|||||
|
package com.epmet.constant; |
||||
|
|
||||
|
/** |
||||
|
* @Classname ReginEnum |
||||
|
* @Description 所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区 |
||||
|
* @Date 2020/3/17 15:22 |
||||
|
* @Created by yangs |
||||
|
*/ |
||||
|
public interface ReginConstant { |
||||
|
//所属区域:0.标题区、1.置顶区、2.功能区、3.悬浮区
|
||||
|
//0.标题区
|
||||
|
String titleList="titleList"; |
||||
|
//1.置顶区
|
||||
|
String topList="topList"; |
||||
|
//2.功能区
|
||||
|
String functionList="functionList"; |
||||
|
//3.悬浮区
|
||||
|
String floatingList="floatingList"; |
||||
|
} |
||||
@ -0,0 +1,64 @@ |
|||||
|
package com.epmet.dto;/** |
||||
|
* Created by 11 on 2020/3/17. |
||||
|
*/ |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.Min; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @ClassName CustomerGridListQueryDTO |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.17 13:45 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerGridListQueryDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 当前页 |
||||
|
* */ |
||||
|
@Min(value = 1) |
||||
|
private Integer pageNo; |
||||
|
|
||||
|
/** |
||||
|
* 每页数量 |
||||
|
* */ |
||||
|
private Integer pageSize = 20; |
||||
|
|
||||
|
/** |
||||
|
* 地区码 |
||||
|
* */ |
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 选定地区编码 |
||||
|
* */ |
||||
|
private String selectedAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 是否首次位置授权(0:是 1:否) |
||||
|
*/ |
||||
|
private Integer isAuthorized; |
||||
|
|
||||
|
/** |
||||
|
* 前端传递的省份 |
||||
|
* */ |
||||
|
@NotBlank(message = "省份信息不能为空") |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 前端传递的城市 |
||||
|
* */ |
||||
|
@NotBlank(message = "城市信息不能为空") |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 前端传递的地区 |
||||
|
* */ |
||||
|
private String area; |
||||
|
} |
||||
@ -0,0 +1,111 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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-19 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class StrangerAccessRecordDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 唯一标识 |
||||
|
*/ |
||||
|
private String id; |
||||
|
|
||||
|
/** |
||||
|
* 定位地区编码 (用户允许获取位置) |
||||
|
*/ |
||||
|
private String locationAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 选择地区编码 (用户选择地区位置 |
||||
|
*/ |
||||
|
private String lelectedAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 省份 |
||||
|
*/ |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 城市 |
||||
|
*/ |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 城市 |
||||
|
*/ |
||||
|
private String area; |
||||
|
|
||||
|
/** |
||||
|
* 是否首次位置授权(0:是 1:否) |
||||
|
*/ |
||||
|
private Integer isAuthorized; |
||||
|
|
||||
|
/** |
||||
|
* 网格数 根据位置查询到的附近网格数 |
||||
|
*/ |
||||
|
private Integer gridNumber; |
||||
|
|
||||
|
/** |
||||
|
* 访问时间 访问的当前时间 |
||||
|
*/ |
||||
|
private Date visitTime; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,61 @@ |
|||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.Min; |
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
/** |
||||
|
* @Description |
||||
|
* @ClassName CustomerGridListFormDTO |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.19 14:19 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class CustomerGridListFormDTO implements Serializable { |
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 当前页 |
||||
|
* */ |
||||
|
@Min(value = 1) |
||||
|
private Integer pageNo; |
||||
|
|
||||
|
/** |
||||
|
* 每页数量 |
||||
|
* */ |
||||
|
private Integer pageSize = 20; |
||||
|
|
||||
|
/** |
||||
|
* 地区码 |
||||
|
* */ |
||||
|
private String areaCode; |
||||
|
|
||||
|
/** |
||||
|
* 选定地区编码 |
||||
|
* */ |
||||
|
private String selectedAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 是否首次位置授权(0:是 1:否) |
||||
|
*/ |
||||
|
private Integer isAuthorized; |
||||
|
|
||||
|
/** |
||||
|
* 前端传递的省份 |
||||
|
* */ |
||||
|
@NotBlank(message = "省份信息不能为空") |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 前端传递的城市 |
||||
|
* */ |
||||
|
@NotBlank(message = "城市信息不能为空") |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 前端传递的地区 |
||||
|
* */ |
||||
|
private String area; |
||||
|
} |
||||
@ -0,0 +1,89 @@ |
|||||
|
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.dto.StrangerAccessRecordDTO; |
||||
|
import com.epmet.dto.form.CustomerGridListFormDTO; |
||||
|
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; |
||||
|
import com.epmet.commons.tools.validator.group.AddGroup; |
||||
|
import com.epmet.commons.tools.validator.group.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.excel.StrangerAccessRecordExcel; |
||||
|
import com.epmet.service.StrangerAccessRecordService; |
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生人导览模块 |
||||
|
* @ClassName StrangerAccessRecordController |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.17 11:33 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("strangerAccessRecord") |
||||
|
public class StrangerAccessRecordController { |
||||
|
|
||||
|
@Autowired |
||||
|
private StrangerAccessRecordService strangerAccessRecordService; |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 查询陌生人访问记录 |
||||
|
* @Author yangshaoping |
||||
|
* @date 2020.03.1811:33 |
||||
|
* */ |
||||
|
@GetMapping("getStrangerAccessRecordPage") |
||||
|
public Result<PageData<StrangerAccessRecordDTO>> getStrangerAccessRecordPage(@RequestParam Map<String, Object> params){ |
||||
|
PageData<StrangerAccessRecordDTO> page = strangerAccessRecordService.getStrangerAccessRecordPage(params); |
||||
|
return new Result<PageData<StrangerAccessRecordDTO>>().ok(page); |
||||
|
} |
||||
|
@GetMapping("page") |
||||
|
public Result<PageData<StrangerAccessRecordDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<StrangerAccessRecordDTO> page = strangerAccessRecordService.page(params); |
||||
|
return new Result<PageData<StrangerAccessRecordDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<StrangerAccessRecordDTO> get(@PathVariable("id") String id){ |
||||
|
StrangerAccessRecordDTO data = strangerAccessRecordService.get(id); |
||||
|
return new Result<StrangerAccessRecordDTO>().ok(data); |
||||
|
} |
||||
|
|
||||
|
@PostMapping |
||||
|
public Result save(@RequestBody StrangerAccessRecordDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class); |
||||
|
strangerAccessRecordService.save(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@PutMapping |
||||
|
public Result update(@RequestBody StrangerAccessRecordDTO dto){ |
||||
|
//效验数据
|
||||
|
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class); |
||||
|
strangerAccessRecordService.update(dto); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping |
||||
|
public Result delete(@RequestBody String[] ids){ |
||||
|
//效验数据
|
||||
|
AssertUtils.isArrayEmpty(ids, "id"); |
||||
|
strangerAccessRecordService.delete(ids); |
||||
|
return new Result(); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("export") |
||||
|
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<StrangerAccessRecordDTO> list = strangerAccessRecordService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, StrangerAccessRecordExcel.class); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,94 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.controller; |
||||
|
|
||||
|
import com.epmet.commons.tools.annotation.LoginUser; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.commons.tools.validator.ValidatorUtils; |
||||
|
import com.epmet.dto.form.CustomerGridListFormDTO; |
||||
|
import com.epmet.dto.form.StrangerFormDTO; |
||||
|
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; |
||||
|
import com.epmet.dto.result.HomeDesignByCustomerResultDTO; |
||||
|
import com.epmet.service.StrangerAccessRecordService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
import org.springframework.web.bind.annotation.RequestMapping; |
||||
|
import org.springframework.web.bind.annotation.RestController; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 居民端-陌生人导览 |
||||
|
* @author sun |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@RestController |
||||
|
@RequestMapping("stranger") |
||||
|
public class StrangerResiGuideController { |
||||
|
|
||||
|
@Autowired |
||||
|
private StrangerAccessRecordService strangerAccessRecordService; |
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @Author sun |
||||
|
* @Description 居民端-陌生人导览-网格链接获取客户首页配置 |
||||
|
* @Date 2020/3/16 |
||||
|
**/ |
||||
|
@PostMapping("getgridhome") |
||||
|
public Result<HomeDesignByCustomerResultDTO> getValidCustomerList( @LoginUser TokenDto tokenDTO, @RequestBody StrangerFormDTO formDTO) throws Exception { |
||||
|
return strangerAccessRecordService.getgridhome(tokenDTO, formDTO); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生访客根据自动定位获取附近网格数据 |
||||
|
* @Param CustomerGridListFormDTO |
||||
|
* @return Result<List<CustomerGridForStrangerResultDTO>> |
||||
|
* @Author wangc |
||||
|
* @Date 2020.03.19 14:13 |
||||
|
**/ |
||||
|
@PostMapping("getlocationcustomergridlist") |
||||
|
Result<List<CustomerGridForStrangerResultDTO>> getLocationCustomerGridList(@RequestBody CustomerGridListFormDTO customerGridListFormDTO){ |
||||
|
|
||||
|
ValidatorUtils.validateEntity(customerGridListFormDTO); |
||||
|
|
||||
|
return strangerAccessRecordService.listCustomerGrid(customerGridListFormDTO); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生访客手动选定位置获取附近网格数据 |
||||
|
* @Param CustomerGridListFormDTO |
||||
|
* @return Result<List<CustomerGridForStrangerResultDTO>> |
||||
|
* @Author wangc |
||||
|
* @Date 2020.03.19 14:13 |
||||
|
**/ |
||||
|
@PostMapping("getselectcdcustomergridlist") |
||||
|
Result<List<CustomerGridForStrangerResultDTO>> getSelectcdCustomerGridList(@RequestBody CustomerGridListFormDTO customerGridListFormDTO){ |
||||
|
|
||||
|
ValidatorUtils.validateEntity(customerGridListFormDTO); |
||||
|
|
||||
|
return strangerAccessRecordService.listCustomerGrid(customerGridListFormDTO); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,43 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.entity.StrangerAccessRecordEntity; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* 陌生人访问记录 |
||||
|
* |
||||
|
* @author generator generator@elink-cn.com |
||||
|
* @since v1.0.0 2020-03-16 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface StrangerAccessRecordDao extends BaseDao<StrangerAccessRecordEntity> { |
||||
|
/** |
||||
|
* 查询陌生人访问记录 |
||||
|
* @param params |
||||
|
* @author yangshaoping |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
List<StrangerAccessRecordEntity> getStrangerAccessRecordPage(Map<String, Object> params); |
||||
|
} |
||||
@ -0,0 +1,81 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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("stranger_access_record") |
||||
|
public class StrangerAccessRecordEntity extends BaseEpmetEntity { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 定位地区编码 (用户允许获取位置) |
||||
|
*/ |
||||
|
private String locationAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 选择地区编码 (用户选择地区位置 |
||||
|
*/ |
||||
|
private String selectedAreaCode; |
||||
|
|
||||
|
/** |
||||
|
* 是否首次位置授权(0:是 1:否) |
||||
|
*/ |
||||
|
private Integer isAuthorized; |
||||
|
|
||||
|
/** |
||||
|
* 网格数 根据位置查询到的附近网格数 |
||||
|
*/ |
||||
|
private Integer gridNumber; |
||||
|
|
||||
|
/** |
||||
|
* 访问时间 访问的当前时间 |
||||
|
*/ |
||||
|
private Date visitTime; |
||||
|
|
||||
|
/** |
||||
|
* 省份 |
||||
|
* */ |
||||
|
private String province; |
||||
|
|
||||
|
/** |
||||
|
* 城市 |
||||
|
* */ |
||||
|
private String city; |
||||
|
|
||||
|
/** |
||||
|
* 地区 |
||||
|
* */ |
||||
|
private String area; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,71 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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 StrangerAccessRecordExcel { |
||||
|
|
||||
|
@Excel(name = "唯一标识") |
||||
|
private String id; |
||||
|
|
||||
|
@Excel(name = "定位地区编码 (用户允许获取位置)") |
||||
|
private String locationAreaCode; |
||||
|
|
||||
|
@Excel(name = "选择地区编码 (用户选择地区位置") |
||||
|
private String lelectedAreaCode; |
||||
|
|
||||
|
@Excel(name = "是否首次位置授权(0:是 1:否)") |
||||
|
private Integer isAuthorized; |
||||
|
|
||||
|
@Excel(name = "网格数 根据位置查询到的附近网格数") |
||||
|
private Integer gridNumber; |
||||
|
|
||||
|
@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; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,28 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.VisitedFormDTO; |
||||
|
import com.epmet.feign.fallback.EpmetUserFeignClientFallBack; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
|
||||
|
/** |
||||
|
* @Description 居民端陌生人导览 调用epmet-user服务 |
||||
|
* @Author sun |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.EPMET_USER_SERVER, fallback = EpmetUserFeignClientFallBack.class) |
||||
|
public interface EpmetUserFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* 保存或更新网格访问记录表和最近访问网格表数据 |
||||
|
* @param |
||||
|
* @Description |
||||
|
**/ |
||||
|
@PostMapping("/epmetuser/gridvisited/savelatestandvisited") |
||||
|
Result saveLatestAndVisited(VisitedFormDTO formDTO); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,39 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.ListCustomerGridFormDTO; |
||||
|
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; |
||||
|
import com.epmet.feign.fallback.GovOrgFeignFallBack; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
import org.springframework.web.bind.annotation.RequestBody; |
||||
|
|
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description Feign调用gov-org-server模块下的CustomerGirdController |
||||
|
* @ClassName GovOrgFeginFallBack |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.17 14:29 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignFallBack.class) |
||||
|
public interface GovOrgFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* 根据地区编码获取附近网格数据 |
||||
|
* @Param areaCode 地区编码 |
||||
|
* @Param pageNo 当前页 |
||||
|
* @Param pageSize 每页数据量 |
||||
|
* */ |
||||
|
@PostMapping("/gov/org/customergrid/queryListForStrangerByOrder") |
||||
|
Result<List<CustomerGridForStrangerResultDTO>> getPageForStrangerGuideInterface(@RequestBody ListCustomerGridFormDTO listCustomerGridFormDTO); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.CustomerHomeFormDTO; |
||||
|
import com.epmet.dto.result.HomeDesignByCustomerResultDTO; |
||||
|
import com.epmet.feign.fallback.OperCustomizeFeignClientFallBack; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
|
||||
|
/** |
||||
|
* @Description 居民端陌生人导览 调用oper_customize服务 |
||||
|
* @Author sun |
||||
|
* @Date 2020/3/16 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.OPER_CUSTOMIZE_SERVER, fallback = OperCustomizeFeignClientFallBack.class) |
||||
|
public interface OperCustomizeFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @Description 根据客户Id查询客户用户表数据 |
||||
|
* @Date 2020/3/17 |
||||
|
**/ |
||||
|
@PostMapping("/oper/customize/home/gethomereleasebycustomer") |
||||
|
Result<HomeDesignByCustomerResultDTO> getHomeReleaseByCustomer(CustomerHomeFormDTO formDTO); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,24 @@ |
|||||
|
package com.epmet.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.ModuleUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.VisitedFormDTO; |
||||
|
import com.epmet.feign.EpmetUserFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Description 居民端-陌生人导览 调用epmet-user服务 |
||||
|
* @Author sun |
||||
|
* @Date 2020/3/16 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class EpmetUserFeignClientFallBack implements EpmetUserFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result saveLatestAndVisited(VisitedFormDTO formDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.EPMET_USER_SERVER, "saveLatestAndVisited",formDTO); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,32 @@ |
|||||
|
package com.epmet.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.ModuleUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.ListCustomerGridFormDTO; |
||||
|
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; |
||||
|
import com.epmet.feign.GovOrgFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* @Description Feign |
||||
|
* @ClassName GovOrgFeginFallBack |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.17 14:29 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class GovOrgFeignFallBack implements GovOrgFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* 根据地区编码获取附近网格数据 |
||||
|
* @Param ListCustomerGridFormDTO 包含:地区编码、页码、每页数据量 |
||||
|
* @return Result<List<CustomerGridForStrangerResultDTO>> |
||||
|
* */ |
||||
|
@Override |
||||
|
public Result<List<CustomerGridForStrangerResultDTO>> getPageForStrangerGuideInterface(ListCustomerGridFormDTO listCustomerGridFormDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "queryListForStrangerByOrder",listCustomerGridFormDTO); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.epmet.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.ModuleUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.form.CustomerHomeFormDTO; |
||||
|
import com.epmet.dto.result.HomeDesignByCustomerResultDTO; |
||||
|
import com.epmet.feign.OperCustomizeFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Description 居民端-陌生人导览 调用oper-customize服务 |
||||
|
* @Author sun |
||||
|
* @Date 2020/3/16 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class OperCustomizeFeignClientFallBack implements OperCustomizeFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result<HomeDesignByCustomerResultDTO> getHomeReleaseByCustomer(CustomerHomeFormDTO formDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.OPER_CUSTOMIZE_SERVER, "getHomeReleaseByCustomer",formDTO); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,110 @@ |
|||||
|
package com.epmet.service; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.BaseService; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.StrangerAccessRecordDTO; |
||||
|
import com.epmet.dto.form.CustomerGridListFormDTO; |
||||
|
import com.epmet.dto.form.StrangerFormDTO; |
||||
|
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; |
||||
|
import com.epmet.dto.result.HomeDesignByCustomerResultDTO; |
||||
|
import com.epmet.entity.StrangerAccessRecordEntity; |
||||
|
|
||||
|
import java.util.List; |
||||
|
import java.util.Map; |
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生人记录访问表 |
||||
|
* @InterfaceName ResiGuideServiceImpl |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.17 13:01 |
||||
|
*/ |
||||
|
|
||||
|
public interface StrangerAccessRecordService extends BaseService<StrangerAccessRecordEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 查询陌生人访问记录 |
||||
|
* @param params |
||||
|
* @return PageData<StrangerAccessRecordDTO> |
||||
|
* @author yangshaoping |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
PageData<StrangerAccessRecordDTO> getStrangerAccessRecordPage(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<StrangerAccessRecordDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
PageData<StrangerAccessRecordDTO> page(Map<String, Object> params); |
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<StrangerAccessRecordDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
List<StrangerAccessRecordDTO> list(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 单条查询 |
||||
|
* |
||||
|
* @param id |
||||
|
* @return StrangerAccessRecordDTO |
||||
|
* @author generator |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
StrangerAccessRecordDTO get(String id); |
||||
|
|
||||
|
/** |
||||
|
* 默认保存 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
void save(StrangerAccessRecordDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 默认更新 |
||||
|
* |
||||
|
* @param dto |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
void update(StrangerAccessRecordDTO dto); |
||||
|
|
||||
|
/** |
||||
|
* 批量删除 |
||||
|
* |
||||
|
* @param ids |
||||
|
* @return void |
||||
|
* @author generator |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
void delete(String[] ids); |
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生人根据地区编码查询附近网格数据接口定义 |
||||
|
* @Param CustomerGridListFormDTO |
||||
|
* @return Result<List<CustomerGridForStrangerResultDTO>> |
||||
|
* @Author wangc |
||||
|
* @Date 2020.03.19 14:28 |
||||
|
**/ |
||||
|
Result<List<CustomerGridForStrangerResultDTO>> listCustomerGrid(CustomerGridListFormDTO customerGridListFormDTO); |
||||
|
|
||||
|
/** |
||||
|
* 居民端-网格链接获取客户首页配置 |
||||
|
* @param |
||||
|
* @return void |
||||
|
* @author sun |
||||
|
*/ |
||||
|
Result<HomeDesignByCustomerResultDTO> getgridhome(TokenDto tokenDTO, StrangerFormDTO formDTO); |
||||
|
} |
||||
@ -0,0 +1,211 @@ |
|||||
|
package com.epmet.service.impl; |
||||
|
|
||||
|
|
||||
|
import com.epmet.commons.mybatis.service.impl.BaseServiceImpl; |
||||
|
import com.epmet.commons.tools.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.security.dto.TokenDto; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dao.StrangerAccessRecordDao; |
||||
|
import com.epmet.dto.StrangerAccessRecordDTO; |
||||
|
import com.epmet.dto.form.*; |
||||
|
import com.epmet.dto.result.CustomerGridForStrangerResultDTO; |
||||
|
import com.epmet.dto.result.HomeDesignByCustomerResultDTO; |
||||
|
import com.epmet.entity.StrangerAccessRecordEntity; |
||||
|
import com.epmet.feign.EpmetUserFeignClient; |
||||
|
import com.epmet.feign.GovOrgFeignClient; |
||||
|
import com.epmet.feign.OperCustomizeFeignClient; |
||||
|
import com.epmet.service.StrangerAccessRecordService; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.Date; |
||||
|
import java.util.List; |
||||
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
||||
|
import com.baomidou.mybatisplus.core.metadata.IPage; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import org.apache.commons.lang3.StringUtils; |
||||
|
import org.springframework.transaction.annotation.Transactional; |
||||
|
|
||||
|
import java.util.Map; |
||||
|
/** |
||||
|
* @Description 陌生人记录访问表 |
||||
|
* @ClassName ResiGuideServiceImpl |
||||
|
* @Author wangc |
||||
|
* @date 2020.03.17 13:01 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class StrangerAccessRecordServiceImpl extends BaseServiceImpl<StrangerAccessRecordDao, StrangerAccessRecordEntity> implements StrangerAccessRecordService { |
||||
|
@Autowired |
||||
|
private StrangerAccessRecordDao strangerAccessRecordDao; |
||||
|
@Autowired |
||||
|
private GovOrgFeignClient govOrgFeignClient; |
||||
|
@Autowired |
||||
|
private EpmetUserFeignClient epmetUserFeignClient; |
||||
|
@Autowired |
||||
|
private OperCustomizeFeignClient operCustomizeFeignClient; |
||||
|
/** |
||||
|
* 查询陌生人访问记录 |
||||
|
* @param params |
||||
|
* @return PageData<StrangerAccessRecordDTO> |
||||
|
* @author yangshaoping |
||||
|
* @date 2020-03-19 |
||||
|
*/ |
||||
|
@Override |
||||
|
public PageData<StrangerAccessRecordDTO> getStrangerAccessRecordPage(Map<String, Object> params) { |
||||
|
List<StrangerAccessRecordEntity> list = strangerAccessRecordDao.getStrangerAccessRecordPage(params); |
||||
|
return getPageData(list,list.size(), StrangerAccessRecordDTO.class); |
||||
|
} |
||||
|
@Override |
||||
|
public PageData<StrangerAccessRecordDTO> page(Map<String, Object> params) { |
||||
|
IPage<StrangerAccessRecordEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, StrangerAccessRecordDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<StrangerAccessRecordDTO> list(Map<String, Object> params) { |
||||
|
List<StrangerAccessRecordEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, StrangerAccessRecordDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<StrangerAccessRecordEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<StrangerAccessRecordEntity> wrapper = new QueryWrapper<>(); |
||||
|
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id); |
||||
|
|
||||
|
return wrapper; |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public StrangerAccessRecordDTO get(String id) { |
||||
|
StrangerAccessRecordEntity entity = baseDao.selectById(id); |
||||
|
return ConvertUtils.sourceToTarget(entity, StrangerAccessRecordDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void save(StrangerAccessRecordDTO dto) { |
||||
|
StrangerAccessRecordEntity entity = ConvertUtils.sourceToTarget(dto, StrangerAccessRecordEntity.class); |
||||
|
insert(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void update(StrangerAccessRecordDTO dto) { |
||||
|
StrangerAccessRecordEntity entity = ConvertUtils.sourceToTarget(dto, StrangerAccessRecordEntity.class); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void delete(String[] ids) { |
||||
|
// 逻辑删除(@TableLogic 注解)
|
||||
|
baseDao.deleteBatchIds(Arrays.asList(ids)); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @Description 陌生人根据地区编码查询附近网格数据具体实现 |
||||
|
* @Param CustomerGridListFormDTO |
||||
|
* @return Result<List<CustomerGridForStrangerResultDTO>> |
||||
|
* @Author wangc |
||||
|
* @Date 2020.03.19 14:28 |
||||
|
**/ |
||||
|
|
||||
|
@Override |
||||
|
public Result<List<CustomerGridForStrangerResultDTO>> listCustomerGrid(CustomerGridListFormDTO customerGridListFormDTO) { |
||||
|
|
||||
|
|
||||
|
ListCustomerGridFormDTO listCustomerGridFormDTO = new ListCustomerGridFormDTO(); |
||||
|
listCustomerGridFormDTO.setAreaCode(0 == customerGridListFormDTO.getIsAuthorized() ? |
||||
|
customerGridListFormDTO.getSelectedAreaCode() : customerGridListFormDTO.getAreaCode()); |
||||
|
|
||||
|
listCustomerGridFormDTO.setPageNo(null == customerGridListFormDTO.getPageNo() ? 1 : customerGridListFormDTO.getPageNo()); |
||||
|
|
||||
|
listCustomerGridFormDTO.setPageSize(customerGridListFormDTO.getPageSize()); |
||||
|
|
||||
|
|
||||
|
Result<List<CustomerGridForStrangerResultDTO>> queryResult = |
||||
|
govOrgFeignClient |
||||
|
.getPageForStrangerGuideInterface(listCustomerGridFormDTO); |
||||
|
|
||||
|
//Feign调用成功
|
||||
|
if(queryResult.success()) { |
||||
|
|
||||
|
List<CustomerGridForStrangerResultDTO> queryList = queryResult.getData(); |
||||
|
if (null != queryResult && queryList.size() > 0) { |
||||
|
StrangerAccessRecordEntity strangerTrance = new StrangerAccessRecordEntity(); |
||||
|
//未授权,手动选择
|
||||
|
if (0 == customerGridListFormDTO.getIsAuthorized()) { |
||||
|
strangerTrance.setSelectedAreaCode(customerGridListFormDTO.getSelectedAreaCode()); |
||||
|
strangerTrance.setLocationAreaCode(""); |
||||
|
} else if (1 == customerGridListFormDTO.getIsAuthorized()) { |
||||
|
//已授权,自动选择
|
||||
|
strangerTrance.setLocationAreaCode(customerGridListFormDTO.getAreaCode()); |
||||
|
strangerTrance.setSelectedAreaCode(""); |
||||
|
} |
||||
|
strangerTrance.setIsAuthorized(customerGridListFormDTO.getIsAuthorized()); |
||||
|
strangerTrance.setGridNumber(queryList.size()); |
||||
|
strangerTrance.setVisitTime(new Date()); |
||||
|
strangerTrance.setProvince(customerGridListFormDTO.getProvince()); |
||||
|
strangerTrance.setCity(customerGridListFormDTO.getCity()); |
||||
|
strangerTrance.setArea(customerGridListFormDTO.getArea()); |
||||
|
insert(strangerTrance); |
||||
|
|
||||
|
return new Result<List<CustomerGridForStrangerResultDTO>>().ok(queryList); |
||||
|
} else { |
||||
|
//没有查询出结果
|
||||
|
return new Result<List<CustomerGridForStrangerResultDTO>>().ok(new ArrayList<>()); |
||||
|
} |
||||
|
}else{ |
||||
|
//Feign调用失败
|
||||
|
return new Result<List<CustomerGridForStrangerResultDTO>>().error(queryResult.getCode(),queryResult.getMsg()); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 居民端-网格链接获取客户首页配置 |
||||
|
* @return void |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Override |
||||
|
public Result<HomeDesignByCustomerResultDTO> getgridhome(TokenDto tokenDTO, StrangerFormDTO formDTO) { |
||||
|
//token里边有所属端 userId这些参数 前台传递customerID和gridId
|
||||
|
//1:调用epmet-user服务查询数据 新建网格记录数据
|
||||
|
VisitedFormDTO vi = new VisitedFormDTO(); |
||||
|
vi.setGridId(formDTO.getGridId()); |
||||
|
vi.setCustomerId(formDTO.getCustomerId()); |
||||
|
vi.setUserId(tokenDTO.getUserId());//token中获取userId
|
||||
|
epmetUserFeignClient.saveLatestAndVisited(vi); |
||||
|
|
||||
|
//2:调用ope-customize服务 获取首页发布数据
|
||||
|
Result<HomeDesignByCustomerResultDTO> res = getCustomerHomeData(formDTO.getCustomerId(),tokenDTO.getClient()); |
||||
|
return res; |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 调用oper-customize服务 获取首页发布数据 |
||||
|
* @param customerId 客户Id |
||||
|
* @param clientType 所属端 |
||||
|
* @return |
||||
|
* @author sun |
||||
|
*/ |
||||
|
public Result<HomeDesignByCustomerResultDTO> getCustomerHomeData(String customerId,String clientType){ |
||||
|
CustomerHomeFormDTO dto = new CustomerHomeFormDTO(); |
||||
|
dto.setCustomerId(customerId); |
||||
|
dto.setClientType(clientType);//居民端
|
||||
|
return operCustomizeFeignClient.getHomeReleaseByCustomer(dto); |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,159 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<configuration> |
||||
|
<include resource="org/springframework/boot/logging/logback/base.xml"/> |
||||
|
|
||||
|
<property name="log.path" value="logs/resi-guide"/> |
||||
|
|
||||
|
<!-- 彩色日志格式 --> |
||||
|
<property name="CONSOLE_LOG_PATTERN" |
||||
|
value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/> |
||||
|
|
||||
|
<!--1. 输出到控制台--> |
||||
|
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender"> |
||||
|
<!--此日志appender是为开发使用,只配置最底级别,控制台输出的日志级别是大于或等于此级别的日志信息--> |
||||
|
<filter class="ch.qos.logback.classic.filter.ThresholdFilter"> |
||||
|
<level>debug</level> |
||||
|
</filter> |
||||
|
<encoder> |
||||
|
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern> |
||||
|
<!-- 设置字符集 --> |
||||
|
<charset>UTF-8</charset> |
||||
|
</encoder> |
||||
|
</appender> |
||||
|
|
||||
|
<!--2. 输出到文档--> |
||||
|
<!-- 2.1 level为 DEBUG 日志,时间滚动输出 --> |
||||
|
<appender name="DEBUG_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文档的路径及文档名 --> |
||||
|
<file>${log.path}/debug.log</file> |
||||
|
<!--日志文档输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 日志归档 --> |
||||
|
<fileNamePattern>${log.path}/debug-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文档保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文档只记录debug级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>debug</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 2.2 level为 INFO 日志,时间滚动输出 --> |
||||
|
<appender name="INFO_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文档的路径及文档名 --> |
||||
|
<file>${log.path}/info.log</file> |
||||
|
<!--日志文档输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<!-- 每天日志归档路径以及格式 --> |
||||
|
<fileNamePattern>${log.path}/info-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文档保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文档只记录info级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>info</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 2.3 level为 WARN 日志,时间滚动输出 --> |
||||
|
<appender name="WARN_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文档的路径及文档名 --> |
||||
|
<file>${log.path}/warn.log</file> |
||||
|
<!--日志文档输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<fileNamePattern>${log.path}/warn-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文档保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文档只记录warn级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>warn</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 2.4 level为 ERROR 日志,时间滚动输出 --> |
||||
|
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender"> |
||||
|
<!-- 正在记录的日志文档的路径及文档名 --> |
||||
|
<file>${log.path}/error.log</file> |
||||
|
<!--日志文档输出格式--> |
||||
|
<encoder> |
||||
|
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50} - %msg%n</pattern> |
||||
|
<charset>UTF-8</charset> <!-- 此处设置字符集 --> |
||||
|
</encoder> |
||||
|
<!-- 日志记录器的滚动策略,按日期,按大小记录 --> |
||||
|
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy"> |
||||
|
<fileNamePattern>${log.path}/error-%d{yyyy-MM-dd}.%i.log</fileNamePattern> |
||||
|
<timeBasedFileNamingAndTriggeringPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedFNATP"> |
||||
|
<maxFileSize>100MB</maxFileSize> |
||||
|
</timeBasedFileNamingAndTriggeringPolicy> |
||||
|
<!--日志文档保留天数--> |
||||
|
<maxHistory>15</maxHistory> |
||||
|
</rollingPolicy> |
||||
|
<!-- 此日志文档只记录ERROR级别的 --> |
||||
|
<filter class="ch.qos.logback.classic.filter.LevelFilter"> |
||||
|
<level>ERROR</level> |
||||
|
<onMatch>ACCEPT</onMatch> |
||||
|
<onMismatch>DENY</onMismatch> |
||||
|
</filter> |
||||
|
</appender> |
||||
|
|
||||
|
<!-- 开发、测试环境 --> |
||||
|
<springProfile name="dev,test"> |
||||
|
<logger name="org.springframework.web" level="INFO"/> |
||||
|
<logger name="org.springboot.sample" level="INFO"/> |
||||
|
<logger name="com.epmet.dao" level="INFO"/> |
||||
|
<logger name="com.epmet.dao" level="DEBUG"/> |
||||
|
<root level="INFO"> |
||||
|
<appender-ref ref="DEBUG_FILE"/> |
||||
|
<appender-ref ref="INFO_FILE"/> |
||||
|
<appender-ref ref="WARN_FILE"/> |
||||
|
<appender-ref ref="ERROR_FILE"/> |
||||
|
</root> |
||||
|
</springProfile> |
||||
|
|
||||
|
<!-- 生产环境 --> |
||||
|
<springProfile name="prod"> |
||||
|
<logger name="org.springframework.web" level="INFO"/> |
||||
|
<logger name="org.springboot.sample" level="INFO"/> |
||||
|
<logger name="com.epmet.dao" level="INFO"/> |
||||
|
<root level="INFO"> |
||||
|
<appender-ref ref="CONSOLE"/> |
||||
|
<appender-ref ref="DEBUG_FILE"/> |
||||
|
<appender-ref ref="INFO_FILE"/> |
||||
|
<appender-ref ref="WARN_FILE"/> |
||||
|
<appender-ref ref="ERROR_FILE"/> |
||||
|
</root> |
||||
|
</springProfile> |
||||
|
|
||||
|
</configuration> |
||||
@ -0,0 +1,43 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.dao.StrangerAccessRecordDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.StrangerAccessRecordEntity" id="strangerAccessRecordMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="locationAreaCode" column="LOCATION_AREA_CODE"/> |
||||
|
<result property="selectedAreaCode" column="SELECTED_AREA_CODE"/> |
||||
|
<result property="isAuthorized" column="IS_AUTHORIZED"/> |
||||
|
<result property="gridNumber" column="GRID_NUMBER"/> |
||||
|
<result property="visitTime" column="VISIT_TIME"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
<result property="province" column="PROVINCE" /> |
||||
|
<result property="city" column="CITY" /> |
||||
|
<result property="area" column="AREA" /> |
||||
|
</resultMap> |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
<!-- 查询陌生人访问记录--> |
||||
|
<select id="getStrangerAccessRecordPage" resultMap="strangerAccessRecordMap"> |
||||
|
SELECT |
||||
|
a.LOCATION_AREA_CODE, |
||||
|
a.PROVINCE, |
||||
|
a.CITY, |
||||
|
a.AREA, |
||||
|
a.IS_AUTHORIZED, |
||||
|
a.VISIT_TIME |
||||
|
FROM |
||||
|
stranger_access_record AS a |
||||
|
where a.DEL_FLAG=0 and date_sub(curdate(), interval 3 day) <= a.VISIT_TIME |
||||
|
ORDER BY a.VISIT_TIME desc |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,101 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,96 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
/** |
||||
|
* 访问时间 一个用户一天访问一个网格只有一条记录 |
||||
|
*/ |
||||
|
private Date visitTime; |
||||
|
|
||||
|
/** |
||||
|
* 删除标识:0.未删除 1.已删除 |
||||
|
*/ |
||||
|
private Integer delFlag; |
||||
|
|
||||
|
/** |
||||
|
* 乐观锁 |
||||
|
*/ |
||||
|
private Integer revision; |
||||
|
|
||||
|
/** |
||||
|
* 创建人 |
||||
|
*/ |
||||
|
private String createdBy; |
||||
|
|
||||
|
/** |
||||
|
* 创建时间 |
||||
|
*/ |
||||
|
private Date createdTime; |
||||
|
|
||||
|
/** |
||||
|
* 更新人 |
||||
|
*/ |
||||
|
private String updatedBy; |
||||
|
|
||||
|
/** |
||||
|
* 更新时间 |
||||
|
*/ |
||||
|
private Date updatedTime; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dto.form; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
import javax.validation.constraints.NotBlank; |
||||
|
import java.io.Serializable; |
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 居民端-网格链接获取客户首页配置 |
||||
|
* @author sun |
||||
|
*/ |
||||
|
@Data |
||||
|
public class VisitedFormDTO implements Serializable { |
||||
|
|
||||
|
private static final long serialVersionUID = 1L; |
||||
|
|
||||
|
/** |
||||
|
* 网格Id |
||||
|
*/ |
||||
|
@NotBlank(message = "网格ID不能为空") |
||||
|
private String gridId; |
||||
|
/** |
||||
|
* 客户Id CUSTOMER.id |
||||
|
*/ |
||||
|
@NotBlank(message = "客户ID不能为空") |
||||
|
private String customerId; |
||||
|
/** |
||||
|
* 用户Id |
||||
|
*/ |
||||
|
@NotBlank(message = "用户ID不能为空") |
||||
|
private String userId; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,106 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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.DefaultGroup; |
||||
|
import com.epmet.commons.tools.validator.group.UpdateGroup; |
||||
|
import com.epmet.dto.GridVisitedDTO; |
||||
|
import com.epmet.dto.form.VisitedFormDTO; |
||||
|
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<PageData<GridVisitedDTO>> page(@RequestParam Map<String, Object> params){ |
||||
|
PageData<GridVisitedDTO> page = gridVisitedService.page(params); |
||||
|
return new Result<PageData<GridVisitedDTO>>().ok(page); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("{id}") |
||||
|
public Result<GridVisitedDTO> get(@PathVariable("id") String id){ |
||||
|
GridVisitedDTO data = gridVisitedService.get(id); |
||||
|
return new Result<GridVisitedDTO>().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<String, Object> params, HttpServletResponse response) throws Exception { |
||||
|
List<GridVisitedDTO> list = gridVisitedService.list(params); |
||||
|
ExcelUtils.exportExcelToTarget(response, null, list, GridVisitedExcel.class); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 网格访问记录表、最近访问网格表新增数据 |
||||
|
* 网格访问记录表新增数据(一天一条) |
||||
|
* 最近访问表更新访问时间字段 |
||||
|
* @param formDTO |
||||
|
*/ |
||||
|
@PostMapping("savelatestandvisited") |
||||
|
public void saveLatestAndVisited(@RequestBody VisitedFormDTO formDTO) throws Exception { |
||||
|
gridVisitedService.saveLatestAndVisited(formDTO); |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,37 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
package com.epmet.dao; |
||||
|
|
||||
|
import com.epmet.commons.mybatis.dao.BaseDao; |
||||
|
import com.epmet.dto.GridLatestDTO; |
||||
|
import com.epmet.dto.GridVisitedDTO; |
||||
|
import com.epmet.entity.GridLatestEntity; |
||||
|
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<GridVisitedEntity> { |
||||
|
|
||||
|
GridVisitedDTO getGridVisitedByIds(GridVisitedDTO formDTO); |
||||
|
} |
||||
@ -0,0 +1,71 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,74 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,71 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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 = "访问时间 一个用户一天访问一个网格只有一条记录") |
||||
|
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; |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,27 @@ |
|||||
|
package com.epmet.feign; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.CustomerGridDTO; |
||||
|
import com.epmet.dto.form.CustomerGridFormDTO; |
||||
|
import com.epmet.feign.fallback.GovOrgFeignClientFallBack; |
||||
|
import org.springframework.cloud.openfeign.FeignClient; |
||||
|
import org.springframework.web.bind.annotation.PostMapping; |
||||
|
|
||||
|
/** |
||||
|
* @Description 居民端陌生人导览 调用gov-org服务 |
||||
|
* @Author sun |
||||
|
* @Date 2020/3/16 |
||||
|
*/ |
||||
|
@FeignClient(name = ServiceConstant.GOV_ORG_SERVER, fallback = GovOrgFeignClientFallBack.class) |
||||
|
public interface GovOrgFeignClient { |
||||
|
|
||||
|
/** |
||||
|
* @param |
||||
|
* @Description 根据客户Id查询客户用户表数据 |
||||
|
* @Date 2020/3/17 |
||||
|
**/ |
||||
|
@PostMapping("/gov/org/customergrid/getcustomergridbygridid") |
||||
|
Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO); |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,23 @@ |
|||||
|
package com.epmet.feign.fallback; |
||||
|
|
||||
|
import com.epmet.commons.tools.constant.ServiceConstant; |
||||
|
import com.epmet.commons.tools.utils.ModuleUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dto.CustomerGridDTO; |
||||
|
import com.epmet.dto.form.CustomerGridFormDTO; |
||||
|
import com.epmet.feign.GovOrgFeignClient; |
||||
|
import org.springframework.stereotype.Component; |
||||
|
|
||||
|
/** |
||||
|
* @Description 居民端-陌生人导览 调用gov-org服务 |
||||
|
* @Author sun |
||||
|
* @Date 2020/3/16 |
||||
|
*/ |
||||
|
@Component |
||||
|
public class GovOrgFeignClientFallBack implements GovOrgFeignClient { |
||||
|
|
||||
|
@Override |
||||
|
public Result<CustomerGridDTO> getCustomerGridByGridId(CustomerGridFormDTO formDTO) { |
||||
|
return ModuleUtils.feignConError(ServiceConstant.GOV_ORG_SERVER, "getCustomerGridByGridId",formDTO); |
||||
|
} |
||||
|
} |
||||
@ -0,0 +1,47 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,117 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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.dto.GridVisitedDTO; |
||||
|
import com.epmet.dto.form.VisitedFormDTO; |
||||
|
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<GridVisitedEntity> { |
||||
|
|
||||
|
/** |
||||
|
* 默认分页 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return PageData<GridVisitedDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-03-16 |
||||
|
*/ |
||||
|
PageData<GridVisitedDTO> page(Map<String, Object> params); |
||||
|
|
||||
|
/** |
||||
|
* 默认查询 |
||||
|
* |
||||
|
* @param params |
||||
|
* @return java.util.List<GridVisitedDTO> |
||||
|
* @author generator |
||||
|
* @date 2020-03-16 |
||||
|
*/ |
||||
|
List<GridVisitedDTO> list(Map<String, Object> 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); |
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* 网格访问记录表新增数据 |
||||
|
* @param formDTO |
||||
|
*/ |
||||
|
//void saveGridVisited(GridVisitedDTO formDTO);
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
|
||||
|
/** |
||||
|
* @param formDTO |
||||
|
*/ |
||||
|
void saveLatestAndVisited(VisitedFormDTO formDTO) throws Exception; |
||||
|
} |
||||
@ -0,0 +1,136 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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.CustomerGridDTO; |
||||
|
import com.epmet.dto.GridLatestDTO; |
||||
|
import com.epmet.dto.form.VisitedFormDTO; |
||||
|
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.Date; |
||||
|
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<GridLatestDao, GridLatestEntity> implements GridLatestService { |
||||
|
|
||||
|
@Autowired |
||||
|
private GridLatestRedis gridLatestRedis; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<GridLatestDTO> page(Map<String, Object> params) { |
||||
|
IPage<GridLatestEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, GridLatestDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<GridLatestDTO> list(Map<String, Object> params) { |
||||
|
List<GridLatestEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, GridLatestDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<GridLatestEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<GridLatestEntity> 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)); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void saveGridLatest(VisitedFormDTO formDTO, CustomerGridDTO cu) { |
||||
|
Date date = new Date(); |
||||
|
GridLatestDTO la = new GridLatestDTO(); |
||||
|
la.setCustomerId(cu.getCustomerId()); |
||||
|
la.setGridId(cu.getId()); |
||||
|
//la.setCustomerUserId(formDTO.getUserId());//token传递的值
|
||||
|
la.setCustomerUserId("1111111111");//token传递的值
|
||||
|
la.setAreaCode(cu.getAreaCode()); |
||||
|
la.setPid(cu.getPid()); |
||||
|
la.setLatestTime(date); |
||||
|
la.setUpdatedTime(date); |
||||
|
//查询是否存在历史数据(一个用户对一个网格的访问只记录一条数据)
|
||||
|
GridLatestEntity dto = baseDao.getGridLatestByIds(la); |
||||
|
GridLatestEntity entity = null; |
||||
|
if(dto==null||dto.getId()==null){ |
||||
|
entity = ConvertUtils.sourceToTarget(la, GridLatestEntity.class); |
||||
|
insert(entity); |
||||
|
}else{ |
||||
|
entity = ConvertUtils.sourceToTarget(dto, GridLatestEntity.class); |
||||
|
entity.setLatestTime(date);//最近访问时间
|
||||
|
entity.setUpdatedTime(date); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
|
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
||||
@ -0,0 +1,174 @@ |
|||||
|
/** |
||||
|
* Copyright 2018 人人开源 https://www.renren.io
|
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* 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. |
||||
|
* <p> |
||||
|
* You should have received a copy of the GNU General Public License |
||||
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
*/ |
||||
|
|
||||
|
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.constant.FieldConstant; |
||||
|
import com.epmet.commons.tools.page.PageData; |
||||
|
import com.epmet.commons.tools.utils.ConvertUtils; |
||||
|
import com.epmet.commons.tools.utils.Result; |
||||
|
import com.epmet.dao.GridVisitedDao; |
||||
|
import com.epmet.dto.CustomerGridDTO; |
||||
|
import com.epmet.dto.GridVisitedDTO; |
||||
|
import com.epmet.dto.form.CustomerGridFormDTO; |
||||
|
import com.epmet.dto.form.VisitedFormDTO; |
||||
|
import com.epmet.entity.GridVisitedEntity; |
||||
|
import com.epmet.feign.GovOrgFeignClient; |
||||
|
import com.epmet.service.GridLatestService; |
||||
|
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.Date; |
||||
|
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<GridVisitedDao, GridVisitedEntity> implements GridVisitedService { |
||||
|
|
||||
|
@Autowired |
||||
|
private GovOrgFeignClient govOrgFeignClient; |
||||
|
@Autowired |
||||
|
private GridLatestService gridLatestService; |
||||
|
|
||||
|
@Override |
||||
|
public PageData<GridVisitedDTO> page(Map<String, Object> params) { |
||||
|
IPage<GridVisitedEntity> page = baseDao.selectPage( |
||||
|
getPage(params, FieldConstant.CREATED_TIME, false), |
||||
|
getWrapper(params) |
||||
|
); |
||||
|
return getPageData(page, GridVisitedDTO.class); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<GridVisitedDTO> list(Map<String, Object> params) { |
||||
|
List<GridVisitedEntity> entityList = baseDao.selectList(getWrapper(params)); |
||||
|
|
||||
|
return ConvertUtils.sourceToTarget(entityList, GridVisitedDTO.class); |
||||
|
} |
||||
|
|
||||
|
private QueryWrapper<GridVisitedEntity> getWrapper(Map<String, Object> params){ |
||||
|
String id = (String)params.get(FieldConstant.ID_HUMP); |
||||
|
|
||||
|
QueryWrapper<GridVisitedEntity> 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)); |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 网格记录表新增数据 |
||||
|
* @author sun |
||||
|
* @param formDTO |
||||
|
* @throws Exception |
||||
|
*/ |
||||
|
@Override |
||||
|
@Transactional(rollbackFor = Exception.class) |
||||
|
public void saveLatestAndVisited(VisitedFormDTO formDTO) throws Exception { |
||||
|
//1:调用gov-org服务 查询客户网格表数据
|
||||
|
CustomerGridFormDTO dto = new CustomerGridFormDTO(); |
||||
|
dto.setGridId(formDTO.getGridId()); |
||||
|
Result<CustomerGridDTO> result = govOrgFeignClient.getCustomerGridByGridId(dto); |
||||
|
if(!result.success()){ |
||||
|
throw new Exception("查询客户网格表数据失败!"); |
||||
|
} |
||||
|
CustomerGridDTO cu = result.getData(); |
||||
|
|
||||
|
//2:网格访问记录表新增数据
|
||||
|
saveGridVisited(formDTO,cu); |
||||
|
|
||||
|
//3:最近访问网格表新增数据
|
||||
|
gridLatestService.saveGridLatest(formDTO,cu); |
||||
|
|
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 网格记录表和最近访问网格表新增数据 |
||||
|
* @param formDTO |
||||
|
* @param cu |
||||
|
*/ |
||||
|
public void saveGridVisited(VisitedFormDTO formDTO,CustomerGridDTO cu) { |
||||
|
Date date = new Date(); |
||||
|
GridVisitedDTO vi = new GridVisitedDTO(); |
||||
|
vi.setIsRegister(getRegister("0"));//后续再其他服务中获取这个状态值
|
||||
|
vi.setCustomerId(cu.getCustomerId()); |
||||
|
vi.setGridId(cu.getId()); |
||||
|
vi.setCustomerUserId(formDTO.getUserId()); |
||||
|
vi.setVisitTime(date); |
||||
|
vi.setUpdatedTime(date); |
||||
|
//查询是否存在历史数据( 一个用户一天对一个网格只存在一条访问记录)
|
||||
|
GridVisitedDTO dto = baseDao.getGridVisitedByIds(vi); |
||||
|
GridVisitedEntity entity = null; |
||||
|
if(dto==null||dto.getId()==null){ |
||||
|
entity = ConvertUtils.sourceToTarget(vi, GridVisitedEntity.class); |
||||
|
insert(entity); |
||||
|
}else{ |
||||
|
entity = ConvertUtils.sourceToTarget(dto, GridVisitedEntity.class); |
||||
|
entity.setUpdatedTime(date); |
||||
|
updateById(entity); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* (预留方法)查询是否注册状态值 |
||||
|
* @param str |
||||
|
* @return |
||||
|
*/ |
||||
|
public Integer getRegister(String str){ |
||||
|
return 0; |
||||
|
} |
||||
|
|
||||
|
} |
||||
@ -0,0 +1,52 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.dao.GridLatestDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.GridLatestEntity" id="gridLatestMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID"/> |
||||
|
<result property="gridId" column="GRID_ID"/> |
||||
|
<result property="customerUserId" column="CUSTOMER_USER_ID"/> |
||||
|
<result property="areaCode" column="AREA_CODE"/> |
||||
|
<result property="pid" column="PID"/> |
||||
|
<result property="latestTime" column="LATEST_TIME"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<select id="getGridLatestByIds" parameterType="com.epmet.dto.GridLatestDTO" |
||||
|
resultType="com.epmet.entity.GridLatestEntity"> |
||||
|
SELECT |
||||
|
la.id, |
||||
|
la.customer_id, |
||||
|
la.grid_id, |
||||
|
la.customer_user_id, |
||||
|
la.area_code, |
||||
|
la.pid, |
||||
|
la.latest_time, |
||||
|
la.del_flag, |
||||
|
la.revision, |
||||
|
la.created_by, |
||||
|
la.created_time, |
||||
|
la.updated_by, |
||||
|
la.updated_time |
||||
|
FROM grid_latest la |
||||
|
WHERE |
||||
|
la.del_flag = '0' |
||||
|
<if test='customerId != "" and customerId != null'> |
||||
|
AND la.customer_id = #{customerId} |
||||
|
</if> |
||||
|
<if test='gridId != "" and gridId != null'> |
||||
|
AND la.grid_id = #{gridId} |
||||
|
</if> |
||||
|
<if test='customerUserId != "" and customerUserId != null'> |
||||
|
AND la.customer_user_id = #{customerUserId} |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
@ -0,0 +1,53 @@ |
|||||
|
<?xml version="1.0" encoding="UTF-8"?> |
||||
|
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
||||
|
|
||||
|
<mapper namespace="com.epmet.dao.GridVisitedDao"> |
||||
|
|
||||
|
<resultMap type="com.epmet.entity.GridVisitedEntity" id="gridVisitedMap"> |
||||
|
<result property="id" column="ID"/> |
||||
|
<result property="isRegister" column="IS_REGISTER"/> |
||||
|
<result property="customerId" column="CUSTOMER_ID"/> |
||||
|
<result property="gridId" column="GRID_ID"/> |
||||
|
<result property="customerUserId" column="CUSTOMER_USER_ID"/> |
||||
|
<result property="visitTime" column="VISIT_TIME"/> |
||||
|
<result property="delFlag" column="DEL_FLAG"/> |
||||
|
<result property="revision" column="REVISION"/> |
||||
|
<result property="createdBy" column="CREATED_BY"/> |
||||
|
<result property="createdTime" column="CREATED_TIME"/> |
||||
|
<result property="updatedBy" column="UPDATED_BY"/> |
||||
|
<result property="updatedTime" column="UPDATED_TIME"/> |
||||
|
</resultMap> |
||||
|
|
||||
|
<select id="getGridVisitedByIds" parameterType="com.epmet.dto.GridVisitedDTO" |
||||
|
resultType="com.epmet.dto.GridVisitedDTO"> |
||||
|
SELECT |
||||
|
vi.id, |
||||
|
vi.is_register, |
||||
|
vi.customer_id, |
||||
|
vi.grid_id, |
||||
|
vi.customer_user_id, |
||||
|
vi.visit_time, |
||||
|
vi.del_flag, |
||||
|
vi.revision, |
||||
|
vi.created_by, |
||||
|
vi.created_time, |
||||
|
vi.updated_by, |
||||
|
vi.updated_time |
||||
|
FROM grid_visited vi |
||||
|
WHERE |
||||
|
vi.del_flag = '0' |
||||
|
<if test='customerId != "" and customerId != null'> |
||||
|
AND vi.customer_id = #{customerId} |
||||
|
</if> |
||||
|
<if test='gridId != "" and gridId != null'> |
||||
|
AND vi.grid_id = #{gridId} |
||||
|
</if> |
||||
|
<if test='customerUserId != "" and customerUserId != null'> |
||||
|
AND vi.customer_user_id = #{customerUserId} |
||||
|
</if> |
||||
|
<if test='visitTime != null'> |
||||
|
AND to_days(vi.visit_time) = to_days(#{visitTime}) |
||||
|
</if> |
||||
|
</select> |
||||
|
|
||||
|
</mapper> |
||||
Loading…
Reference in new issue