Browse Source

添加定制功能访问记录表以及代码生成

dev_shibei_match
sunyuchao 5 years ago
parent
commit
8b081281c0
  1. 106
      epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedVisitedDTO.java
  2. 94
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedVisitedController.java
  3. 33
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedVisitedDao.java
  4. 76
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedVisitedEntity.java
  5. 77
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedVisitedExcel.java
  6. 47
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionCustomizedVisitedRedis.java
  7. 95
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionCustomizedVisitedService.java
  8. 104
      epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedVisitedServiceImpl.java
  9. 20
      epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql
  10. 7
      epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedVisitedDao.xml

106
epmet-module/oper-customize/oper-customize-client/src/main/java/com/epmet/dto/FunctionCustomizedVisitedDTO.java

@ -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.dto;
import java.io.Serializable;
import java.util.Date;
import lombok.Data;
/**
* 定制功能访问记录表 记录居民端工作端那些人访问过定制功能以及访问的结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-13
*/
@Data
public class FunctionCustomizedVisitedDTO implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 主键
*/
private String id;
/**
* 客户ID
*/
private String customerId;
/**
* 用户Id
*/
private String userId;
/**
* 所属端 居民端:resi工作端:work
*/
private String clientType;
/**
* 功能Id
*/
private String functionId;
/**
* 请求地址 访问的url地址
*/
private String url;
/**
* 结果 成功success失败error
*/
private String result;
/**
* 原因 失败的原因:请求超时404500等
*/
private String msg;
/**
* 删除标识(0.未删除 1.已删除)
*/
private Integer delFlag;
/**
* 乐观锁
*/
private Integer revision;
/**
* 创建人
*/
private String createdBy;
/**
* 创建时间
*/
private Date createdTime;
/**
* 更新人
*/
private String updatedBy;
/**
* 更新时间
*/
private Date updatedTime;
}

94
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/controller/FunctionCustomizedVisitedController.java

@ -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.page.PageData;
import com.epmet.commons.tools.utils.ExcelUtils;
import com.epmet.commons.tools.utils.Result;
import com.epmet.commons.tools.validator.AssertUtils;
import com.epmet.commons.tools.validator.ValidatorUtils;
import com.epmet.commons.tools.validator.group.AddGroup;
import com.epmet.commons.tools.validator.group.UpdateGroup;
import com.epmet.commons.tools.validator.group.DefaultGroup;
import com.epmet.dto.FunctionCustomizedVisitedDTO;
import com.epmet.excel.FunctionCustomizedVisitedExcel;
import com.epmet.service.FunctionCustomizedVisitedService;
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-08-13
*/
@RestController
@RequestMapping("functioncustomizedvisited")
public class FunctionCustomizedVisitedController {
@Autowired
private FunctionCustomizedVisitedService functionCustomizedVisitedService;
@GetMapping("page")
public Result<PageData<FunctionCustomizedVisitedDTO>> page(@RequestParam Map<String, Object> params){
PageData<FunctionCustomizedVisitedDTO> page = functionCustomizedVisitedService.page(params);
return new Result<PageData<FunctionCustomizedVisitedDTO>>().ok(page);
}
@GetMapping("{id}")
public Result<FunctionCustomizedVisitedDTO> get(@PathVariable("id") String id){
FunctionCustomizedVisitedDTO data = functionCustomizedVisitedService.get(id);
return new Result<FunctionCustomizedVisitedDTO>().ok(data);
}
@PostMapping
public Result save(@RequestBody FunctionCustomizedVisitedDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, AddGroup.class, DefaultGroup.class);
functionCustomizedVisitedService.save(dto);
return new Result();
}
@PutMapping
public Result update(@RequestBody FunctionCustomizedVisitedDTO dto){
//效验数据
ValidatorUtils.validateEntity(dto, UpdateGroup.class, DefaultGroup.class);
functionCustomizedVisitedService.update(dto);
return new Result();
}
@DeleteMapping
public Result delete(@RequestBody String[] ids){
//效验数据
AssertUtils.isArrayEmpty(ids, "id");
functionCustomizedVisitedService.delete(ids);
return new Result();
}
@GetMapping("export")
public void export(@RequestParam Map<String, Object> params, HttpServletResponse response) throws Exception {
List<FunctionCustomizedVisitedDTO> list = functionCustomizedVisitedService.list(params);
ExcelUtils.exportExcelToTarget(response, null, list, FunctionCustomizedVisitedExcel.class);
}
}

33
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/dao/FunctionCustomizedVisitedDao.java

@ -0,0 +1,33 @@
/**
* 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.entity.FunctionCustomizedVisitedEntity;
import org.apache.ibatis.annotations.Mapper;
/**
* 定制功能访问记录表 记录居民端工作端那些人访问过定制功能以及访问的结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-13
*/
@Mapper
public interface FunctionCustomizedVisitedDao extends BaseDao<FunctionCustomizedVisitedEntity> {
}

76
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/entity/FunctionCustomizedVisitedEntity.java

@ -0,0 +1,76 @@
/**
* 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-08-13
*/
@Data
@EqualsAndHashCode(callSuper=false)
@TableName("function_customized_visited")
public class FunctionCustomizedVisitedEntity extends BaseEpmetEntity {
private static final long serialVersionUID = 1L;
/**
* 客户ID
*/
private String customerId;
/**
* 用户Id
*/
private String userId;
/**
* 所属端 居民端:resi工作端:work
*/
private String clientType;
/**
* 功能Id
*/
private String functionId;
/**
* 请求地址 访问的url地址
*/
private String url;
/**
* 结果 成功success失败error
*/
private String result;
/**
* 原因 失败的原因:请求超时404500等
*/
private String msg;
}

77
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/excel/FunctionCustomizedVisitedExcel.java

@ -0,0 +1,77 @@
/**
* 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-08-13
*/
@Data
public class FunctionCustomizedVisitedExcel {
@Excel(name = "主键")
private String id;
@Excel(name = "客户ID")
private String customerId;
@Excel(name = "用户Id")
private String userId;
@Excel(name = "所属端 居民端:resi工作端:work")
private String clientType;
@Excel(name = "功能Id")
private String functionId;
@Excel(name = "请求地址 访问的url地址")
private String url;
@Excel(name = "结果 成功success失败error")
private String result;
@Excel(name = "原因 失败的原因(例:请求超时、404、500等)")
private String msg;
@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;
}

47
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/redis/FunctionCustomizedVisitedRedis.java

@ -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-08-13
*/
@Component
public class FunctionCustomizedVisitedRedis {
@Autowired
private RedisUtils redisUtils;
public void delete(Object[] ids) {
}
public void set(){
}
public String get(String id){
return null;
}
}

95
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/FunctionCustomizedVisitedService.java

@ -0,0 +1,95 @@
/**
* 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.FunctionCustomizedVisitedDTO;
import com.epmet.entity.FunctionCustomizedVisitedEntity;
import java.util.List;
import java.util.Map;
/**
* 定制功能访问记录表 记录居民端工作端那些人访问过定制功能以及访问的结果
*
* @author generator generator@elink-cn.com
* @since v1.0.0 2020-08-13
*/
public interface FunctionCustomizedVisitedService extends BaseService<FunctionCustomizedVisitedEntity> {
/**
* 默认分页
*
* @param params
* @return PageData<FunctionCustomizedVisitedDTO>
* @author generator
* @date 2020-08-13
*/
PageData<FunctionCustomizedVisitedDTO> page(Map<String, Object> params);
/**
* 默认查询
*
* @param params
* @return java.util.List<FunctionCustomizedVisitedDTO>
* @author generator
* @date 2020-08-13
*/
List<FunctionCustomizedVisitedDTO> list(Map<String, Object> params);
/**
* 单条查询
*
* @param id
* @return FunctionCustomizedVisitedDTO
* @author generator
* @date 2020-08-13
*/
FunctionCustomizedVisitedDTO get(String id);
/**
* 默认保存
*
* @param dto
* @return void
* @author generator
* @date 2020-08-13
*/
void save(FunctionCustomizedVisitedDTO dto);
/**
* 默认更新
*
* @param dto
* @return void
* @author generator
* @date 2020-08-13
*/
void update(FunctionCustomizedVisitedDTO dto);
/**
* 批量删除
*
* @param ids
* @return void
* @author generator
* @date 2020-08-13
*/
void delete(String[] ids);
}

104
epmet-module/oper-customize/oper-customize-server/src/main/java/com/epmet/service/impl/FunctionCustomizedVisitedServiceImpl.java

@ -0,0 +1,104 @@
/**
* 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.FunctionCustomizedVisitedDao;
import com.epmet.dto.FunctionCustomizedVisitedDTO;
import com.epmet.entity.FunctionCustomizedVisitedEntity;
import com.epmet.redis.FunctionCustomizedVisitedRedis;
import com.epmet.service.FunctionCustomizedVisitedService;
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-08-13
*/
@Service
public class FunctionCustomizedVisitedServiceImpl extends BaseServiceImpl<FunctionCustomizedVisitedDao, FunctionCustomizedVisitedEntity> implements FunctionCustomizedVisitedService {
@Autowired
private FunctionCustomizedVisitedRedis functionCustomizedVisitedRedis;
@Override
public PageData<FunctionCustomizedVisitedDTO> page(Map<String, Object> params) {
IPage<FunctionCustomizedVisitedEntity> page = baseDao.selectPage(
getPage(params, FieldConstant.CREATED_TIME, false),
getWrapper(params)
);
return getPageData(page, FunctionCustomizedVisitedDTO.class);
}
@Override
public List<FunctionCustomizedVisitedDTO> list(Map<String, Object> params) {
List<FunctionCustomizedVisitedEntity> entityList = baseDao.selectList(getWrapper(params));
return ConvertUtils.sourceToTarget(entityList, FunctionCustomizedVisitedDTO.class);
}
private QueryWrapper<FunctionCustomizedVisitedEntity> getWrapper(Map<String, Object> params){
String id = (String)params.get(FieldConstant.ID_HUMP);
QueryWrapper<FunctionCustomizedVisitedEntity> wrapper = new QueryWrapper<>();
wrapper.eq(StringUtils.isNotBlank(id), FieldConstant.ID, id);
return wrapper;
}
@Override
public FunctionCustomizedVisitedDTO get(String id) {
FunctionCustomizedVisitedEntity entity = baseDao.selectById(id);
return ConvertUtils.sourceToTarget(entity, FunctionCustomizedVisitedDTO.class);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void save(FunctionCustomizedVisitedDTO dto) {
FunctionCustomizedVisitedEntity entity = ConvertUtils.sourceToTarget(dto, FunctionCustomizedVisitedEntity.class);
insert(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void update(FunctionCustomizedVisitedDTO dto) {
FunctionCustomizedVisitedEntity entity = ConvertUtils.sourceToTarget(dto, FunctionCustomizedVisitedEntity.class);
updateById(entity);
}
@Override
@Transactional(rollbackFor = Exception.class)
public void delete(String[] ids) {
// 逻辑删除(@TableLogic 注解)
baseDao.deleteBatchIds(Arrays.asList(ids));
}
}

20
epmet-module/oper-customize/oper-customize-server/src/main/resources/db/migration/V0.0.4__add_customer_function_detail.sql

@ -24,3 +24,23 @@ ALTER TABLE `function_customized` ADD COLUMN `DOMAIN_NAME` VARCHAR (128) CHARACT
SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '业务域名' AFTER `UPDATED_TIME`,
ADD COLUMN `FROM_APP` VARCHAR (32) CHARACTER
SET utf8mb4 COLLATE utf8mb4_general_ci NOT NULL COMMENT '来源app(政府端:gov、居民端:resi)' AFTER `REALM_NAME`;
DROP TABLE IF EXISTS `function_customized_visited`;
CREATE TABLE function_customized_visited(
ID VARCHAR(64) NOT NULL COMMENT '主键' ,
CUSTOMER_ID VARCHAR(32) NOT NULL COMMENT '客户ID' ,
USER_ID VARCHAR(64) NOT NULL COMMENT '用户Id' ,
CLIENT_TYPE VARCHAR(32) NOT NULL COMMENT '所属端 居民端:resi工作端:work' ,
FUNCTION_ID VARCHAR(64) NOT NULL COMMENT '功能Id' ,
URL VARCHAR(128) NOT NULL COMMENT '请求地址 访问的url地址' ,
RESULT VARCHAR(1024) NOT NULL COMMENT '结果 成功success失败error' ,
MSG VARCHAR(128) NOT NULL COMMENT '原因 失败的原因(例:请求超时、404、500等)' ,
DEL_FLAG INT NOT NULL COMMENT '删除标识(0.未删除 1.已删除)' ,
REVISION INT NOT NULL COMMENT '乐观锁' ,
CREATED_BY VARCHAR(32) NOT NULL COMMENT '创建人' ,
CREATED_TIME DATETIME NOT NULL COMMENT '创建时间' ,
UPDATED_BY VARCHAR(32) NOT NULL COMMENT '更新人' ,
UPDATED_TIME DATETIME NOT NULL COMMENT '更新时间' ,
PRIMARY KEY (ID)
) COMMENT = '定制功能访问记录表 记录居民端、工作端那些人访问过定制功能以及访问的结果';

7
epmet-module/oper-customize/oper-customize-server/src/main/resources/mapper/FunctionCustomizedVisitedDao.xml

@ -0,0 +1,7 @@
<?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.FunctionCustomizedVisitedDao">
</mapper>
Loading…
Cancel
Save