Commit 2a52f6d2 by 袁伟铭

资源目录管理

parent e581fdfa
......@@ -28,4 +28,7 @@ public class DBName {
// 社会救助
public final static String GXSHJZ = "gxshjz";
// 资源目录管理
public final static String RESOURCE = "resource";
}
package com.zq.common.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 系统用户(SysUser)实体类
*
* @author makejava
* @since 2021-07-01 09:40:41
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "sys_user")
public class SysUser {
/**
* ID
*/
@TableId(type = IdType.AUTO)
@ApiModelProperty("ID")
private Long userId;
/**
* 部门名称
*/
@ApiModelProperty("部门名称")
private Long deptId;
/**
* 用户名
*/
@ApiModelProperty("用户名")
private String username;
/**
* 昵称
*/
@ApiModelProperty("昵称")
private String nickName;
/**
* 性别
*/
@ApiModelProperty("性别")
private String gender;
/**
* 手机号码
*/
@ApiModelProperty("手机号码")
private String phone;
/**
* 邮箱
*/
@ApiModelProperty("邮箱")
private String email;
/**
* 头像地址
*/
@ApiModelProperty("头像地址")
private String avatarName;
/**
* 头像真实路径
*/
@ApiModelProperty("头像真实路径")
private String avatarPath;
/**
* 密码
*/
@ApiModelProperty("密码")
private String password;
/**
* 是否为admin账号
*/
@ApiModelProperty("是否为admin账号")
private Boolean isAdmin;
/**
* 状态:1启用、0禁用
*/
@ApiModelProperty("状态:1启用、0禁用")
private Long enabled;
/**
* 创建者
*/
@ApiModelProperty("创建者")
private String createBy;
/**
* 更新着
*/
@ApiModelProperty("更新着")
private String updateBy;
/**
* 修改密码的时间
*/
@ApiModelProperty("修改密码的时间")
private Date pwdResetTime;
/**
* 创建日期
*/
@ApiModelProperty("创建日期")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
package com.zq.common.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* (SysUsersJobs)实体类
*
* @author makejava
* @since 2021-07-01 10:51:02
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "sys_users_jobs")
public class SysUsersJobs {
/**
* 用户ID
*/
@ApiModelProperty("用户ID")
private Long userId;
/**
* 岗位ID
*/
@ApiModelProperty("岗位ID")
private Long jobId;
}
package com.zq.common.entity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 用户角色关联(SysUsersRoles)实体类
*
* @author makejava
* @since 2021-07-01 10:51:17
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "sys_users_roles")
public class SysUsersRoles {
/**
* 用户ID
*/
@ApiModelProperty("用户ID")
private Long userId;
/**
* 角色ID
*/
@ApiModelProperty("角色ID")
private Long roleId;
}
package com.zq.common.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* (SysYear)实体类
*
* @author wilmiam
* @since 2021-06-19 09:39:12
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "system_year")
public class SystemYear {
/**
* 区域唯一标识
*/
@TableId
@ApiModelProperty("区域唯一标识")
private Integer id;
/**
* 0 未统计 1已统计
*/
@ApiModelProperty("0 未统计 1已统计")
private Integer isok;
}
package com.zq.common.utils;
/**
* @author wilmiam
* @since 2021/8/19 15:11
*/
public class AreaCodeUtils {
/**
* 截取区域等级前缀
*
* @return
*/
public String subAreaCode(String code, Integer type) {
String sbId = "45";
if (type == 0 || StringUtils.isBlank(code)) {
return sbId;
}
switch (type) {
case 1:
sbId = code.substring(0, 2);
break;
case 2:
sbId = code.substring(0, 4);
break;
case 3:
sbId = code.substring(0, 6);
break;
case 4:
sbId = code.substring(0, 9);
break;
case 5:
sbId = code;
break;
default:
}
return sbId;
}
/**
* 补零
*
* @return
*/
public static String patchZero(String subAreaCode) {
StringBuilder subAreaCodeBuilder = new StringBuilder(subAreaCode);
for (int i = subAreaCodeBuilder.length(); i < 12; i++) {
subAreaCodeBuilder.append("0");
}
return subAreaCodeBuilder.toString();
}
/**
* 获取下一区域等级长度
*
* @param level
* @return
*/
public static int getNextLevelLength(Integer level) {
if (level == 1) {
return 4;
} else if (level == 2) {
return 6;
} else if (level == 3) {
return 9;
} else {
return 12;
}
}
}
......@@ -33,7 +33,7 @@ redis.port: 6379
jdbc.driver-class-name: com.mysql.cj.jdbc.Driver
jdbc.username: root
jdbc.password: Dk2019!23456
jdbc.url: jdbc:mysql://47.107.148.253:3306/wine?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
jdbc.url: jdbc:mysql://47.107.148.253:3306/mz_big_data?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
#jwt
jwt:
header: Authorization
......
......@@ -51,3 +51,8 @@ spring:
predicates:
- Path=/api/**
- id: resource
uri: lb://${resource.name}
predicates:
- Path=/resource/**
......@@ -2,7 +2,6 @@ package com.zq.portal.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.entity.SystemArea;
import com.zq.common.entity.SystemYear;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.stereotype.Repository;
......@@ -20,8 +19,6 @@ public interface AreaDao extends BaseMapper<SystemArea> {
List<SystemArea> getAreaByType(Map param);
List<SystemYear> getYear();
List<SystemArea> findKid(String parentId);
SystemArea getAreaByCode(String id);
......
package com.zq.resource;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.PathSelectors;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;
/**
* @author bici
*/
@Configuration
@EnableSwagger2
public class Swagger {
@Value("${spring.profiles.active:product}")
private String profile;
@Bean
public Docket api() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("admin")
.enable(!"product".equals(profile))
.select()
.apis(RequestHandlerSelectors.basePackage("com.zq.resource.controller.admin"))
.paths(PathSelectors.any())
.build()
.apiInfo(apiInfo());
}
private ApiInfo apiInfo() {
return new ApiInfoBuilder()
.title("后台接口文档")
.description("查看接口文档")
.build();
}
@Bean
public Docket app() {
return new Docket(DocumentationType.SWAGGER_2)
.groupName("App")
.enable(!"product".equals(profile))
.select()
.apis(RequestHandlerSelectors.basePackage("com.zq.resource.controller.app"))
.paths(PathSelectors.any())
.build()
.apiInfo(appInfo());
}
private ApiInfo appInfo() {
return new ApiInfoBuilder()
.title("APP接口文档")
.description("查看接口文档")
.build();
}
}
package com.zq.resource.controller.admin;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.SystemArea;
import com.zq.resource.service.AreaService;
import com.zq.resource.vo.DataTreeVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "区域相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/resource/admin/area")
public class AreaController {
private final AreaService areaService;
@ApiOperation("获取广西全区树形结构")
@GetMapping(value = "/areaTree")
public ResultVo<List<DataTreeVo>> areaTree() {
return ResultVo.success(areaService.areaTree());
}
@ApiOperation("指定条件获取区域列表")
@PostMapping(value = "/areaList")
public ResultVo<List<SystemArea>> areaList(@RequestBody SystemArea vo) {
return ResultVo.success(areaService.areaList(vo));
}
}
package com.zq.resource.controller.admin;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.DataCategory;
import com.zq.resource.service.CategoryService;
import com.zq.resource.vo.DataCategoryFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "资源目录相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/resource/admin/category")
public class CategoryController {
private final CategoryService categoryService;
@ApiOperation("获取目录列表")
@PostMapping(value = "/getCategoryList")
public ResultVo<PageVo<DataCategory>> getCategoryList(@RequestBody DataCategoryFindVo vo) {
return ResultVo.success(categoryService.getCategoryList(vo));
}
@ApiOperation("添加目录")
@PostMapping(value = "/addCategory")
public ResultVo addCategory(@RequestBody DataCategory vo) {
AssertUtils.hasText(vo.getCategoryName(), "缺少目录名称");
AssertUtils.notNull(vo.getSourceType(), "缺少属性类型");
AssertUtils.notNull(vo.getSecurityType(), "缺少涉密类型");
AssertUtils.notNull(vo.getShareType(), "缺少共享类型");
AssertUtils.notNull(vo.getLevelType(), "缺少层级类型");
AssertUtils.notNull(vo.getLoadType(), "缺少挂载类型");
categoryService.addCategory(vo);
return ResultVo.success();
}
@ApiOperation("修改目录")
@PostMapping(value = "/modifyCategory")
public ResultVo modifyCategory(@RequestBody DataCategory vo) {
AssertUtils.notNull(vo.getId());
categoryService.modifyCategory(vo);
return ResultVo.success();
}
}
package com.zq.resource.controller.admin;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.OrgDept;
import com.zq.resource.service.DeptService;
import com.zq.resource.vo.OrgDeptFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "机构部门相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/resource/admin/dept")
public class DeptController {
private final DeptService deptService;
@ApiOperation("获取机构列表")
@PostMapping(value = "/getDeptList")
public ResultVo<PageVo<OrgDept>> getDeptList(@RequestBody OrgDeptFindVo vo) {
return ResultVo.success(deptService.getDeptList(vo));
}
@ApiOperation("根据部门PID查询子机构")
@GetMapping(value = "/getDeptByPid/{parentId}")
public ResultVo<List<OrgDept>> getDeptByPid(@PathVariable Long parentId) {
return ResultVo.success(deptService.getDeptByPid(parentId));
}
@ApiOperation("添加机构")
@PostMapping(value = "/addDept")
public ResultVo addDept(@RequestBody OrgDept vo) {
AssertUtils.notNull(vo.getParentId(), "缺少父级ID");
AssertUtils.hasText(vo.getDeptName(), "缺少机构名称");
AssertUtils.notNull(vo.getDeptType(), "缺少机构类型");
AssertUtils.hasText(vo.getAreaCode(), "缺少区域码");
AssertUtils.hasText(vo.getAddress(), "缺少地址");
AssertUtils.hasText(vo.getTel(), "缺少电话");
AssertUtils.notNull(vo.getTotalOrgStaff(), "缺少编制人员数量");
AssertUtils.notNull(vo.getCurrOrgStaff(), "缺少在编人员数量");
AssertUtils.hasText(vo.getResponsibility(), "缺少主要职责");
deptService.addDept(vo);
return ResultVo.success();
}
@ApiOperation("修改机构")
@PostMapping(value = "/modifyDept")
public ResultVo modifyDept(@RequestBody OrgDept vo) {
AssertUtils.notNull(vo.getId());
deptService.modifyDept(vo);
return ResultVo.success();
}
@ApiOperation("获取机构树")
@GetMapping(value = "/getDeptTree")
public ResultVo getDeptTree() {
return ResultVo.success(deptService.getDeptTree());
}
}
package com.zq.resource.controller.admin;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.DataCategory;
import com.zq.resource.entity.DataDict;
import com.zq.resource.service.DictService;
import com.zq.resource.vo.DataDictFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "数据字典相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/resource/admin/dict")
public class DictController {
private final DictService dictService;
@ApiOperation("获取字典列表")
@PostMapping(value = "/getDictList")
public ResultVo<PageVo<DataDict>> getDictList(@RequestBody DataDictFindVo vo) {
return ResultVo.success(dictService.getDictList(vo));
}
@ApiOperation("添加字典")
@PostMapping(value = "/addDict")
public ResultVo addDict(@RequestBody DataDict vo) {
AssertUtils.hasText(vo.getType(), "缺少字典名称");
AssertUtils.hasText(vo.getTypeDesc(), "缺少字典描述");
AssertUtils.notNull(vo.getCode(), "缺少字典值");
AssertUtils.notNull(vo.getCodeDesc(), "缺少字典值描述");
AssertUtils.notNull(vo.getSortNo(), "缺少排序");
dictService.addDict(vo);
return ResultVo.success();
}
@ApiOperation("修改字典")
@PostMapping(value = "/modifyDict")
public ResultVo modifyDict(@RequestBody DataDict vo) {
AssertUtils.notNull(vo.getId());
dictService.modifyDict(vo);
return ResultVo.success();
}
}
package com.zq.resource.controller.admin;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.GovAffairItem;
import com.zq.resource.service.GovAffairService;
import com.zq.resource.vo.GovAffairItemFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "政务服务事项相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/resource/admin/govAffair")
public class GovAffairController {
private final GovAffairService govAffairService;
@ApiOperation("获取政务服务事项列表")
@PostMapping(value = "/getGovAffairList")
public ResultVo<PageVo<GovAffairItem>> getGovAffairList(@RequestBody GovAffairItemFindVo vo) {
return ResultVo.success(govAffairService.getGovAffairList(vo));
}
@ApiOperation("添加政务服务事项")
@PostMapping(value = "/addGovAffair")
public ResultVo addGovAffair(@RequestBody GovAffairItem vo) {
AssertUtils.notNull(vo.getDeptId(), "缺少部门ID");
AssertUtils.notNull(vo.getAffairItemType(), "缺少事项类型");
AssertUtils.hasText(vo.getItemName(), "缺少事项名称");
AssertUtils.hasText(vo.getItemCode(), "缺少事项代码");
AssertUtils.hasText(vo.getDocument(), "缺少办理材料名称");
govAffairService.addGovAffair(vo);
return ResultVo.success();
}
@ApiOperation("修改政务服务事项")
@PostMapping(value = "/modifyGovAffair")
public ResultVo modifyGovAffair(@RequestBody GovAffairItem vo) {
AssertUtils.notNull(vo.getId());
govAffairService.modifyGovAffair(vo);
return ResultVo.success();
}
}
package com.zq.resource.controller.admin;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.GovMonitorItem;
import com.zq.resource.service.GovMonitorService;
import com.zq.resource.vo.GovMonitorItemFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "政务监管事项相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/resource/admin/govMonitor")
public class GovMonitorController {
private final GovMonitorService govMonitorService;
@ApiOperation("获取政务监管事项列表")
@PostMapping(value = "/getGovMonitorList")
public ResultVo<PageVo<GovMonitorItem>> getGovMonitorList(@RequestBody GovMonitorItemFindVo vo) {
return ResultVo.success(govMonitorService.getGovMonitorList(vo));
}
@ApiOperation("添加政务监管事项")
@PostMapping(value = "/addGovMonitor")
public ResultVo addGovMonitor(@RequestBody GovMonitorItem vo) {
AssertUtils.notNull(vo.getDeptId(), "缺少部门ID");
AssertUtils.notNull(vo.getMonitorItemType(), "缺少事项类型");
AssertUtils.hasText(vo.getItemName(), "缺少事项名称");
AssertUtils.hasText(vo.getSubItemName(), "缺少子项名称");
AssertUtils.hasText(vo.getMainItemCode(), "缺少主项代码");
govMonitorService.addGovMonitor(vo);
return ResultVo.success();
}
@ApiOperation("修改政务监管事项")
@PostMapping(value = "/modifyGovMonitor")
public ResultVo modifyGovMonitor(@RequestBody GovMonitorItem vo) {
AssertUtils.notNull(vo.getId());
govMonitorService.modifyGovMonitor(vo);
return ResultVo.success();
}
}
package com.zq.resource.controller.admin;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.InfoMetadata;
import com.zq.resource.service.MetadataService;
import com.zq.resource.vo.InfoMetadataFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "元数据相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/resource/admin/metadata")
public class MetadataController {
private final MetadataService metadataService;
@ApiOperation("获取元数据列表")
@PostMapping(value = "/getMetadataList")
public ResultVo<PageVo<InfoMetadata>> getMetadataList(@RequestBody InfoMetadataFindVo vo) {
return ResultVo.success(metadataService.getMetadataList(vo));
}
@ApiOperation("添加字典")
@PostMapping(value = "/addMetadata")
public ResultVo addMetadata(@RequestBody InfoMetadata vo) {
AssertUtils.hasText(vo.getMetaName(), "缺少元数据名称");
AssertUtils.notNull(vo.getBelongCategoryId(), "缺少所属目录ID");
AssertUtils.notNull(vo.getFormatType(), "缺少资源格式");
AssertUtils.hasText(vo.getDataItemName(), "缺少数据项名称");
AssertUtils.notNull(vo.getShareType(), "缺少分享类型");
AssertUtils.hasText(vo.getShareOption(), "缺少共享属性");
AssertUtils.hasText(vo.getShareCondition(), "缺少共享条件");
AssertUtils.hasText(vo.getShareMode(), "缺少共享方式");
AssertUtils.hasText(vo.getOpenOption(), "缺少开发属性");
AssertUtils.notNull(vo.getUpdateCycle(), "缺少更新周期");
AssertUtils.hasText(vo.getDataType(), "缺少数据分类");
AssertUtils.notNull(vo.getIssueDate(), "缺少发布日期");
AssertUtils.hasText(vo.getGovDataCode(), "缺少数据资源代码");
AssertUtils.notNull(vo.getIfLicense(), "缺少是否为电子证照");
metadataService.addMetadata(vo);
return ResultVo.success();
}
@ApiOperation("修改字典")
@PostMapping(value = "/modifyMetadata")
public ResultVo modifyMetadata(@RequestBody InfoMetadata vo) {
AssertUtils.notNull(vo.getId());
metadataService.modifyMetadata(vo);
return ResultVo.success();
}
}
package com.zq.resource.controller.admin;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.resource.entity.InfoSystem;
import com.zq.resource.service.SystemService;
import com.zq.resource.vo.InfoSystemFindVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
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;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
@Api(tags = "系统资源相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/resource/admin/system")
public class SystemController {
private final SystemService systemService;
@ApiOperation("获取系统列表")
@PostMapping(value = "/getSystemList")
public ResultVo<PageVo<InfoSystem>> getSystemList(@RequestBody InfoSystemFindVo vo) {
return ResultVo.success(systemService.getSystemList(vo));
}
@ApiOperation("添加系统")
@PostMapping(value = "/addSystem")
public ResultVo addSystem(@RequestBody InfoSystem vo) {
AssertUtils.hasText(vo.getSystemName(), "缺少系统名称");
AssertUtils.notNull(vo.getBelongDeptId(), "缺少所属部门ID");
AssertUtils.notNull(vo.getSystemType(), "缺少系统类型");
AssertUtils.notNull(vo.getSystemLevelType(), "缺少系统层级");
AssertUtils.notNull(vo.getCoverLevelType(), "缺少覆盖层级");
AssertUtils.notNull(vo.getNetworkType(), "缺少网络类型");
AssertUtils.notNull(vo.getRunStatus(), "缺少运行状态");
AssertUtils.notNull(vo.getCloudType(), "缺少云类别");
AssertUtils.hasText(vo.getCloudName(), "缺少云名称");
AssertUtils.notNull(vo.getComputerRoomType(), "缺少机房建设类型");
AssertUtils.hasText(vo.getComputerRoomName(), "缺少机房名称");
AssertUtils.notNull(vo.getDatabaseType(), "缺少数据库类型");
AssertUtils.hasText(vo.getDatabaseName(), "缺少数据库名称");
AssertUtils.notNull(vo.getDatabaseQuantity(), "缺少数据库数量");
AssertUtils.notNull(vo.getDatabaseDeploymentType(), "缺少数据库部署方式");
systemService.addSystem(vo);
return ResultVo.success();
}
@ApiOperation("修改系统")
@PostMapping(value = "/modifySystem")
public ResultVo modifySystem(@RequestBody InfoSystem vo) {
AssertUtils.notNull(vo.getId());
systemService.modifySystem(vo);
return ResultVo.success();
}
}
package com.zq.resource.controller.app;
/**
* @author wilmiam
* @since 2021/8/19 14:33
*/
public class DeptApi {
}
package com.zq.user.dao;
package com.zq.resource.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.constant.DBName;
import com.zq.common.entity.Pfuser;
import com.zq.resource.entity.DataCategory;
import org.springframework.stereotype.Repository;
/**
* 存放系统所有用户的基本信息(Pfuser)表数据库访问层
* 资源目录(DataCategory)表数据库访问层
*
* @author makejava
* @since 2021-06-23 17:56:31
* @since 2021-08-19 11:25:52
*/
@DS(DBName.GXSHZZ)
@DS(DBName.RESOURCE)
@Repository
public interface PfuserDao extends BaseMapper<Pfuser> {
public interface DataCategoryDao extends BaseMapper<DataCategory> {
}
}
\ No newline at end of file
package com.zq.resource.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.constant.DBName;
import com.zq.resource.entity.DataDict;
import org.springframework.stereotype.Repository;
/**
* 数据字典表(DataDict)表数据库访问层
*
* @author makejava
* @since 2021-08-19 11:25:54
*/
@DS(DBName.RESOURCE)
@Repository
public interface DataDictDao extends BaseMapper<DataDict> {
}
\ No newline at end of file
package com.zq.user.dao;
package com.zq.resource.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.entity.SysUsersJobs;
import com.zq.common.constant.DBName;
import com.zq.resource.entity.GovAffairItem;
import org.springframework.stereotype.Repository;
/**
* (SysUsersJobs)表数据库访问层
* 机构的政务服务事项表(GovAffairItem)表数据库访问层
*
* @author makejava
* @since 2021-07-01 10:52:36
* @since 2021-08-19 11:25:54
*/
@DS(DBName.RESOURCE)
@Repository
public interface SysUsersJobsDao extends BaseMapper<SysUsersJobs> {
}
public interface GovAffairItemDao extends BaseMapper<GovAffairItem> {
}
\ No newline at end of file
package com.zq.user.dao;
package com.zq.resource.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.entity.SysUsersRoles;
import com.zq.common.constant.DBName;
import com.zq.resource.entity.GovMonitorItem;
import org.springframework.stereotype.Repository;
/**
* 用户角色关联(SysUsersRoles)表数据库访问层
* 机构的监管事项表(GovMonitorItem)表数据库访问层
*
* @author makejava
* @since 2021-07-01 10:52:50
* @since 2021-08-19 11:25:54
*/
@DS(DBName.RESOURCE)
@Repository
public interface SysUsersRolesDao extends BaseMapper<SysUsersRoles> {
}
public interface GovMonitorItemDao extends BaseMapper<GovMonitorItem> {
}
\ No newline at end of file
package com.zq.resource.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.constant.DBName;
import com.zq.resource.entity.InfoMetadata;
import org.springframework.stereotype.Repository;
/**
* 资源元数据表(InfoMetadata)表数据库访问层
*
* @author makejava
* @since 2021-08-19 11:25:54
*/
@DS(DBName.RESOURCE)
@Repository
public interface InfoMetadataDao extends BaseMapper<InfoMetadata> {
}
\ No newline at end of file
package com.zq.resource.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.constant.DBName;
import com.zq.resource.entity.InfoSystem;
import org.springframework.stereotype.Repository;
/**
* 系统资源信息表(InfoSystem)表数据库访问层
*
* @author makejava
* @since 2021-08-19 11:25:54
*/
@DS(DBName.RESOURCE)
@Repository
public interface InfoSystemDao extends BaseMapper<InfoSystem> {
}
\ No newline at end of file
package com.zq.resource.dao;
import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.constant.DBName;
import com.zq.resource.entity.OrgDept;
import org.springframework.stereotype.Repository;
/**
* 机构表(OrgDept)表数据库访问层
*
* @author makejava
* @since 2021-08-19 11:25:54
*/
@DS(DBName.RESOURCE)
@Repository
public interface OrgDeptDao extends BaseMapper<OrgDept> {
}
\ No newline at end of file
package com.zq.user.dao;
package com.zq.resource.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.entity.SysUser;
import com.zq.resource.entity.SystemArea;
import org.springframework.stereotype.Repository;
/**
* 系统用户(SysUser)表数据库访问层
* 行政区域信息表(SystemArea)表数据库访问层
*
* @author makejava
* @since 2021-07-01 09:41:49
* @since 2021-08-19 15:09:48
*/
@Repository
public interface SysUserDao extends BaseMapper<SysUser> {
}
public interface SystemAreaDao extends BaseMapper<SystemArea> {
}
\ No newline at end of file
package com.zq.resource.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 资源目录(DataCategory)实体类
*
* @author makejava
* @since 2021-08-19 11:28:34
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "data_category")
public class DataCategory {
/**
* 自增
*/
@ApiModelProperty("自增")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 目录名称
*/
@ApiModelProperty("目录名称")
private String categoryName;
/**
* 资源目录属性:分为1基础信息资源目录、2主题信息资源目录、3部门信息资源目录。
*/
@ApiModelProperty("资源目录属性:分为1基础信息资源目录、2主题信息资源目录、3部门信息资源目录。")
private Integer sourceType;
/**
* 数据资源涉密属性:分为1涉密政务数据资源目录和2非涉密政务数据资源目录。
*/
@ApiModelProperty("数据资源涉密属性:分为1涉密政务数据资源目录和2非涉密政务数据资源目录。")
private Integer securityType;
/**
* 共享类型:资源目录按共享类型分为1无条件共享、2有条件共享、3不予共享等三种类型
*/
@ApiModelProperty("共享类型:资源目录按共享类型分为1无条件共享、2有条件共享、3不予共享等三种类型")
private Integer shareType;
/**
* 层级属性:分为自治区级、自治区/市两级、自治区/市/县三级、自治区/市/县/乡四级、自治区/市/县/乡/村五级。
*/
@ApiModelProperty("层级属性:分为自治区级、自治区/市两级、自治区/市/县三级、自治区/市/县/乡四级、自治区/市/县/乡/村五级。")
private Integer levelType;
/**
* 资源挂载方式:分为库表、接口、文件三种方式。
*/
@ApiModelProperty("资源挂载方式:分为库表、接口、文件三种方式。")
private Integer loadType;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
* 数据字典表(DataDict)实体类
*
* @author makejava
* @since 2021-08-19 11:28:35
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "data_dict")
public class DataDict {
/**
* 自增
*/
@ApiModelProperty("自增")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 类型代码,如:update_cycle
*/
@ApiModelProperty("类型代码,如:update_cycle")
private String type;
/**
* 类型描述,如:更新周期
*/
@ApiModelProperty("类型描述,如:更新周期")
private String typeDesc;
/**
* 代码:1
*/
@ApiModelProperty("代码:1")
private Integer code;
/**
* 代码描述:实时
*/
@ApiModelProperty("代码描述:实时")
private String codeDesc;
/**
* 排序号
*/
@ApiModelProperty("排序号")
private Integer sortNo;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
* 机构的政务服务事项表(GovAffairItem)实体类
*
* @author makejava
* @since 2021-08-19 11:28:35
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "gov_affair_item")
public class GovAffairItem {
/**
* 自增
*/
@ApiModelProperty("自增")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 机构id
*/
@ApiModelProperty("机构id")
private Long deptId;
/**
* 政务服务事项类型: 包括1行政许可、2行政确认、3行政裁决、4行政征收、5行政给付、6行政奖励、7其他行政权力、8公共服务。
*/
@ApiModelProperty("政务服务事项类型: 包括1行政许可、2行政确认、3行政裁决、4行政征收、5行政给付、6行政奖励、7其他行政权力、8公共服务。")
private Integer affairItemType;
/**
* 事项名称
*/
@ApiModelProperty("事项名称")
private String itemName;
/**
* 事项代码
*/
@ApiModelProperty("事项代码")
private String itemCode;
/**
* 办理材料名称
*/
@ApiModelProperty("办理材料名称")
private String document;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
* 机构的监管事项表(GovMonitorItem)实体类
*
* @author makejava
* @since 2021-08-19 11:28:36
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "gov_monitor_item")
public class GovMonitorItem {
/**
* 自增
*/
@ApiModelProperty("自增")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 机构id
*/
@ApiModelProperty("机构id")
private Long deptId;
/**
* 监管事项: 类型包括1行政检查、2行政强制、3行政处罚、4其他行政权力。
*/
@ApiModelProperty("监管事项: 类型包括1行政检查、2行政强制、3行政处罚、4其他行政权力。")
private Integer monitorItemType;
/**
* 事项名称
*/
@ApiModelProperty("事项名称")
private String itemName;
/**
* 子项名称
*/
@ApiModelProperty("子项名称")
private String subItemName;
/**
* 主项代码
*/
@ApiModelProperty("主项代码")
private String mainItemCode;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
* 资源元数据表(InfoMetadata)实体类
*
* @author makejava
* @since 2021-08-19 11:28:37
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "info_metadata")
public class InfoMetadata {
/**
* 自增
*/
@ApiModelProperty("自增")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 元数据名称
*/
@ApiModelProperty("元数据名称")
private String metaName;
/**
* 归属资源目录id
*/
@ApiModelProperty("归属资源目录id")
private Long belongCategoryId;
/**
* 数据资源格式: 分为1电子文件、2电子表格、3数据库类、4图形图像类、5流媒体类、6接口类。
*/
@ApiModelProperty("数据资源格式: 分为1电子文件、2电子表格、3数据库类、4图形图像类、5流媒体类、6接口类。")
private Integer formatType;
/**
* 对结构化数据资源,描述其具体的信息项名称
*/
@ApiModelProperty("对结构化数据资源,描述其具体的信息项名称")
private String dataItemName;
/**
* 共享类型:资源目录按共享类型分为1无条件共享、2有条件共享、3不予共享等三种类型
*/
@ApiModelProperty("共享类型:资源目录按共享类型分为1无条件共享、2有条件共享、3不予共享等三种类型")
private Integer shareType;
/**
* 共享属性:对政务数据资源共享类型和条件的描述,包括共享类型、共享条件、共享方式。
*/
@ApiModelProperty("共享属性:对政务数据资源共享类型和条件的描述,包括共享类型、共享条件、共享方式。")
private String shareOption;
/**
* 共享条件:无条件共享类和有条件共享类的政务数据资源,应标明使用要求,包括作为行政依据、工作参考、业务协同等;有条件共享类的政务数据资源还应注明共享条件和共享范围;对于不予类的政务数据资源,应注明相关的法律、行政法规或党中央、国务院政策依据。
*/
@ApiModelProperty("共享条件:无条件共享类和有条件共享类的政务数据资源,应标明使用要求,包括作为行政依据、工作参考、业务协同等;有条件共享类的政务数据资源还应注明共享条件和共享范围;对于不予类的政务数据资源,应注明相关的法律、行政法规或党中央、国务院政策依据。")
private String shareCondition;
/**
* 共享方式:获取数据资源的方式。原则上应通过数据共享交换平台方式获取。确因条件所限可采用其他方式,如文件夹、纸质文档、电子文档等方式。
*/
@ApiModelProperty("共享方式:获取数据资源的方式。原则上应通过数据共享交换平台方式获取。确因条件所限可采用其他方式,如文件夹、纸质文档、电子文档等方式。")
private String shareMode;
/**
* 开放属性:对政务数据资源向社会开放,以及开放条件的描述,包括是否向社会开放、开放条件。
*/
@ApiModelProperty("开放属性:对政务数据资源向社会开放,以及开放条件的描述,包括是否向社会开放、开放条件。")
private String openOption;
/**
* 更新周期:数据资源更新的频度。分为1实时、2每日、3每周、4每月、5每季度、6每年等。
*/
@ApiModelProperty("更新周期:数据资源更新的频度。分为1实时、2每日、3每周、4每月、5每季度、6每年等。")
private Integer updateCycle;
/**
* 数据资源分类:描述数据资源的分类,包括所属领域、服务分类、以及标签分类。
*/
@ApiModelProperty("数据资源分类:描述数据资源的分类,包括所属领域、服务分类、以及标签分类。")
private String dataType;
/**
* 发布日期
*/
@ApiModelProperty("发布日期")
private Date issueDate;
/**
* 政务数据资源代码
*/
@ApiModelProperty("政务数据资源代码")
private String govDataCode;
/**
* 描述政务数据资源是否属于电子证照。
*/
@ApiModelProperty("描述政务数据资源是否属于电子证照。")
private Integer ifLicense;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.entity;
import java.util.Date;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
* 系统资源信息表(InfoSystem)实体类
*
* @author makejava
* @since 2021-08-19 11:28:37
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "info_system")
public class InfoSystem {
/**
* 自增
*/
@ApiModelProperty("自增")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 系统名称
*/
@ApiModelProperty("系统名称")
private String systemName;
/**
* 归属部门id
*/
@ApiModelProperty("归属部门id")
private Long belongDeptId;
/**
* 信息系统分类:分为1政务服务业务办理系统、2执法监管系统、3共享交换平台、4办公OA、5视频会商系统、6监控系统、7热线系统、8财务系统、9人事系统、10政府网站。
*/
@ApiModelProperty("信息系统分类:分为1政务服务业务办理系统、2执法监管系统、3共享交换平台、4办公OA、5视频会商系统、6监控系统、7热线系统、8财务系统、9人事系统、10政府网站。")
private Integer systemType;
/**
* 信息系统所属层级:分为1国垂、2区垂、3市垂。
*/
@ApiModelProperty("信息系统所属层级:分为1国垂、2区垂、3市垂。")
private Integer systemLevelType;
/**
* 覆盖层级:分为1自治区级、2自治区/市两级、3自治区/市/县三级、4自治区/市/县/乡四级、自治区/市/县/乡/村五级。
*/
@ApiModelProperty("覆盖层级:分为1自治区级、2自治区/市两级、3自治区/市/县三级、4自治区/市/县/乡四级、自治区/市/县/乡/村五级。")
private Integer coverLevelType;
/**
* 接入网络:分为电1子政务外网、2电子政务内网、3互联网、4业务专网。
*/
@ApiModelProperty("接入网络:分为电1子政务外网、2电子政务内网、3互联网、4业务专网。")
private Integer networkType;
/**
* 运行状态: 分为在用、停用、在建。
*/
@ApiModelProperty("运行状态: 分为在用、停用、在建。")
private Integer runStatus;
/**
* 云类别分为1政务云、2行业云、市云、3阿里云、4腾讯云、5华为云。
*/
@ApiModelProperty("云类别分为1政务云、2行业云、市云、3阿里云、4腾讯云、5华为云。")
private Integer cloudType;
/**
* 云名称
*/
@ApiModelProperty("云名称")
private String cloudName;
/**
* 机房(数据中心)建设方式,建设方式分为1自建、2租用。
*/
@ApiModelProperty("机房(数据中心)建设方式,建设方式分为1自建、2租用。")
private Integer computerRoomType;
/**
* 机房名称
*/
@ApiModelProperty("机房名称")
private String computerRoomName;
/**
* 数据库类型分为1mysql、2oracle、3sqlserver、4Memcached、5Redis、6MongoDB、7达梦、8人大金仓、9其他。
*/
@ApiModelProperty("数据库类型分为1mysql、2oracle、3sqlserver、4Memcached、5Redis、6MongoDB、7达梦、8人大金仓、9其他。")
private Integer databaseType;
/**
* 数据库名称
*/
@ApiModelProperty("数据库名称")
private String databaseName;
/**
* 系统对应的数据库数量
*/
@ApiModelProperty("系统对应的数据库数量")
private Integer databaseQuantity;
/**
* 数据库部署方式: 1分为集群、2分布式、3集中式。
*/
@ApiModelProperty("数据库部署方式: 1分为集群、2分布式、3集中式。")
private Integer databaseDeploymentType;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.entity;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 机构表(OrgDept)实体类
*
* @author makejava
* @since 2021-08-19 11:28:38
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "org_dept")
public class OrgDept {
/**
* 自增
*/
@ApiModelProperty("自增")
@TableId(type = IdType.AUTO)
private Long id;
/**
* 上级机构id
*/
@ApiModelProperty("上级机构id")
private Long parentId;
/**
* 机构(部门)名称
*/
@ApiModelProperty("机构(部门)名称")
private String deptName;
/**
* 机构类型:1 业务处室 2二层机构 3二层机构业务科室
*/
@ApiModelProperty("机构类型:1 业务处室 2二层机构 3二层机构业务科室")
private Integer deptType;
/**
* 行政区域编号
*/
@ApiModelProperty("行政区域编号")
private String areaCode;
/**
* 地址
*/
@ApiModelProperty("地址")
private String address;
/**
* 联系电话
*/
@ApiModelProperty("联系电话")
private String tel;
/**
* 编制(人员数量)
*/
@ApiModelProperty("编制(人员数量)")
private Integer totalOrgStaff;
/**
* 在编(人员数量)
*/
@ApiModelProperty("在编(人员数量)")
private Integer currOrgStaff;
/**
* 主要职责
*/
@ApiModelProperty("主要职责")
private String responsibility;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.entity;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
/**
* 行政区域信息表(SystemArea)实体类
*
* @author makejava
* @since 2021-08-19 15:09:48
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
@TableName(value = "system_area")
public class SystemArea {
/**
* 区域唯一标识
*/
@ApiModelProperty("区域唯一标识")
@TableId
private String id;
/**
* 区域名称
*/
@ApiModelProperty("区域名称")
private String name;
/**
* 区域编码
*/
@ApiModelProperty("区域编码")
private String code;
/**
* 类型 1:省级、2:市级、3:区县级、4:街道 5村级
*/
@ApiModelProperty("类型 1:省级、2:市级、3:区县级、4:街道 5村级")
private String type;
/**
* 上级区域ID
*/
@ApiModelProperty("上级区域ID")
private String parentId;
}
\ No newline at end of file
lombok.equalsAndHashCode.callSuper=call
\ No newline at end of file
package com.zq.resource.service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.resource.dao.SystemAreaDao;
import com.zq.resource.entity.SystemArea;
import com.zq.resource.utils.TreeUtils;
import com.zq.resource.vo.DataTreeVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author wilmiam
* @since 2021/8/19 14:52
*/
@Service
@RequiredArgsConstructor
public class AreaService {
private final SystemAreaDao systemAreaDao;
public List<DataTreeVo> areaTree() {
List<SystemArea> areaList = systemAreaDao.selectList(Wrappers.lambdaQuery(SystemArea.class).in(SystemArea::getType, "2", "3", "4"));
List<DataTreeVo> collect = areaList.stream().map(systemArea -> DataTreeVo.builder()
.id(systemArea.getId())
.parentId(systemArea.getParentId())
.name(systemArea.getName())
.childList(new ArrayList<>())
.build()).collect(Collectors.toList());
return TreeUtils.buildTree(collect, "450000000000");
}
public List<SystemArea> areaList(SystemArea vo) {
return systemAreaDao.selectList(Wrappers.lambdaQuery(vo));
}
}
package com.zq.resource.service;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.resource.dao.DataCategoryDao;
import com.zq.resource.entity.DataCategory;
import com.zq.resource.vo.DataCategoryFindVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
/**
* @author wilmiam
* @since 2021/8/19 16:47
*/
@Service
@RequiredArgsConstructor
public class CategoryService {
private final DataCategoryDao dataCategoryDao;
public PageVo<DataCategory> getCategoryList(DataCategoryFindVo vo) {
LambdaQueryWrapper<DataCategory> lambdaQuery = Wrappers.lambdaQuery(DataCategory.class);
if (StringUtils.isNotBlank(vo.getCategoryName())) {
lambdaQuery.like(DataCategory::getCategoryName, vo.getCategoryName());
vo.setCategoryName(null);
}
return PagingUtils.paging(vo, dataCategoryDao, DataCategory.class, lambdaQuery);
}
public void addCategory(DataCategory vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
dataCategoryDao.insert(vo);
}
public void modifyCategory(DataCategory vo) {
DataCategory dataCategory = dataCategoryDao.selectById(vo.getId());
AssertUtils.notNull(dataCategory, "无此目录");
dataCategory.setCategoryName(vo.getCategoryName());
dataCategory.setSourceType(vo.getSourceType());
dataCategory.setSecurityType(vo.getSecurityType());
dataCategory.setShareType(vo.getShareType());
dataCategory.setLevelType(vo.getLevelType());
dataCategory.setLoadType(vo.getLoadType());
dataCategory.setUpdateTime(DateUtil.date());
dataCategoryDao.updateById(dataCategory);
}
}
package com.zq.resource.service;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.StringUtils;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.resource.dao.OrgDeptDao;
import com.zq.resource.entity.OrgDept;
import com.zq.resource.utils.TreeUtils;
import com.zq.resource.vo.OrgDeptFindVo;
import com.zq.resource.vo.DataTreeVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author wilmiam
* @since 2021/8/19 14:37
*/
@Service
@RequiredArgsConstructor
public class DeptService {
private final OrgDeptDao orgDeptDao;
/**
* 获取部门列表
*
* @param vo
* @return
*/
public PageVo<OrgDept> getDeptList(OrgDeptFindVo vo) {
LambdaQueryWrapper<OrgDept> lambdaQuery = Wrappers.lambdaQuery(OrgDept.class);
if (StringUtils.isNotBlank(vo.getDeptName())) {
lambdaQuery.like(OrgDept::getDeptName, vo.getDeptName());
vo.setDeptName(null);
}
if (StringUtils.isNotBlank(vo.getAddress())) {
lambdaQuery.like(OrgDept::getAddress, vo.getAddress());
vo.setAddress(null);
}
if (StringUtils.isNotBlank(vo.getTel())) {
lambdaQuery.like(OrgDept::getTel, vo.getTel());
vo.setTel(null);
}
return PagingUtils.paging(vo, orgDeptDao, OrgDept.class, lambdaQuery);
}
public List<OrgDept> getDeptByPid(Long parentId) {
return orgDeptDao.selectList(Wrappers.lambdaQuery(OrgDept.builder().parentId(parentId).build()));
}
/**
* 添加部门
*
* @param vo
*/
public void addDept(OrgDept vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
orgDeptDao.insert(vo);
}
/**
* 修改部门
*
* @param vo
*/
public void modifyDept(OrgDept vo) {
OrgDept orgDept = orgDeptDao.selectById(vo.getId());
AssertUtils.notNull(orgDept, "无此机构");
orgDept.setParentId(vo.getParentId());
orgDept.setDeptName(vo.getDeptName());
orgDept.setDeptType(vo.getDeptType());
orgDept.setAreaCode(vo.getAreaCode());
orgDept.setAddress(vo.getAddress());
orgDept.setTel(vo.getTel());
orgDept.setTotalOrgStaff(vo.getTotalOrgStaff());
orgDept.setCurrOrgStaff(vo.getCurrOrgStaff());
orgDept.setResponsibility(vo.getResponsibility());
orgDept.setUpdateTime(DateUtil.date());
orgDeptDao.updateById(orgDept);
}
public Object getDeptTree() {
List<OrgDept> deptList = orgDeptDao.selectList(null);
List<DataTreeVo> collect = deptList.stream().map(dept -> DataTreeVo.builder()
.id(String.valueOf(dept.getId()))
.name(dept.getDeptName())
.parentId(String.valueOf(dept.getParentId()))
.childList(new ArrayList<>())
.build()).collect(Collectors.toList());
return TreeUtils.buildTree(collect, "0");
}
}
package com.zq.resource.service;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.resource.dao.DataDictDao;
import com.zq.resource.entity.DataDict;
import com.zq.resource.vo.DataDictFindVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* @author wilmiam
* @since 2021/8/20 9:30
*/
@Service
@RequiredArgsConstructor
public class DictService {
private final DataDictDao dataDictDao;
public PageVo<DataDict> getDictList(DataDictFindVo vo) {
LambdaQueryWrapper<DataDict> lambdaQuery = Wrappers.lambdaQuery(DataDict.class);
if (StringUtils.isNotBlank(vo.getType())) {
lambdaQuery.like(DataDict::getType, vo.getType());
vo.setType(null);
}
if (StringUtils.isNotBlank(vo.getTypeDesc())) {
lambdaQuery.like(DataDict::getTypeDesc, vo.getTypeDesc());
vo.setTypeDesc(null);
}
if (StringUtils.isNotBlank(vo.getCodeDesc())) {
lambdaQuery.like(DataDict::getCodeDesc, vo.getCodeDesc());
vo.setCodeDesc(null);
}
return PagingUtils.paging(vo, dataDictDao, DataDict.class, lambdaQuery);
}
public void addDict(DataDict vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
dataDictDao.insert(vo);
}
public void modifyDict(DataDict vo) {
DataDict dataDict = dataDictDao.selectById(vo.getId());
AssertUtils.notNull(dataDict, "无此字典");
dataDict.setType(vo.getType());
dataDict.setTypeDesc(vo.getTypeDesc());
dataDict.setCode(vo.getCode());
dataDict.setCodeDesc(vo.getCodeDesc());
dataDict.setSortNo(vo.getSortNo());
dataDict.setUpdateTime(DateUtil.date());
dataDictDao.updateById(dataDict);
}
}
package com.zq.resource.service;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.resource.dao.GovAffairItemDao;
import com.zq.resource.entity.GovAffairItem;
import com.zq.resource.vo.GovAffairItemFindVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* @author wilmiam
* @since 2021/8/20 10:04
*/
@Service
@RequiredArgsConstructor
public class GovAffairService {
private final GovAffairItemDao govAffairItemDao;
public PageVo<GovAffairItem> getGovAffairList(GovAffairItemFindVo vo) {
LambdaQueryWrapper<GovAffairItem> lambdaQuery = Wrappers.lambdaQuery(GovAffairItem.class);
if (StringUtils.isNotBlank(vo.getItemName())) {
lambdaQuery.like(GovAffairItem::getItemName, vo.getItemName());
vo.setItemName(null);
}
if (StringUtils.isNotBlank(vo.getItemCode())) {
lambdaQuery.like(GovAffairItem::getItemCode, vo.getItemCode());
vo.setItemCode(null);
}
if (StringUtils.isNotBlank(vo.getDocument())) {
lambdaQuery.like(GovAffairItem::getDocument, vo.getDocument());
vo.setDocument(null);
}
return PagingUtils.paging(vo, govAffairItemDao, GovAffairItem.class, lambdaQuery);
}
public void addGovAffair(GovAffairItem vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
govAffairItemDao.insert(vo);
}
public void modifyGovAffair(GovAffairItem vo) {
GovAffairItem govAffairItem = govAffairItemDao.selectById(vo.getId());
AssertUtils.notNull(govAffairItem, "无此服务事项");
govAffairItem.setDeptId(vo.getDeptId());
govAffairItem.setAffairItemType(vo.getAffairItemType());
govAffairItem.setItemName(vo.getItemName());
govAffairItem.setItemCode(vo.getItemCode());
govAffairItem.setDocument(vo.getDocument());
govAffairItem.setUpdateTime(DateUtil.date());
govAffairItemDao.updateById(govAffairItem);
}
}
package com.zq.resource.service;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.resource.dao.GovMonitorItemDao;
import com.zq.resource.entity.GovMonitorItem;
import com.zq.resource.vo.GovMonitorItemFindVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* @author wilmiam
* @since 2021/8/20 11:07
*/
@Service
@RequiredArgsConstructor
public class GovMonitorService {
private final GovMonitorItemDao govMonitorItemDao;
public PageVo<GovMonitorItem> getGovMonitorList(GovMonitorItemFindVo vo) {
LambdaQueryWrapper<GovMonitorItem> lambdaQuery = Wrappers.lambdaQuery(GovMonitorItem.class);
if (StringUtils.isNotBlank(vo.getItemName())) {
lambdaQuery.like(GovMonitorItem::getItemName, vo.getItemName());
vo.setItemName(null);
}
if (StringUtils.isNotBlank(vo.getSubItemName())) {
lambdaQuery.like(GovMonitorItem::getSubItemName, vo.getSubItemName());
vo.setSubItemName(null);
}
if (StringUtils.isNotBlank(vo.getMainItemCode())) {
lambdaQuery.like(GovMonitorItem::getMainItemCode, vo.getMainItemCode());
vo.setMainItemCode(null);
}
return PagingUtils.paging(vo, govMonitorItemDao, GovMonitorItem.class, lambdaQuery);
}
public void addGovMonitor(GovMonitorItem vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
govMonitorItemDao.insert(vo);
}
public void modifyGovMonitor(GovMonitorItem vo) {
GovMonitorItem govMonitorItem = govMonitorItemDao.selectById(vo.getId());
AssertUtils.notNull(govMonitorItem, "无此监管事项");
govMonitorItem.setDeptId(vo.getDeptId());
govMonitorItem.setMonitorItemType(vo.getMonitorItemType());
govMonitorItem.setItemName(vo.getItemName());
govMonitorItem.setSubItemName(vo.getSubItemName());
govMonitorItem.setMainItemCode(vo.getMainItemCode());
govMonitorItem.setUpdateTime(DateUtil.date());
govMonitorItemDao.updateById(govMonitorItem);
}
}
package com.zq.resource.service;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.resource.dao.InfoMetadataDao;
import com.zq.resource.entity.InfoMetadata;
import com.zq.resource.vo.InfoMetadataFindVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* @author wilmiam
* @since 2021/8/20 11:23
*/
@Service
@RequiredArgsConstructor
public class MetadataService {
private final InfoMetadataDao infoMetadataDao;
public PageVo<InfoMetadata> getMetadataList(InfoMetadataFindVo vo) {
LambdaQueryWrapper<InfoMetadata> lambdaQuery = Wrappers.lambdaQuery(InfoMetadata.class);
if (StringUtils.isNotBlank(vo.getMetaName())) {
lambdaQuery.like(InfoMetadata::getMetaName, vo.getMetaName());
vo.setMetaName(null);
}
if (StringUtils.isNotBlank(vo.getDataItemName())) {
lambdaQuery.like(InfoMetadata::getDataItemName, vo.getDataItemName());
vo.setDataItemName(null);
}
if (StringUtils.isNotBlank(vo.getGovDataCode())) {
lambdaQuery.like(InfoMetadata::getGovDataCode, vo.getGovDataCode());
vo.setGovDataCode(null);
}
return PagingUtils.paging(vo, infoMetadataDao, InfoMetadata.class, lambdaQuery);
}
public void addMetadata(InfoMetadata vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
infoMetadataDao.insert(vo);
}
public void modifyMetadata(InfoMetadata vo) {
InfoMetadata infoMetadata = infoMetadataDao.selectById(vo.getId());
AssertUtils.notNull(infoMetadata, "无此元数据");
infoMetadata.setMetaName(vo.getMetaName());
infoMetadata.setBelongCategoryId(vo.getBelongCategoryId());
infoMetadata.setFormatType(vo.getFormatType());
infoMetadata.setDataItemName(vo.getDataItemName());
infoMetadata.setShareType(vo.getShareType());
infoMetadata.setShareOption(vo.getShareOption());
infoMetadata.setShareCondition(vo.getShareCondition());
infoMetadata.setShareMode(vo.getShareMode());
infoMetadata.setOpenOption(vo.getOpenOption());
infoMetadata.setUpdateCycle(vo.getUpdateCycle());
infoMetadata.setDataType(vo.getDataType());
infoMetadata.setIssueDate(vo.getIssueDate());
infoMetadata.setGovDataCode(vo.getGovDataCode());
infoMetadata.setIfLicense(vo.getIfLicense());
infoMetadataDao.updateById(infoMetadata);
}
}
package com.zq.resource.service;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.resource.dao.InfoSystemDao;
import com.zq.resource.entity.InfoSystem;
import com.zq.resource.vo.InfoSystemFindVo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;
/**
* @author wilmiam
* @since 2021/8/20 11:40
*/
@Service
@RequiredArgsConstructor
public class SystemService {
private final InfoSystemDao infoSystemDao;
public PageVo<InfoSystem> getSystemList(InfoSystemFindVo vo) {
LambdaQueryWrapper<InfoSystem> lambdaQuery = Wrappers.lambdaQuery(InfoSystem.class);
if (StringUtils.isNotBlank(vo.getSystemName())) {
lambdaQuery.like(InfoSystem::getSystemName, vo.getSystemName());
vo.setSystemName(null);
}
if (StringUtils.isNotBlank(vo.getCloudName())) {
lambdaQuery.like(InfoSystem::getCloudName, vo.getCloudName());
vo.setCloudName(null);
}
if (StringUtils.isNotBlank(vo.getComputerRoomName())) {
lambdaQuery.like(InfoSystem::getComputerRoomName, vo.getComputerRoomName());
vo.setComputerRoomName(null);
}
if (StringUtils.isNotBlank(vo.getDatabaseName())) {
lambdaQuery.like(InfoSystem::getDatabaseName, vo.getDatabaseName());
vo.setDatabaseName(null);
}
return PagingUtils.paging(vo, infoSystemDao, InfoSystem.class, lambdaQuery);
}
public void addSystem(InfoSystem vo) {
vo.setCreateTime(DateUtil.date());
vo.setUpdateTime(DateUtil.date());
infoSystemDao.insert(vo);
}
public void modifySystem(InfoSystem vo) {
InfoSystem infoSystem = infoSystemDao.selectById(vo.getId());
AssertUtils.notNull(infoSystem, "无此系统");
infoSystem.setSystemName(vo.getSystemName());
infoSystem.setBelongDeptId(vo.getBelongDeptId());
infoSystem.setSystemType(vo.getSystemType());
infoSystem.setSystemLevelType(vo.getSystemLevelType());
infoSystem.setCoverLevelType(vo.getCoverLevelType());
infoSystem.setNetworkType(vo.getNetworkType());
infoSystem.setRunStatus(vo.getRunStatus());
infoSystem.setCloudType(vo.getCloudType());
infoSystem.setCloudName(vo.getCloudName());
infoSystem.setComputerRoomType(vo.getComputerRoomType());
infoSystem.setComputerRoomName(vo.getComputerRoomName());
infoSystem.setDatabaseType(vo.getDatabaseType());
infoSystem.setDatabaseName(vo.getDatabaseName());
infoSystem.setDatabaseQuantity(vo.getDatabaseQuantity());
infoSystem.setDatabaseDeploymentType(vo.getDatabaseDeploymentType());
infoSystem.setUpdateTime(DateUtil.date());
infoSystemDao.updateById(infoSystem);
}
}
package com.zq.resource.utils;
import com.zq.resource.vo.DataTreeVo;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
import java.util.stream.Collectors;
/**
* @author wilmiam
* @since 2021/8/20 10:27
*/
public class TreeUtils {
public static List<DataTreeVo> buildTree(List<DataTreeVo> treeDataList, String maxPid) {
Set<String> ids = new HashSet<>();
List<DataTreeVo> treeList = new ArrayList<>();
for (DataTreeVo treeData : treeDataList) {
if (maxPid.equals(treeData.getParentId())) {
treeList.add(treeData);
}
for (DataTreeVo it : treeDataList) {
if (treeData.getId().equals(it.getParentId())) {
if (treeData.getChildList() == null) {
treeData.setChildList(new ArrayList<>());
}
treeData.getChildList().add(it);
ids.add(it.getId());
}
}
}
if (treeList.size() == 0) {
treeList = treeDataList.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList());
}
return treeList;
}
}
package com.zq.resource.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 资源目录(DataCategory)实体类
*
* @author makejava
* @since 2021-08-19 11:28:34
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class DataCategoryFindVo extends PageReqVo {
/**
* 自增
*/
@ApiModelProperty("自增")
private Long id;
/**
* 目录名称
*/
@ApiModelProperty("目录名称")
private String categoryName;
/**
* 资源目录属性:分为1基础信息资源目录、2主题信息资源目录、3部门信息资源目录。
*/
@ApiModelProperty("资源目录属性:分为1基础信息资源目录、2主题信息资源目录、3部门信息资源目录。")
private Integer sourceType;
/**
* 数据资源涉密属性:分为1涉密政务数据资源目录和2非涉密政务数据资源目录。
*/
@ApiModelProperty("数据资源涉密属性:分为1涉密政务数据资源目录和2非涉密政务数据资源目录。")
private Integer securityType;
/**
* 共享类型:资源目录按共享类型分为1无条件共享、2有条件共享、3不予共享等三种类型
*/
@ApiModelProperty("共享类型:资源目录按共享类型分为1无条件共享、2有条件共享、3不予共享等三种类型")
private Integer shareType;
/**
* 层级属性:分为自治区级、自治区/市两级、自治区/市/县三级、自治区/市/县/乡四级、自治区/市/县/乡/村五级。
*/
@ApiModelProperty("层级属性:分为自治区级、自治区/市两级、自治区/市/县三级、自治区/市/县/乡四级、自治区/市/县/乡/村五级。")
private Integer levelType;
/**
* 资源挂载方式:分为库表、接口、文件三种方式。
*/
@ApiModelProperty("资源挂载方式:分为库表、接口、文件三种方式。")
private Integer loadType;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.user.vo;
package com.zq.resource.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* (TAppVersion)实体类
* 数据字典表(DataDict)实体类
*
* @author wilmiam
* @since 2021-03-02 09:44:35
* @author makejava
* @since 2021-08-19 11:28:35
*/
@Data
@EqualsAndHashCode(callSuper = true)
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class AppVersionPageReqVo extends PageReqVo {
public class DataDictFindVo extends PageReqVo {
/**
* ID
* 自增
*/
@ApiModelProperty("ID")
@ApiModelProperty("自增")
private Long id;
/**
* 版本号
* 类型代码,如:update_cycle
*/
@ApiModelProperty("版本号")
private String version;
@ApiModelProperty("类型代码,如:update_cycle")
private String type;
/**
* 安卓下载链接
* 类型描述,如:更新周期
*/
@ApiModelProperty("安卓下载链接")
private String androidLink;
@ApiModelProperty("类型描述,如:更新周期")
private String typeDesc;
/**
* iOS下载链接
* 代码:1
*/
@ApiModelProperty("iOS下载链接")
private String iosLink;
@ApiModelProperty("代码:1")
private Integer code;
/**
* 更新内容
* 代码描述:实时
*/
@ApiModelProperty("更新内容")
private String content;
@ApiModelProperty("代码描述:实时")
private String codeDesc;
/**
* 是否当前版本
* 排序号
*/
@ApiModelProperty("是否当前版本")
private Boolean isCurrentVersion;
@ApiModelProperty("排序号")
private Integer sortNo;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date createTime;
private Date updateTime;
}
}
\ No newline at end of file
package com.zq.resource.vo;
import io.swagger.annotations.ApiModel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
/**
* @author wilmiam
* @since 2021/8/19 15:23
*/
@ApiModel("树结构")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class DataTreeVo {
private String id;
private String parentId;
private String name;
private Integer childNum;
private List<DataTreeVo> childList;
}
package com.zq.resource.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 机构的政务服务事项表(GovAffairItem)实体类
*
* @author makejava
* @since 2021-08-19 11:28:35
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GovAffairItemFindVo extends PageReqVo {
/**
* 自增
*/
@ApiModelProperty("自增")
private Long id;
/**
* 机构id
*/
@ApiModelProperty("机构id")
private Long deptId;
/**
* 政务服务事项类型: 包括1行政许可、2行政确认、3行政裁决、4行政征收、5行政给付、6行政奖励、7其他行政权力、8公共服务。
*/
@ApiModelProperty("政务服务事项类型: 包括1行政许可、2行政确认、3行政裁决、4行政征收、5行政给付、6行政奖励、7其他行政权力、8公共服务。")
private Integer affairItemType;
/**
* 事项名称
*/
@ApiModelProperty("事项名称")
private String itemName;
/**
* 事项代码
*/
@ApiModelProperty("事项代码")
private String itemCode;
/**
* 办理材料名称
*/
@ApiModelProperty("办理材料名称")
private String document;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 机构的监管事项表(GovMonitorItem)实体类
*
* @author makejava
* @since 2021-08-19 11:28:36
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class GovMonitorItemFindVo extends PageReqVo {
/**
* 自增
*/
@ApiModelProperty("自增")
private Long id;
/**
* 机构id
*/
@ApiModelProperty("机构id")
private Long deptId;
/**
* 监管事项: 类型包括1行政检查、2行政强制、3行政处罚、4其他行政权力。
*/
@ApiModelProperty("监管事项: 类型包括1行政检查、2行政强制、3行政处罚、4其他行政权力。")
private Integer monitorItemType;
/**
* 事项名称
*/
@ApiModelProperty("事项名称")
private String itemName;
/**
* 子项名称
*/
@ApiModelProperty("子项名称")
private String subItemName;
/**
* 主项代码
*/
@ApiModelProperty("主项代码")
private String mainItemCode;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 资源元数据表(InfoMetadata)实体类
*
* @author makejava
* @since 2021-08-19 11:28:37
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class InfoMetadataFindVo extends PageReqVo {
/**
* 自增
*/
@ApiModelProperty("自增")
private Long id;
/**
* 元数据名称
*/
@ApiModelProperty("元数据名称")
private String metaName;
/**
* 归属资源目录id
*/
@ApiModelProperty("归属资源目录id")
private Long belongCategoryId;
/**
* 数据资源格式: 分为1电子文件、2电子表格、3数据库类、4图形图像类、5流媒体类、6接口类。
*/
@ApiModelProperty("数据资源格式: 分为1电子文件、2电子表格、3数据库类、4图形图像类、5流媒体类、6接口类。")
private Integer formatType;
/**
* 对结构化数据资源,描述其具体的信息项名称
*/
@ApiModelProperty("对结构化数据资源,描述其具体的信息项名称")
private String dataItemName;
/**
* 共享类型:资源目录按共享类型分为1无条件共享、2有条件共享、3不予共享等三种类型
*/
@ApiModelProperty("共享类型:资源目录按共享类型分为1无条件共享、2有条件共享、3不予共享等三种类型")
private Integer shareType;
/**
* 共享属性:对政务数据资源共享类型和条件的描述,包括共享类型、共享条件、共享方式。
*/
@ApiModelProperty("共享属性:对政务数据资源共享类型和条件的描述,包括共享类型、共享条件、共享方式。")
private String shareOption;
/**
* 共享条件:无条件共享类和有条件共享类的政务数据资源,应标明使用要求,包括作为行政依据、工作参考、业务协同等;有条件共享类的政务数据资源还应注明共享条件和共享范围;对于不予类的政务数据资源,应注明相关的法律、行政法规或党中央、国务院政策依据。
*/
@ApiModelProperty("共享条件:无条件共享类和有条件共享类的政务数据资源,应标明使用要求,包括作为行政依据、工作参考、业务协同等;有条件共享类的政务数据资源还应注明共享条件和共享范围;对于不予类的政务数据资源,应注明相关的法律、行政法规或党中央、国务院政策依据。")
private String shareCondition;
/**
* 共享方式:获取数据资源的方式。原则上应通过数据共享交换平台方式获取。确因条件所限可采用其他方式,如文件夹、纸质文档、电子文档等方式。
*/
@ApiModelProperty("共享方式:获取数据资源的方式。原则上应通过数据共享交换平台方式获取。确因条件所限可采用其他方式,如文件夹、纸质文档、电子文档等方式。")
private String shareMode;
/**
* 开放属性:对政务数据资源向社会开放,以及开放条件的描述,包括是否向社会开放、开放条件。
*/
@ApiModelProperty("开放属性:对政务数据资源向社会开放,以及开放条件的描述,包括是否向社会开放、开放条件。")
private String openOption;
/**
* 更新周期:数据资源更新的频度。分为1实时、2每日、3每周、4每月、5每季度、6每年等。
*/
@ApiModelProperty("更新周期:数据资源更新的频度。分为1实时、2每日、3每周、4每月、5每季度、6每年等。")
private Integer updateCycle;
/**
* 数据资源分类:描述数据资源的分类,包括所属领域、服务分类、以及标签分类。
*/
@ApiModelProperty("数据资源分类:描述数据资源的分类,包括所属领域、服务分类、以及标签分类。")
private String dataType;
/**
* 发布日期
*/
@ApiModelProperty("发布日期")
private Date issueDate;
/**
* 政务数据资源代码
*/
@ApiModelProperty("政务数据资源代码")
private String govDataCode;
/**
* 描述政务数据资源是否属于电子证照。
*/
@ApiModelProperty("描述政务数据资源是否属于电子证照。")
private Integer ifLicense;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 系统资源信息表(InfoSystem)实体类
*
* @author makejava
* @since 2021-08-19 11:28:37
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class InfoSystemFindVo extends PageReqVo {
/**
* 自增
*/
@ApiModelProperty("自增")
private Long id;
/**
* 系统名称
*/
@ApiModelProperty("系统名称")
private String systemName;
/**
* 归属部门id
*/
@ApiModelProperty("归属部门id")
private Long belongDeptId;
/**
* 信息系统分类:分为1政务服务业务办理系统、2执法监管系统、3共享交换平台、4办公OA、5视频会商系统、6监控系统、7热线系统、8财务系统、9人事系统、10政府网站。
*/
@ApiModelProperty("信息系统分类:分为1政务服务业务办理系统、2执法监管系统、3共享交换平台、4办公OA、5视频会商系统、6监控系统、7热线系统、8财务系统、9人事系统、10政府网站。")
private Integer systemType;
/**
* 信息系统所属层级:分为1国垂、2区垂、3市垂。
*/
@ApiModelProperty("信息系统所属层级:分为1国垂、2区垂、3市垂。")
private Integer systemLevelType;
/**
* 覆盖层级:分为1自治区级、2自治区/市两级、3自治区/市/县三级、4自治区/市/县/乡四级、自治区/市/县/乡/村五级。
*/
@ApiModelProperty("覆盖层级:分为1自治区级、2自治区/市两级、3自治区/市/县三级、4自治区/市/县/乡四级、自治区/市/县/乡/村五级。")
private Integer coverLevelType;
/**
* 接入网络:分为电1子政务外网、2电子政务内网、3互联网、4业务专网。
*/
@ApiModelProperty("接入网络:分为电1子政务外网、2电子政务内网、3互联网、4业务专网。")
private Integer networkType;
/**
* 运行状态: 分为在用、停用、在建。
*/
@ApiModelProperty("运行状态: 分为在用、停用、在建。")
private Integer runStatus;
/**
* 云类别分为1政务云、2行业云、市云、3阿里云、4腾讯云、5华为云。
*/
@ApiModelProperty("云类别分为1政务云、2行业云、市云、3阿里云、4腾讯云、5华为云。")
private Integer cloudType;
/**
* 云名称
*/
@ApiModelProperty("云名称")
private String cloudName;
/**
* 机房(数据中心)建设方式,建设方式分为1自建、2租用。
*/
@ApiModelProperty("机房(数据中心)建设方式,建设方式分为1自建、2租用。")
private Integer computerRoomType;
/**
* 机房名称
*/
@ApiModelProperty("机房名称")
private String computerRoomName;
/**
* 数据库类型分为1mysql、2oracle、3sqlserver、4Memcached、5Redis、6MongoDB、7达梦、8人大金仓、9其他。
*/
@ApiModelProperty("数据库类型分为1mysql、2oracle、3sqlserver、4Memcached、5Redis、6MongoDB、7达梦、8人大金仓、9其他。")
private Integer databaseType;
/**
* 数据库名称
*/
@ApiModelProperty("数据库名称")
private String databaseName;
/**
* 系统对应的数据库数量
*/
@ApiModelProperty("系统对应的数据库数量")
private Integer databaseQuantity;
/**
* 数据库部署方式: 1分为集群、2分布式、3集中式。
*/
@ApiModelProperty("数据库部署方式: 1分为集群、2分布式、3集中式。")
private Integer databaseDeploymentType;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
package com.zq.resource.vo;
import com.zq.common.vo.PageReqVo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* 机构表(OrgDept)实体类
*
* @author makejava
* @since 2021-08-19 11:28:38
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class OrgDeptFindVo extends PageReqVo {
/**
* 自增
*/
@ApiModelProperty("自增")
private Long id;
/**
* 上级机构id
*/
@ApiModelProperty("上级机构id")
private Long parentId;
/**
* 机构(部门)名称
*/
@ApiModelProperty("机构(部门)名称")
private String deptName;
/**
* 机构类型:1 业务处室 2二层机构 3二层机构业务科室
*/
@ApiModelProperty("机构类型:1 业务处室 2二层机构 3二层机构业务科室")
private Integer deptType;
/**
* 行政区域编号
*/
@ApiModelProperty("行政区域编号")
private String areaCode;
/**
* 地址
*/
@ApiModelProperty("地址")
private String address;
/**
* 联系电话
*/
@ApiModelProperty("联系电话")
private String tel;
/**
* 编制(人员数量)
*/
@ApiModelProperty("编制(人员数量)")
private Integer totalOrgStaff;
/**
* 在编(人员数量)
*/
@ApiModelProperty("在编(人员数量)")
private Integer currOrgStaff;
/**
* 主要职责
*/
@ApiModelProperty("主要职责")
private String responsibility;
/**
* 创建时间
*/
@ApiModelProperty("创建时间")
private Date createTime;
/**
* 更新时间
*/
@ApiModelProperty("更新时间")
private Date updateTime;
}
\ No newline at end of file
......@@ -33,6 +33,12 @@ spring:
username: ${jdbc.username}
password: ${jdbc.password}
driver-class-name: ${jdbc.driver-class-name}
resource:
type: com.alibaba.druid.pool.DruidDataSource
url: jdbc:mysql://47.107.148.253:3306/mz_resource?characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai
username: root
password: Dk2019!23456
driver-class-name: com.mysql.cj.jdbc.Driver
druid:
# 初始连接数
initial-size: 10
......
package com.zq.user.controller.app;
import com.zq.common.utils.AssertUtils;
import com.zq.common.utils.ValidateUtil;
import com.zq.common.vo.ApiTokenVo;
import com.zq.common.vo.ResultVo;
import com.zq.user.service.UserService;
import com.zq.user.vo.LoginVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@Api(tags = "用户相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/user/app/user")
public class UserController {
private final UserService userService;
@ApiOperation("发送验证码")
@GetMapping(value = "/sendCode")
public ResultVo sendCode(String phone) {
AssertUtils.hasText(phone, "手机号不能为空");
AssertUtils.isTrue(ValidateUtil.isMobilePhoneNo(phone), "手机号格式不正确");
userService.sendCode(phone);
return ResultVo.success();
}
@ApiOperation("重置登录密码")
@PostMapping(value = "/resetPassword")
public ResultVo resetPassword(@RequestBody LoginVo vo) {
AssertUtils.hasText(vo.getPhone(), "手机号不能为空");
AssertUtils.isTrue(ValidateUtil.isMobilePhoneNo(vo.getPhone()), "手机号格式不正确");
AssertUtils.hasText(vo.getVerifyCode(), "请输入验证码");
userService.resetPassword(vo);
return ResultVo.success();
}
@ApiOperation("修改登录密码")
@PostMapping(value = "/modifyPasswd")
public ResultVo modifyPasswd(@RequestBody LoginVo vo) {
AssertUtils.hasText(vo.getPhone(), "手机号不能为空");
AssertUtils.isTrue(ValidateUtil.isMobilePhoneNo(vo.getPhone()), "手机号格式不正确");
AssertUtils.hasText(vo.getVerifyCode(), "请输入验证码");
AssertUtils.hasText(vo.getPasswd(), "请输入密码");
userService.modifyPasswd(vo);
return ResultVo.success();
}
@ApiOperation("手机号登录")
@PostMapping(value = "/phoneLogin")
public ResultVo<ApiTokenVo> phoneLogin(@RequestBody LoginVo vo) {
AssertUtils.hasText(vo.getPhone(), "手机号不能为空");
AssertUtils.hasText(vo.getVerifyCode(), "请输入验证码");
return ResultVo.success(userService.phoneLogin(vo));
}
@ApiOperation("密码登录")
@PostMapping(value = "/passwdLogin")
public ResultVo<ApiTokenVo> passwdLogin(@RequestBody LoginVo vo) {
AssertUtils.hasText(vo.getPhone(), "手机号不能为空");
AssertUtils.hasText(vo.getPasswd(), "请输入密码");
return ResultVo.success(userService.passwdLogin(vo));
}
}
package com.zq.user.controller.app;
import com.zq.common.entity.AppVersion;
import com.zq.common.vo.PageVo;
import com.zq.common.vo.ResultVo;
import com.zq.user.service.VersionService;
import com.zq.user.vo.AppVersionPageReqVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;
@Api(tags = "App版本相关接口")
@RequiredArgsConstructor
@RestController
@RequestMapping(value = "/user/app/version")
public class VersionController {
private final VersionService versionService;
@ApiOperation("获取最新版本")
@GetMapping("/getAppVersion")
public ResultVo<AppVersion> getAppVersion(@RequestParam String appName) {
return ResultVo.success(versionService.getVersion(appName));
}
@ApiOperation("获取版本号列表")
@PostMapping("/getAppVersionList")
public ResultVo<PageVo<AppVersion>> getAppVersionList(@RequestBody AppVersionPageReqVo vo) {
return ResultVo.success(versionService.getAppVersionList(vo));
}
@ApiOperation("添加版本号")
@PostMapping("/addVersion")
public ResultVo addVersion(@RequestBody AppVersion vo) {
versionService.addVersion(vo);
return ResultVo.success();
}
}
package com.zq.user.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.entity.AppVersion;
import org.springframework.stereotype.Repository;
/**
* (TAppVersion)表数据库访问层
*
* @author wilmiam
* @since 2021-03-02 09:44:35
*/
@Repository
public interface AppVersionDao extends BaseMapper<AppVersion> {
}
package com.zq.user.dao;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.zq.common.entity.AppUser;
import org.springframework.stereotype.Repository;
/**
* 用户表(TMember)表数据库访问层
*
* @author wilmiam
* @since 2021-04-14 15:12:38
*/
@Repository
public interface UserDao extends BaseMapper<AppUser> {
}
package com.zq.user.manager;
public abstract class CacheKeys {
public static final long APP_TOKEN_EXPIRE_MINUTES = 60 * 24 * 2;
public static final String PREFIX = "wine.";
private static final String AUTH_CODE = PREFIX + "auth-code.";
private static final String APP_TOKEN = PREFIX + "app-token.";
private static final String ADMIN_TOKEN = PREFIX + "admin-token.";
private static final String LIVE_ADMIN_TOKEN = PREFIX + "live-admin-token.";
private static final String LIVE_APP_TOKEN = PREFIX + "live-app-token.";
/**
* 构建手机验证码的缓存key
*
* @param phone 手机号码
* @return
*/
public static String authCodeKey(String phone) {
return AUTH_CODE + phone;
}
/**
* 构建app端用户token的缓存key
*
* @param token app登陆后的token
* @return
*/
public static String appTokenKey(String token) {
return APP_TOKEN + token;
}
/**
* 用户当前apptoken的缓存key
*
* @param memberId
* @return
*/
public static String liveAppTokenKey(Long memberId) {
return LIVE_APP_TOKEN + memberId;
}
}
package com.zq.user.service;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.IdcardUtil;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.extra.servlet.ServletUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.config.redis.RedisUtils;
import com.zq.common.config.security.ApiTokenUtils;
import com.zq.common.entity.*;
import com.zq.common.http.HttpRequestUtils;
import com.zq.common.utils.AssertUtils;
import com.zq.common.vo.ApiTokenVo;
import com.zq.user.dao.*;
import com.zq.user.manager.CacheKeys;
import com.zq.user.utils.MobileSmsUtils;
import com.zq.user.vo.LoginVo;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.lang3.StringUtils;
import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service;
import org.springframework.util.DigestUtils;
@Slf4j
@Service
@RequiredArgsConstructor
public class UserService {
private final UserDao userDao;
private final PfuserDao pfuserDao;
private final PasswordEncoder passwordEncoder;
private final SysUserDao sysUserDao;
private final SysUsersJobsDao sysUsersJobsDao;
private final SysUsersRolesDao sysUsersRolesDao;
private final RedisUtils redisUtils;
/**
* 发送手机验证码
*
* @param phone
*/
public void sendCode(String phone) {
AppUser appUser = userDao.selectOne(Wrappers.lambdaQuery(AppUser.builder().phone(phone).build()));
if (appUser == null) {
Pfuser pfuser = pfuserDao.selectOne(Wrappers.lambdaQuery(Pfuser.builder().phone(phone).build()));
AssertUtils.notNull(pfuser, "手机号不存在");
}
String code = RandomUtil.randomNumbers(6);
// code = "111111";
String content = "您的验证码为:" + code + "(5分钟内有效)。为了保障信息安全,如非本人操作请忽略本短信。";
boolean sendMsg = MobileSmsUtils.sendMsg(phone, content);
log.info(">> phone: {}, sendCode: {}, success: {}", phone, code, sendMsg);
redisUtils.setStr(CacheKeys.authCodeKey(phone), code, 5);
}
/**
* 重置密码
*
* @param vo
*/
public void resetPassword(LoginVo vo) {
verificationCode(vo.getPhone(), vo.getVerifyCode());
AppUser appUser = userDao.selectOne(Wrappers.lambdaQuery(AppUser.builder().phone(vo.getPhone()).build()));
if (appUser == null) {
appUser = addUser(vo.getPhone());
}
AssertUtils.notNull(appUser, "手机号不存在");
appUser.setPassword(DigestUtils.md5DigestAsHex(vo.getPasswd().getBytes()));
userDao.updateById(appUser);
}
public ApiTokenVo phoneLogin(LoginVo vo) {
AppUser appUser = userDao.selectOne(Wrappers.lambdaQuery(AppUser.builder().phone(vo.getPhone()).build()));
if (appUser == null) {
appUser = addUser(vo.getPhone());
}
AssertUtils.notNull(appUser, "手机号不存在");
verificationCode(vo.getPhone(), vo.getVerifyCode());
AssertUtils.isTrue(appUser.getStatus() == 0, appUser.getStatus() == 1 ? "账号已冻结" : "账号已删除");
appUser.setAccessIp(ServletUtil.getClientIP(HttpRequestUtils.getRequest()));
appUser.setLastLoginTime(DateUtil.date());
userDao.updateById(appUser);
return getApiToken(appUser);
}
public ApiTokenVo passwdLogin(LoginVo vo) {
AppUser appUser = userDao.selectOne(Wrappers.lambdaQuery(AppUser.builder().phone(vo.getPhone()).build()));
AssertUtils.notNull(appUser, "手机号不存在");
AssertUtils.hasText(appUser.getPassword(), "未设置密码");
AssertUtils.isTrue(DigestUtils.md5DigestAsHex(vo.getPasswd().getBytes()).equals(appUser.getPassword()), "密码错误");
AssertUtils.isTrue(appUser.getStatus() == 0, appUser.getStatus() == 1 ? "账号已冻结" : "账号已删除");
appUser.setAccessIp(ServletUtil.getClientIP(HttpRequestUtils.getRequest()));
appUser.setLastLoginTime(DateUtil.date());
userDao.updateById(appUser);
return getApiToken(appUser);
}
private AppUser addUser(String phone) {
Pfuser pfuser = pfuserDao.selectOne(Wrappers.lambdaQuery(Pfuser.builder().phone(phone).build()));
if (pfuser == null) {
return null;
}
AppUser appUser = AppUser.builder()
.name(pfuser.getUsername())
.age(pfuser.getSex().intValue())
.phone(pfuser.getPhone())
// .password(DigestUtils.md5DigestAsHex("gxmz!23".getBytes()))
.userType(pfuser.getType().intValue())
.age(StrUtil.isBlank(pfuser.getIdcardno()) ? 0 : IdcardUtil.getAgeByIdCard(pfuser.getIdcardno()))
.status(pfuser.getState().intValue())
.build();
userDao.insert(appUser);
SysUser sysUser = sysUserDao.selectOne(Wrappers.lambdaQuery(SysUser.builder().username(phone).build()));
if (sysUser == null) {
sysUser = SysUser.builder()
.deptId(8L)
.username(phone)
.nickName(pfuser.getUsername())
// 0为男1为女
.gender(pfuser.getSex() == null ? "未知" : pfuser.getSex() == 0 ? "男" : "女")
.phone(phone)
.email(pfuser.getSourcemail())
.password(passwordEncoder.encode("gxmz!23"))
.isAdmin(false)
.enabled(1L)
.createBy("admin")
.updateBy("admin")
.createTime(DateUtil.date())
.updateTime(DateUtil.date())
.build();
sysUserDao.insert(sysUser);
sysUsersJobsDao.insert(SysUsersJobs.builder().userId(sysUser.getUserId()).jobId(13L).build());
sysUsersRolesDao.insert(SysUsersRoles.builder().userId(sysUser.getUserId()).roleId(2L).build());
}
return appUser;
}
/**
* 判断验证码
*
* @param phone
* @param code
*/
public void verificationCode(String phone, String code) {
String cacheCode = redisUtils.getStr(CacheKeys.authCodeKey(phone));
AssertUtils.isTrue(StringUtils.isNotBlank(cacheCode) && cacheCode.equalsIgnoreCase(code), "验证码错误");
redisUtils.deleteStr(CacheKeys.authCodeKey(phone));
}
private ApiTokenVo getApiToken(AppUser appUser) {
ApiTokenVo tokenVo = ApiTokenVo.builder()
.userId(appUser.getId())
.phone(appUser.getPhone())
.name(appUser.getName())
.nickname(appUser.getNickname())
.sex(appUser.getSex())
.age(appUser.getAge())
.avatar(appUser.getAvatar())
.userType(appUser.getUserType())
.build();
String token = ApiTokenUtils.createToken(tokenVo, CacheKeys.APP_TOKEN_EXPIRE_MINUTES);
tokenVo.setToken(token);
// 缓存登录用户
redisUtils.setObj(CacheKeys.appTokenKey(token), tokenVo, CacheKeys.APP_TOKEN_EXPIRE_MINUTES);
// 重新登录删除前一个token实现单点登录
redisUtils.deleteStr(CacheKeys.liveAppTokenKey(appUser.getId()));
// 限制同一时间同一帐号只能在一个设备上登录
redisUtils.setStr(CacheKeys.liveAppTokenKey(appUser.getId()), token, CacheKeys.APP_TOKEN_EXPIRE_MINUTES);
return tokenVo;
}
/**
* 修改密码
*
* @param vo
*/
public void modifyPasswd(LoginVo vo) {
verificationCode(vo.getPhone(), vo.getVerifyCode());
AppUser appUser = userDao.selectOne(Wrappers.lambdaQuery(AppUser.builder().phone(vo.getPhone()).build()));
AssertUtils.notNull(appUser, "无此用户");
appUser.setPassword(DigestUtils.md5DigestAsHex(vo.getPasswd().getBytes()));
userDao.updateById(appUser);
}
}
package com.zq.user.service;
import cn.hutool.core.date.DateUtil;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.zq.common.entity.AppVersion;
import com.zq.common.utils.PagingUtils;
import com.zq.common.vo.PageVo;
import com.zq.user.dao.AppVersionDao;
import com.zq.user.vo.AppVersionPageReqVo;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class VersionService {
private final AppVersionDao appVersionDao;
public AppVersion getVersion(String appName) {
return appVersionDao.selectOne(Wrappers.lambdaQuery(AppVersion.builder().appName(appName).isCurrentVersion(true).build()));
}
public PageVo<AppVersion> getAppVersionList(AppVersionPageReqVo vo) {
return PagingUtils.paging(vo, appVersionDao, AppVersion.class);
}
public void addVersion(AppVersion vo) {
appVersionDao.update(AppVersion.builder().isCurrentVersion(false).build(), Wrappers.lambdaUpdate(AppVersion.builder().build()));
vo.setIsCurrentVersion(true);
vo.setCreateTime(DateUtil.date());
appVersionDao.insert(vo);
}
}
package com.zq.user.utils;
import com.alibaba.fastjson.JSON;
import lombok.Data;
import org.apache.commons.codec.binary.Base64;
import org.springframework.util.DigestUtils;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.net.URL;
import java.net.URLConnection;
import java.nio.charset.StandardCharsets;
public class MobileSmsUtils {
/**
* 账号
*/
private static String apId = "sjfx";
/**
* 密码
*/
private static String secretKey = "Shujufenxi!2345";
/**
* 集团名称
*/
private static String ecName = "广西壮族自治区民政厅";
/**
* 网关签名编码
*/
private static String sign = "nMbQzvoRh";
/**
* 拓展码(可以为空)
*/
private static String addSerial = "";
/**
* url
*/
private static String url = "http://112.35.1.155:1992/sms/norsubmit";
/**
* 多用户发送短信信息
*
* @param mobiles 手机号码逗号分隔
* @param content 短信内容
* @return 返回1表示成功,0表示失败
*/
public static boolean sendMsg(String mobiles, String content) {
SendReq sendReq = new SendReq();
sendReq.setApId(apId);
sendReq.setEcName(ecName);
sendReq.setSecretKey(secretKey);
sendReq.setContent(content);
sendReq.setMobiles(mobiles);
sendReq.setAddSerial(addSerial);
sendReq.setSign(sign);
String stringBuffer = sendReq.getEcName() +
sendReq.getApId() +
sendReq.getSecretKey() +
sendReq.getMobiles() +
sendReq.getContent() +
sendReq.getSign() +
sendReq.getAddSerial();
sendReq.setMac(DigestUtils.md5DigestAsHex(stringBuffer.getBytes()).toLowerCase());
String reqText = JSON.toJSONString(sendReq);
// BASE64编码
String encode = Base64.encodeBase64String(reqText.getBytes(StandardCharsets.UTF_8));
// System.out.println(encode);
String resStr = sendPost(url, encode);
// System.out.println("发送短信结果:" + resStr);
SendRes sendRes = JSON.parseObject(resStr, SendRes.class);
return sendRes.getSuccess() && !"".equals(sendRes.getMsgGroup()) && "success".equals(sendRes.getRspcod());
}
/**
* main方法测试发送短信,返回1表示成功,0表示失败
*
* @param args
* @throws IOException
*/
public static void main(String[] args) throws IOException {
String msg = "这是发送短信的内容!";
sendMsg("15224553696", msg);
}
/**
* 向指定 URL 发送POST方法的请求
*
* @param url 发送请求的 URL
* @param param 请求参数
* @return 所代表远程资源的响应结果
*/
private static String sendPost(String url, String param) {
OutputStreamWriter out = null;
BufferedReader in = null;
StringBuilder result = new StringBuilder();
try {
URL realUrl = new URL(url);
URLConnection conn = realUrl.openConnection();
conn.setRequestProperty("accept", "*/*");
conn.setRequestProperty("contentType", "utf-8");
conn.setRequestProperty("connection", "Keep-Alive");
conn.setRequestProperty("user-agent", "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1)");
conn.setDoOutput(true);
conn.setDoInput(true);
out = new OutputStreamWriter(conn.getOutputStream());
out.write(param);
out.flush();
in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
String line;
while ((line = in.readLine()) != null) {
result.append("\n").append(line);
}
} catch (Exception e) {
e.printStackTrace();
} finally {
try {
if (out != null) {
out.close();
}
if (in != null) {
in.close();
}
} catch (IOException ex) {
ex.printStackTrace();
}
}
return result.toString();
}
@Data
public static class SendReq {
/**
* 集团客户名称
*/
private String ecName;
/**
* 用户名
*/
private String apId;
/**
* 密码
*/
private String secretKey;
/**
* 手机号码逗号分隔。(如“1813728****,1813728****,1813728****”)
*/
private String mobiles;
/**
* 发送短信内容
*/
private String content;
/**
* 网关签名编码,必填,签名编码在中国移动集团开通帐号后分配,可以在云MAS网页端管理子系统-SMS接口管理功能中下载。
*/
private String sign;
/**
* 扩展码,根据向移动公司申请的通道填写,如果申请的精确匹配通道,则填写空字符串(""),否则添加移动公司允许的扩展码。
*/
private String addSerial;
/**
* 按文档要求加密后的mac
*/
private String mac;
}
@Data
public static class SendRes {
/**
* 响应状态码
*/
private String rspcod;
/**
* 消息批次号,由云MAS平台生成,用于验证短信提交报告和状态报告的一致性(取值msgGroup)注:如果数据验证不通过msgGroup为空
*/
private String msgGroup;
/**
* 数据校验结果
*/
private Boolean success;
}
}
package com.zq.user.vo;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* 用户表(TMember)实体类
*
* @author wilmiam
* @since 2020-10-20 12:05:16
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class LoginVo {
private Long userId;
@ApiModelProperty("手机号")
private String phone;
@ApiModelProperty("验证码")
private String verifyCode;
private String passwd;
@ApiModelProperty("登录类型")
private String loginType;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment