Commit e351124f by 胡懿

对接平台数据

parent a7d3c72e
......@@ -30,4 +30,5 @@ public class ErrorInfo {
public static ErrorCode DEVICE_REQ_CONF_PARENT_IS_CHILD = new ErrorCode(22, "不能设置自己的子DeviceReqConf为父DeviceReqConf");
public static ErrorCode PT_DEPT_INFO_NOT_EXISTS = new ErrorCode(23, "平台部门不存在");
public static ErrorCode PT_USER_INFO_NOT_EXISTS = new ErrorCode(24, "平台用户不存在");
}
......@@ -59,13 +59,6 @@ public class DeviceLogInfoController {
}
@PostMapping("/initIllIotDBTable")
@Operation(summary = "初始设备访问时间序列")
public CommonResult<String> initIllIotDBTable() {
MyIotDbUtils.createDeviceLogInfoTimeseries(iotDbConfig);
MyIotDbUtils.createDeviceIllLogInfoTimeseries(iotDbConfig);
return CommonResult.success("初始化成功");
}
@GetMapping("/countDeviceIllLogInfo")
......
......@@ -94,4 +94,10 @@ public class DeviceReqConfController {
BeanUtils.toBean(list, DeviceReqConfRespVO.class));
}
@GetMapping("/syncPtUser")
@Operation(summary = "同步平台设备信息")
public CommonResult<String> syncPtDevice() {
return success(deviceReqConfService.syncPtDevice());
}
}
\ No newline at end of file
......@@ -33,7 +33,7 @@ import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 平台部门")
@RestController
@RequestMapping("/ptinfo/pt-dept-info")
@RequestMapping("/admin-api/ptinfo/pt-dept-info")
@Validated
public class PtDeptInfoController {
......@@ -94,4 +94,10 @@ public class PtDeptInfoController {
BeanUtils.toBean(list, PtDeptInfoRespVO.class));
}
@GetMapping("/syncPtDept")
@Operation(summary = "同步平台部门信息")
public CommonResult<String> syncPtDept() {
return success(ptDeptInfoService.syncPtDept());
}
}
\ No newline at end of file
package cn.gintone.controller;
import cn.gintone.controller.vo.PtUserInfoPageReqVO;
import cn.gintone.controller.vo.PtUserInfoRespVO;
import cn.gintone.controller.vo.PtUserInfoSaveReqVO;
import cn.gintone.entity.PtUserInfoDO;
import cn.gintone.service.PtUserInfoService;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.security.access.prepost.PreAuthorize;
import io.swagger.v3.oas.annotations.tags.Tag;
import io.swagger.v3.oas.annotations.Parameter;
import io.swagger.v3.oas.annotations.Operation;
import javax.validation.constraints.*;
import javax.validation.*;
import javax.servlet.http.*;
import java.util.*;
import java.io.IOException;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
import cn.iocoder.yudao.framework.excel.core.util.ExcelUtils;
import cn.iocoder.yudao.framework.apilog.core.annotation.ApiAccessLog;
import static cn.iocoder.yudao.framework.apilog.core.enums.OperateTypeEnum.*;
@Tag(name = "管理后台 - 平台用户")
@RestController
@RequestMapping("/admin-api/ptinfo/pt-user-info")
@Validated
public class PtUserInfoController {
@Resource
private PtUserInfoService ptUserInfoService;
@PostMapping("/create")
@Operation(summary = "创建平台用户")
@PreAuthorize("@ss.hasPermission('ptinfo:pt-user-info:create')")
public CommonResult<Long> createPtUserInfo(@Valid @RequestBody PtUserInfoSaveReqVO createReqVO) {
return success(ptUserInfoService.createPtUserInfo(createReqVO));
}
@PutMapping("/update")
@Operation(summary = "更新平台用户")
@PreAuthorize("@ss.hasPermission('ptinfo:pt-user-info:update')")
public CommonResult<Boolean> updatePtUserInfo(@Valid @RequestBody PtUserInfoSaveReqVO updateReqVO) {
ptUserInfoService.updatePtUserInfo(updateReqVO);
return success(true);
}
@DeleteMapping("/delete")
@Operation(summary = "删除平台用户")
@Parameter(name = "id", description = "编号", required = true)
@PreAuthorize("@ss.hasPermission('ptinfo:pt-user-info:delete')")
public CommonResult<Boolean> deletePtUserInfo(@RequestParam("id") Long id) {
ptUserInfoService.deletePtUserInfo(id);
return success(true);
}
@GetMapping("/get")
@Operation(summary = "获得平台用户")
@Parameter(name = "id", description = "编号", required = true, example = "1024")
@PreAuthorize("@ss.hasPermission('ptinfo:pt-user-info:query')")
public CommonResult<PtUserInfoRespVO> getPtUserInfo(@RequestParam("id") Long id) {
PtUserInfoDO ptUserInfo = ptUserInfoService.getPtUserInfo(id);
return success(BeanUtils.toBean(ptUserInfo, PtUserInfoRespVO.class));
}
@GetMapping("/page")
@Operation(summary = "获得平台用户分页")
@PreAuthorize("@ss.hasPermission('ptinfo:pt-user-info:query')")
public CommonResult<PageResult<PtUserInfoRespVO>> getPtUserInfoPage(@Valid PtUserInfoPageReqVO pageReqVO) {
PageResult<PtUserInfoDO> pageResult = ptUserInfoService.getPtUserInfoPage(pageReqVO);
return success(BeanUtils.toBean(pageResult, PtUserInfoRespVO.class));
}
@GetMapping("/export-excel")
@Operation(summary = "导出平台用户 Excel")
@PreAuthorize("@ss.hasPermission('ptinfo:pt-user-info:export')")
@ApiAccessLog(operateType = EXPORT)
public void exportPtUserInfoExcel(@Valid PtUserInfoPageReqVO pageReqVO,
HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<PtUserInfoDO> list = ptUserInfoService.getPtUserInfoPage(pageReqVO).getList();
// 导出 Excel
ExcelUtils.write(response, "平台用户.xls", "数据", PtUserInfoRespVO.class,
BeanUtils.toBean(list, PtUserInfoRespVO.class));
}
@GetMapping("/syncPtUser")
@Operation(summary = "同步平台部门信息")
public CommonResult<String> syncPtUser() {
return success(ptUserInfoService.syncPtUser());
}
}
\ No newline at end of file
......@@ -32,51 +32,29 @@ public class WebLogInfoController {
@Resource
private StringRedisTemplate stringRedisTemplate;
@PermitAll
@PostMapping("/initIotDBDatabase")
@Operation(summary = "初始化数据库")
public CommonResult<String> initIotDBDatabase() {
MyIotDbUtils.createDatabase(iotDbConfig);
// MyIotDbUtils.createDatabase(iotDbConfig);
MyIotDbUtils.createWebLogInfoTimeseries(iotDbConfig);
MyIotDbUtils.createIllegalLogTimeseries(iotDbConfig);
FileIotDbUtil.createFileLogInfoTimeseries(iotDbConfig);
SpecialPeopleIotDbUtils.createSpeLogInfoTimeseries(iotDbConfig);
MyIotDbUtils.createDeviceLogInfoTimeseries(iotDbConfig);
MyIotDbUtils.createDeviceIllLogInfoTimeseries(iotDbConfig);
JarDecLogIotDbUtil.createJarDecLogInfoTimeseries(iotDbConfig);
return CommonResult.success("初始化成功");
}
@PostMapping("/initIotDBTable")
@Operation(summary = "初始化时间序列")
public CommonResult<String> initIotDBTable() {
MyIotDbUtils.createWebLogInfoTimeseries(iotDbConfig);
return CommonResult.success("初始化成功");
}
@PostMapping("/initIllIotDBTable")
@Operation(summary = "初始非法访问化时间序列")
public CommonResult<String> initIllIotDBTable() {
MyIotDbUtils.createIllegalLogTimeseries(iotDbConfig);
return CommonResult.success("初始化成功");
}
// delete timeseries root.myWebLogInfo.**
// delete timeseries root.myDeviceLogInfo.**
// delete timeseries root.myDecFileLogInfo.**
@PostMapping("/initDecFileIotDBTable")
@Operation(summary = "初始化重要文件时间序列")
public CommonResult<String> initDecFileIotDBTable() {
FileIotDbUtil.createFileLogInfoTimeseries(iotDbConfig);
return CommonResult.success("初始化成功");
}
@PostMapping("/initSpeLogIotDBTable")
@Operation(summary = "初始化重点人群时间序列")
public CommonResult<String> initSpeLogIotDBTable() {
SpecialPeopleIotDbUtils.createSpeLogInfoTimeseries(iotDbConfig);
return CommonResult.success("初始化成功");
}
@PostMapping("/initJarDecLogIotDBTable")
@Operation(summary = "初始化jar加密时间序列")
public CommonResult<String> initJarDecLogIotDBTable() {
JarDecLogIotDbUtil.createJarDecLogInfoTimeseries(iotDbConfig);
return CommonResult.success("初始化成功");
}
@PermitAll
@PostMapping("/saveWebLogInfo")
......
......@@ -40,4 +40,6 @@ public class DeviceConnetRuleInfoPageReqVO extends PageParam {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
private String deviceSn; // 设备sn
}
\ No newline at end of file
......@@ -47,5 +47,5 @@ public class DeviceConnetRuleInfoRespVO {
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
private String deviceSn; // 设备sn
}
\ No newline at end of file
......@@ -33,5 +33,5 @@ public class DeviceConnetRuleInfoSaveReqVO {
@Schema(description = "用户名称", example = "芋艿")
private String userName;
private String deviceSn; // 设备sn
}
\ No newline at end of file
......@@ -29,4 +29,10 @@ public class DeviceReqConfListReqVO {
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
private String snCode; // sn
private String address; // 地址
private String deviceEn; // 设备英文
private String regionName; // 区域名称
private String deviceTypeName;
}
\ No newline at end of file
......@@ -36,4 +36,9 @@ public class DeviceReqConfRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
private String snCode; // sn
private String address; // 地址
private String deviceEn; // 设备英文
private String regionName; // 区域名称
private String deviceTypeName;
}
\ No newline at end of file
......@@ -25,4 +25,9 @@ public class DeviceReqConfSaveReqVO {
@Schema(description = "父级id", example = "31343")
private Long parentId;
private String snCode; // sn
private String address; // 地址
private String deviceEn; // 设备英文
private String regionName; // 区域名称
private String deviceTypeName;
}
\ No newline at end of file
......@@ -16,7 +16,7 @@ import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_
public class PtDeptInfoPageReqVO extends PageParam {
@Schema(description = "部门id", example = "16712")
private Integer orgId;
private String orgId;
@Schema(description = "部门编码")
private String orgCode;
......@@ -28,7 +28,7 @@ public class PtDeptInfoPageReqVO extends PageParam {
private String orgType;
@Schema(description = "父部门id", example = "16885")
private Integer parentOrgId;
private String parentOrgId;
@Schema(description = "父部门名称", example = "芋艿")
private String parentOrgName;
......
......@@ -18,7 +18,7 @@ public class PtDeptInfoRespVO {
@Schema(description = "部门id", example = "16712")
@ExcelProperty("部门id")
private Integer orgId;
private String orgId;
@Schema(description = "部门编码")
@ExcelProperty("部门编码")
......@@ -34,7 +34,7 @@ public class PtDeptInfoRespVO {
@Schema(description = "父部门id", example = "16885")
@ExcelProperty("父部门id")
private Integer parentOrgId;
private String parentOrgId;
@Schema(description = "父部门名称", example = "芋艿")
@ExcelProperty("父部门名称")
......
......@@ -13,7 +13,7 @@ public class PtDeptInfoSaveReqVO {
private Long id;
@Schema(description = "部门id", example = "16712")
private Integer orgId;
private String orgId;
@Schema(description = "部门编码")
private String orgCode;
......@@ -25,7 +25,7 @@ public class PtDeptInfoSaveReqVO {
private String orgType;
@Schema(description = "父部门id", example = "16885")
private Integer parentOrgId;
private String parentOrgId;
@Schema(description = "父部门名称", example = "芋艿")
private String parentOrgName;
......
package cn.gintone.controller.vo;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import static cn.iocoder.yudao.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
@Schema(description = "管理后台 - 平台用户分页 Request VO")
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
public class PtUserInfoPageReqVO extends PageParam {
@Schema(description = "用户id", example = "28834")
private Long userId;
@Schema(description = "用户民", example = "李四")
private String userName;
@Schema(description = "用户真实姓名", example = "张三")
private String userRealName;
@Schema(description = "创建时间")
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
private LocalDateTime[] createTime;
private String orgId;
private String orgName;
}
\ No newline at end of file
package cn.gintone.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import org.springframework.format.annotation.DateTimeFormat;
import java.time.LocalDateTime;
import com.alibaba.excel.annotation.*;
@Schema(description = "管理后台 - 平台用户 Response VO")
@Data
@ExcelIgnoreUnannotated
public class PtUserInfoRespVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "49")
@ExcelProperty("id")
private Long id;
@Schema(description = "用户id", example = "28834")
@ExcelProperty("用户id")
private Long userId;
@Schema(description = "用户民", example = "李四")
@ExcelProperty("用户民")
private String userName;
@Schema(description = "用户真实姓名", example = "张三")
@ExcelProperty("用户真实姓名")
private String userRealName;
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
@ExcelProperty("创建时间")
private LocalDateTime createTime;
private String orgId;
private String orgName;
}
\ No newline at end of file
package cn.gintone.controller.vo;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.*;
import java.util.*;
import javax.validation.constraints.*;
@Schema(description = "管理后台 - 平台用户新增/修改 Request VO")
@Data
public class PtUserInfoSaveReqVO {
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "49")
private Long id;
@Schema(description = "用户id", example = "28834")
private Long userId;
@Schema(description = "用户民", example = "李四")
private String userName;
@Schema(description = "用户真实姓名", example = "张三")
private String userRealName;
private String orgId;
private String orgName;
}
\ No newline at end of file
package cn.gintone.controller.vo;
import com.alibaba.excel.annotation.ExcelProperty;
import lombok.*;
import java.util.*;
import io.swagger.v3.oas.annotations.media.Schema;
......@@ -32,4 +33,14 @@ public class WebReqConfListReqVO {
@Schema(description = "父级id", example = "28717")
private Long parentId;
/**
* 方位地址id
*/
@Schema(description = "api父级id", example = "28718")
private String apiId;
/**
* 访问地址父级id
*/
@Schema(description = "访问地址父级id", example = "28719")
private String apiParentId;
}
\ No newline at end of file
......@@ -40,4 +40,16 @@ public class WebReqConfRespVO {
@ExcelProperty("父级id")
private Long parentId;
/**
* 方位地址id
*/
@Schema(description = "api父级id", example = "28718")
@ExcelProperty("api父级id")
private String apiId;
/**
* 访问地址父级id
*/
@Schema(description = "访问地址父级id", example = "28719")
@ExcelProperty("api父级id")
private String apiParentId;
}
\ No newline at end of file
......@@ -28,4 +28,14 @@ public class WebReqConfSaveReqVO {
@Schema(description = "父级id", example = "28717")
private Long parentId;
/**
* 方位地址id
*/
@Schema(description = "api父级id", example = "28718")
private String apiId;
/**
* 访问地址父级id
*/
@Schema(description = "访问地址父级id", example = "28719")
private String apiParentId;
}
\ No newline at end of file
package cn.gintone.dal;
import java.util.*;
import cn.gintone.controller.vo.PtUserInfoPageReqVO;
import cn.gintone.entity.PtUserInfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import org.apache.ibatis.annotations.Mapper;
/**
* 平台用户 Mapper
*
* @author 安全系统管理
*/
@Mapper
public interface PtUserInfoMapper extends BaseMapperX<PtUserInfoDO> {
default PageResult<PtUserInfoDO> selectPage(PtUserInfoPageReqVO reqVO) {
return selectPage(reqVO, new LambdaQueryWrapperX<PtUserInfoDO>()
.eqIfPresent(PtUserInfoDO::getUserId, reqVO.getUserId())
.likeIfPresent(PtUserInfoDO::getUserName, reqVO.getUserName())
.likeIfPresent(PtUserInfoDO::getUserRealName, reqVO.getUserRealName())
.eqIfPresent(PtUserInfoDO::getOrgId, reqVO.getOrgId())
.eqIfPresent(PtUserInfoDO::getOrgName, reqVO.getOrgName())
.betweenIfPresent(PtUserInfoDO::getCreateTime, reqVO.getCreateTime())
.orderByDesc(PtUserInfoDO::getId));
}
}
\ No newline at end of file
......@@ -11,6 +11,7 @@ public class DeviceIllLogInfo {
private String deviceName; // 设备名称
private String deviceTypeId; // 设备类型id
private String deviceTypeName; // 设备类型名称
private String deviceSn; // 设备类型名称
private String accessed; // 访问时间
private String illType; // 日志类型()
private String clientIp; // 访问端ip
......@@ -165,6 +166,14 @@ public class DeviceIllLogInfo {
this.pageNum = pageNum;
}
public String getDeviceSn() {
return deviceSn;
}
public void setDeviceSn(String deviceSn) {
this.deviceSn = deviceSn;
}
@Override
public String toString() {
return "DeviceIllLogInfo{" +
......@@ -178,6 +187,7 @@ public class DeviceIllLogInfo {
", deviceName='" + deviceName + '\'' +
", deviceTypeId='" + deviceTypeId + '\'' +
", deviceTypeName='" + deviceTypeName + '\'' +
", deviceSn='" + deviceSn + '\'' +
", accessed='" + accessed + '\'' +
", illType='" + illType + '\'' +
", clientIp='" + clientIp + '\'' +
......
......@@ -11,6 +11,7 @@ public class DeviceLogInfo {
private String deviceName; // 设备名称
private String deviceTypeId; // 设备类型id
private String deviceTypeName; // 设备类型名称
private String deviceSn; // 设备sn
private String accessed; // 访问时间
private String type; // 日志类型(info, warning, error)
private String clientIp; // 访问端ip
......@@ -167,6 +168,14 @@ public class DeviceLogInfo {
this.pageNum = pageNum;
}
public String getDeviceSn() {
return deviceSn;
}
public void setDeviceSn(String deviceSn) {
this.deviceSn = deviceSn;
}
@Override
public String toString() {
return "DeviceLogInfo{" +
......@@ -180,6 +189,7 @@ public class DeviceLogInfo {
", deviceName='" + deviceName + '\'' +
", deviceTypeId='" + deviceTypeId + '\'' +
", deviceTypeName='" + deviceTypeName + '\'' +
", deviceSn='" + deviceSn + '\'' +
", accessed='" + accessed + '\'' +
", type='" + type + '\'' +
", clientIp='" + clientIp + '\'' +
......
......@@ -5,7 +5,9 @@ public class PtBzInfo {
private String sbcode; // 编码
private String name; // 名称
private String bztype; // 类型
private String bztype_id; // 类型id
private String bgq; // 区域
private String address; // 地址
public int getId() {
return id;
......@@ -46,4 +48,20 @@ public class PtBzInfo {
public void setBgq(String bgq) {
this.bgq = bgq;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getBztype_id() {
return bztype_id;
}
public void setBztype_id(String bztype_id) {
this.bztype_id = bztype_id;
}
}
package cn.gintone.dtoPt;
public class PtDeptInfo {
private Integer org_id; // 部门id
private String org_code; // 部门编码
private String org_name; // 部门名称
private String org_type; // 部门类型
private Integer PARENT_ORG_ID; // 父部门id
private String ORG_ID; // 部门id
private String ORG_CODE; // 部门编码
private String ORG_NAME; // 部门名称
private String ORG_TYPE; // 部门类型
private String PARENT_ORG_ID; // 父部门id
private String PARENT_ORG_NAME; // 父部门名称
public Integer getOrg_id() {
return org_id;
public String getORG_ID() {
return ORG_ID;
}
public void setOrg_id(Integer org_id) {
this.org_id = org_id;
public void setORG_ID(String ORG_ID) {
this.ORG_ID = ORG_ID;
}
public String getOrg_code() {
return org_code;
}
public void setOrg_code(String org_code) {
this.org_code = org_code;
public void setPARENT_ORG_ID(String PARENT_ORG_ID) {
this.PARENT_ORG_ID = PARENT_ORG_ID;
}
public String getOrg_name() {
return org_name;
public String getORG_CODE() {
return ORG_CODE;
}
public void setOrg_name(String org_name) {
this.org_name = org_name;
public void setORG_CODE(String ORG_CODE) {
this.ORG_CODE = ORG_CODE;
}
public String getOrg_type() {
return org_type;
public String getORG_NAME() {
return ORG_NAME;
}
public void setOrg_type(String org_type) {
this.org_type = org_type;
public void setORG_NAME(String ORG_NAME) {
this.ORG_NAME = ORG_NAME;
}
public Integer getPARENT_ORG_ID() {
return PARENT_ORG_ID;
public String getORG_TYPE() {
return ORG_TYPE;
}
public void setPARENT_ORG_ID(Integer PARENT_ORG_ID) {
this.PARENT_ORG_ID = PARENT_ORG_ID;
public void setORG_TYPE(String ORG_TYPE) {
this.ORG_TYPE = ORG_TYPE;
}
public String getPARENT_ORG_NAME() {
......@@ -55,4 +51,8 @@ public class PtDeptInfo {
public void setPARENT_ORG_NAME(String PARENT_ORG_NAME) {
this.PARENT_ORG_NAME = PARENT_ORG_NAME;
}
public String getPARENT_ORG_ID() {
return PARENT_ORG_ID;
}
}
package cn.gintone.dtoPt;
public class PtGdInfo {
private String sbcode; // 设备编码
private String sbname; // 名称
private String category_id; // 类别编码
private String category; // 类别
private String sstype_id; // 所属点位类型编
private String sstype; // 所属点位类型
private String address; // 位置
private Long id; // id
private String sbname; // 设备名称
private String category_id; // 类别id
private String category; // 类别名称
private String sncode; // sn号
private String address; // 地址
private String region_name; // 区域名称
public String getSbcode() {
return sbcode;
public Long getId() {
return id;
}
public void setSbcode(String sbcode) {
this.sbcode = sbcode;
public void setId(Long id) {
this.id = id;
}
public String getSbname() {
......@@ -41,20 +41,12 @@ public class PtGdInfo {
this.category = category;
}
public String getSstype_id() {
return sstype_id;
public String getSncode() {
return sncode;
}
public void setSstype_id(String sstype_id) {
this.sstype_id = sstype_id;
}
public String getSstype() {
return sstype;
}
public void setSstype(String sstype) {
this.sstype = sstype;
public void setSncode(String sncode) {
this.sncode = sncode;
}
public String getAddress() {
......@@ -64,4 +56,12 @@ public class PtGdInfo {
public void setAddress(String address) {
this.address = address;
}
public String getRegion_name() {
return region_name;
}
public void setRegion_name(String region_name) {
this.region_name = region_name;
}
}
package cn.gintone.dtoPt;
public class PtJgInfo {
private Integer id;
private String sbcode; // 井盖编码
private String name; // 井盖名称
private String category_id; // 设施类型代码
private String category; // 设施类型代码
private String address; // 检测位置
public Integer getId() {
private Long id; // id
private String sbname; // 设备名称
private String category_id; // 类别id
private String category; // 类别名称
private String sncode; // sn号码
private String address; // 地址
private String region_name; // 区域名称
public Long getId() {
return id;
}
public void setId(Integer id) {
public void setId(Long id) {
this.id = id;
}
public String getSbcode() {
return sbcode;
}
public void setSbcode(String sbcode) {
this.sbcode = sbcode;
public String getSbname() {
return sbname;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
public void setSbname(String sbname) {
this.sbname = sbname;
}
public String getCategory_id() {
......@@ -48,6 +41,14 @@ public class PtJgInfo {
this.category = category;
}
public String getSncode() {
return sncode;
}
public void setSncode(String sncode) {
this.sncode = sncode;
}
public String getAddress() {
return address;
}
......@@ -55,4 +56,12 @@ public class PtJgInfo {
public void setAddress(String address) {
this.address = address;
}
public String getRegion_name() {
return region_name;
}
public void setRegion_name(String region_name) {
this.region_name = region_name;
}
}
package cn.gintone.dtoPt;
public class PtMenuInfo {
private Integer P_ID;
private String P_VALUE;
private String P_NAME;
private String PARENT_P_ID;
public Integer getP_ID() {
return P_ID;
}
public void setP_ID(Integer p_ID) {
P_ID = p_ID;
}
public String getP_VALUE() {
return P_VALUE;
}
public void setP_VALUE(String p_VALUE) {
P_VALUE = p_VALUE;
}
public String getP_NAME() {
return P_NAME;
}
public void setP_NAME(String p_NAME) {
P_NAME = p_NAME;
}
public String getPARENT_P_ID() {
return PARENT_P_ID;
}
public void setPARENT_P_ID(String PARENT_P_ID) {
this.PARENT_P_ID = PARENT_P_ID;
}
}
package cn.gintone.dtoPt;
public class PtUserInfo {
private Integer u_id;
private Long u_id;
private String u_name; // 用户名
private String u_real_name; // ⽤户真实姓名
private String org_id; // 部门id
private String org_name;
public Integer getU_id() {
public Long getU_id() {
return u_id;
}
public void setU_id(Integer u_id) {
public void setU_id(Long u_id) {
this.u_id = u_id;
}
......@@ -28,4 +30,20 @@ public class PtUserInfo {
public void setU_real_name(String u_real_name) {
this.u_real_name = u_real_name;
}
public String getOrg_id() {
return org_id;
}
public void setOrg_id(String org_id) {
this.org_id = org_id;
}
public String getOrg_name() {
return org_name;
}
public void setOrg_name(String org_name) {
this.org_name = org_name;
}
}
package cn.gintone.dtoPt;
public class PtYLDInfo {
private Long id; // id
private String sbname; // 设备名称
private String category_id; // 类别id
private String category; // 类别名称
private String sncode; // sn号码
private String address; // 地址
private String region_name; // 区域名称
public String getSbname() {
return sbname;
}
public void setSbname(String sbname) {
this.sbname = sbname;
}
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
public String getRegion_name() {
return region_name;
}
public void setRegion_name(String region_name) {
this.region_name = region_name;
}
public String getAddress() {
return address;
}
public void setAddress(String address) {
this.address = address;
}
public String getSncode() {
return sncode;
}
public void setSncode(String sncode) {
this.sncode = sncode;
}
public String getCategory_id() {
return category_id;
}
public void setCategory_id(String category_id) {
this.category_id = category_id;
}
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
}
......@@ -56,4 +56,6 @@ public class DeviceConnetRuleInfoDO extends BaseDO {
*/
private String userName;
private String deviceSn; // 设备sn
}
\ No newline at end of file
......@@ -41,9 +41,15 @@ public class DeviceReqConfDO extends BaseDO {
* 设备类型id
*/
private String deviceTypeId;
private String deviceTypeName;
/**
* 父级id
*/
private Long parentId;
private String snCode; // sn
private String address; // 地址
private String deviceEn; // 设备英文
private String regionName; // 区域名称
}
\ No newline at end of file
......@@ -30,7 +30,7 @@ public class PtDeptInfoDO extends BaseDO {
/**
* 部门id
*/
private Integer orgId;
private String orgId;
/**
* 部门编码
*/
......@@ -46,7 +46,7 @@ public class PtDeptInfoDO extends BaseDO {
/**
* 父部门id
*/
private Integer parentOrgId;
private String parentOrgId;
/**
* 父部门名称
*/
......
package cn.gintone.entity;
import lombok.*;
import java.util.*;
import java.time.LocalDateTime;
import java.time.LocalDateTime;
import com.baomidou.mybatisplus.annotation.*;
import cn.iocoder.yudao.framework.mybatis.core.dataobject.BaseDO;
/**
* 平台用户 DO
*
* @author 安全系统管理
*/
@TableName("t_pt_user_info")
@KeySequence("t_pt_user_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
@Data
@EqualsAndHashCode(callSuper = true)
@ToString(callSuper = true)
@Builder
@NoArgsConstructor
@AllArgsConstructor
public class PtUserInfoDO extends BaseDO {
/**
* id
*/
@TableId
private Long id;
/**
* 用户id
*/
private Long userId;
/**
* 用户民
*/
private String userName;
/**
* 用户真实姓名
*/
private String userRealName;
private String orgId;
private String orgName;
}
\ No newline at end of file
......@@ -47,5 +47,13 @@ public class WebReqConfDO extends BaseDO {
* 父级id
*/
private Long parentId;
/**
* 方位地址id
*/
private String apiId;
/**
* 访问地址父级id
*/
private String apiParentId;
}
\ No newline at end of file
......@@ -148,7 +148,7 @@ public class MyIotDbUtils {
values.add(webLogInfo.getType());
values.add(webLogInfo.getClientIp());
values.add(webLogInfo.getRemark());
sessionPool.insertRecord("root.myWebLogInfo.tableThree", System.currentTimeMillis(), list5, list6, values);
sessionPool.insertRecord("root.myWebLogInfo.tableTwo", System.currentTimeMillis(), list5, list6, values);
sessionPool.close();
} catch (IoTDBConnectionException e) {
throw new RuntimeException(e);
......@@ -607,6 +607,7 @@ public class MyIotDbUtils {
sessionPool.createTimeseries("root.myDeviceLogInfo.tableOne.deviceName", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableOne.deviceTypeId", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableOne.deviceTypeName", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableOne.deviceSn", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableOne.accessed", TSDataType.TIMESTAMP, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableOne.type", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableOne.clientIp", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
......@@ -640,6 +641,7 @@ public class MyIotDbUtils {
sessionPool.createTimeseries("root.myDeviceLogInfo.tableTwo.deviceName", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableTwo.deviceTypeId", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableTwo.deviceTypeName", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableTwo.deviceSn", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableTwo.accessed", TSDataType.TIMESTAMP, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableTwo.illType", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
sessionPool.createTimeseries("root.myDeviceLogInfo.tableTwo.clientIp", TSDataType.TEXT, TSEncoding.PLAIN, CompressionType.UNCOMPRESSED);
......@@ -695,6 +697,7 @@ public class MyIotDbUtils {
list5.add("deviceName");
list5.add("deviceTypeId");
list5.add("deviceTypeName");
list5.add("deviceSn");
list5.add("accessed");
list5.add("type");
list5.add("clientIp");
......@@ -709,6 +712,7 @@ public class MyIotDbUtils {
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TIMESTAMP);
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TEXT);
......@@ -723,6 +727,7 @@ public class MyIotDbUtils {
values.add(deviceLogInfo.getDeviceName());
values.add(deviceLogInfo.getDeviceTypeId());
values.add(deviceLogInfo.getDeviceTypeName());
values.add(deviceLogInfo.getDeviceSn());
values.add(MyDateUtils.stringToLong(deviceLogInfo.getAccessed()));
values.add(deviceLogInfo.getType());
values.add(deviceLogInfo.getClientIp());
......@@ -778,6 +783,7 @@ public class MyIotDbUtils {
list5.add("deviceName");
list5.add("deviceTypeId");
list5.add("deviceTypeName");
list5.add("deviceSn");
list5.add("accessed");
list5.add("illType");
list5.add("clientIp");
......@@ -792,6 +798,7 @@ public class MyIotDbUtils {
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TIMESTAMP);
list6.add(TSDataType.TEXT);
list6.add(TSDataType.TEXT);
......@@ -806,6 +813,7 @@ public class MyIotDbUtils {
values.add(deviceIllLogInfo.getDeviceName());
values.add(deviceIllLogInfo.getDeviceTypeId());
values.add(deviceIllLogInfo.getDeviceTypeName());
values.add(deviceIllLogInfo.getDeviceSn());
values.add(MyDateUtils.stringToLong(deviceIllLogInfo.getAccessed()));
values.add(deviceIllLogInfo.getIllType());
values.add(deviceIllLogInfo.getClientIp());
......@@ -901,7 +909,7 @@ public class MyIotDbUtils {
int offsetNum = (deviceLogInfo.getPageNum() - 1) * deviceLogInfo.getPageSize();
int limitNum = deviceLogInfo.getPageSize();
StringBuffer sb = new StringBuffer();
sb.append("select roleId, roleName, userId, username, deviceId, deviceName, deviceTypeId, deviceTypeName, accessed, type, clientIp, remark from root.myDeviceLogInfo.tableOne");
sb.append("select roleId, roleName, userId, username, deviceId, deviceName, deviceTypeId, deviceTypeName, deviceSn, accessed, type, clientIp, remark from root.myDeviceLogInfo.tableOne");
if ((null != deviceLogInfo.getEndTime() && 0 != deviceLogInfo.getEndTime())
|| (null != deviceLogInfo.getBeginTime() && 0 != deviceLogInfo.getBeginTime())
|| (null != deviceLogInfo.getType() && !"".equals(deviceLogInfo.getType()))) {
......@@ -954,13 +962,15 @@ public class MyIotDbUtils {
Field field7 = fields.get(7);
String deviceTypeName = field7.getStringValue();
Field field8 = fields.get(8);
long accessed = field8.getLongV();
String deviceSn = field8.getStringValue();
Field field9 = fields.get(9);
String type = field9.getStringValue();
long accessed = field9.getLongV();
Field field10 = fields.get(10);
String clientIp = field10.getStringValue();
String type = field10.getStringValue();
Field field11 = fields.get(11);
String remark = field11.getStringValue();
String clientIp = field11.getStringValue();
Field field12 = fields.get(12);
String remark = field12.getStringValue();
DeviceLogInfo deviceLogInfo1 = new DeviceLogInfo();
deviceLogInfo1.setTimesta(timestamp);
......@@ -974,6 +984,7 @@ public class MyIotDbUtils {
deviceLogInfo1.setDeviceName(deviceName);
deviceLogInfo1.setDeviceTypeId(deviceTypeId);
deviceLogInfo1.setDeviceTypeName(deviceTypeName);
deviceLogInfo1.setDeviceSn(deviceSn);
deviceLogInfo1.setAccessed(MyDateUtils.longToString(accessed));
deviceLogInfo1.setType(type);
......@@ -1073,7 +1084,7 @@ public class MyIotDbUtils {
int offsetNum = (deviceIllLogInfo.getPageNum() - 1) * deviceIllLogInfo.getPageSize();
int limitNum = deviceIllLogInfo.getPageSize();
StringBuffer sb = new StringBuffer();
sb.append("select roleId, roleName, userId, username, deviceId, deviceName, deviceTypeId, deviceTypeName, accessed, illType, clientIp, remark from root.myDeviceLogInfo.tableTwo");
sb.append("select roleId, roleName, userId, username, deviceId, deviceName, deviceTypeId, deviceTypeName, deviceSn, accessed, illType, clientIp, remark from root.myDeviceLogInfo.tableTwo");
if ((null != deviceIllLogInfo.getEndTime() && 0 != deviceIllLogInfo.getEndTime())
|| (null != deviceIllLogInfo.getBeginTime() && 0 != deviceIllLogInfo.getBeginTime())
|| (null != deviceIllLogInfo.getIllType() && !"".equals(deviceIllLogInfo.getIllType()))) {
......@@ -1126,13 +1137,15 @@ public class MyIotDbUtils {
Field field7 = fields.get(7);
String deviceTypeName = field7.getStringValue();
Field field8 = fields.get(8);
long accessed = field8.getLongV();
String deviceSn = field8.getStringValue();
Field field9 = fields.get(9);
String illType = field9.getStringValue();
long accessed = field9.getLongV();
Field field10 = fields.get(10);
String clientIp = field10.getStringValue();
String illType = field10.getStringValue();
Field field11 = fields.get(11);
String remark = field11.getStringValue();
String clientIp = field11.getStringValue();
Field field12 = fields.get(12);
String remark = field12.getStringValue();
DeviceIllLogInfo deviceIllLogInfo1 = new DeviceIllLogInfo();
deviceIllLogInfo1.setTimesta(timestamp);
......@@ -1146,6 +1159,7 @@ public class MyIotDbUtils {
deviceIllLogInfo1.setDeviceName(deviceName);
deviceIllLogInfo1.setDeviceTypeId(deviceTypeId);
deviceIllLogInfo1.setDeviceTypeName(deviceTypeName);
deviceIllLogInfo1.setDeviceSn(deviceSn);
deviceIllLogInfo1.setAccessed(MyDateUtils.longToString(accessed));
deviceIllLogInfo1.setIllType(illType);
......
......@@ -7,7 +7,25 @@ import org.springframework.stereotype.Component;
@Component
@ConfigurationProperties(prefix = "basicinfo")
public class BasicUrlConf {
private String deptInfoUrl;
private String userInfoUrl;
private String menuInfoUrl;
// 设备信息
private String bzInfoUrl;
private String fkclInfoUrl;
private String sxtInfoUrl;
private String yldInfoUrl;
private String gdInfoUrl;
private String jgInfoUrl;
public String getDeptInfoUrl() {
return deptInfoUrl;
}
public void setDeptInfoUrl(String deptInfoUrl) {
this.deptInfoUrl = deptInfoUrl;
}
public String getUserInfoUrl() {
return userInfoUrl;
......@@ -16,4 +34,60 @@ public class BasicUrlConf {
public void setUserInfoUrl(String userInfoUrl) {
this.userInfoUrl = userInfoUrl;
}
public String getMenuInfoUrl() {
return menuInfoUrl;
}
public void setMenuInfoUrl(String menuInfoUrl) {
this.menuInfoUrl = menuInfoUrl;
}
public String getBzInfoUrl() {
return bzInfoUrl;
}
public void setBzInfoUrl(String bzInfoUrl) {
this.bzInfoUrl = bzInfoUrl;
}
public String getFkclInfoUrl() {
return fkclInfoUrl;
}
public void setFkclInfoUrl(String fkclInfoUrl) {
this.fkclInfoUrl = fkclInfoUrl;
}
public String getSxtInfoUrl() {
return sxtInfoUrl;
}
public void setSxtInfoUrl(String sxtInfoUrl) {
this.sxtInfoUrl = sxtInfoUrl;
}
public String getYldInfoUrl() {
return yldInfoUrl;
}
public void setYldInfoUrl(String yldInfoUrl) {
this.yldInfoUrl = yldInfoUrl;
}
public String getGdInfoUrl() {
return gdInfoUrl;
}
public void setGdInfoUrl(String gdInfoUrl) {
this.gdInfoUrl = gdInfoUrl;
}
public String getJgInfoUrl() {
return jgInfoUrl;
}
public void setJgInfoUrl(String jgInfoUrl) {
this.jgInfoUrl = jgInfoUrl;
}
}
......@@ -7,6 +7,7 @@ import cn.gintone.controller.vo.DeviceConnetRuleInfoRespVO;
import cn.gintone.controller.vo.DeviceConnetRuleInfoSaveReqVO;
import cn.gintone.controller.vo.VisitInfoSaveReqVO;
import cn.gintone.dal.DeviceConnetRuleInfoMapper;
import cn.gintone.dal.PtDeptInfoMapper;
import cn.gintone.dto.*;
import cn.gintone.entity.DeviceConnetRuleInfoDO;
import cn.gintone.entity.VisitInfoDO;
......@@ -44,6 +45,8 @@ public class DeviceConnetRuleInfoServiceImpl implements DeviceConnetRuleInfoServ
private IotDbConfig iotDbConfig;
@Autowired
private UserRoleMapper userRoleMapper;
@Autowired
private PtDeptInfoMapper ptDeptInfoMapper;
@Override
public Long createConnetRuleInfo(DeviceConnetRuleInfoSaveReqVO createReqVO) {
......@@ -172,10 +175,10 @@ public class DeviceConnetRuleInfoServiceImpl implements DeviceConnetRuleInfoServ
MyIotDbUtils.inserOneDeviceLogInfo_ill(iotDbConfig, deviceIllLogInfo);
return;
}
// 获取用户信息和角色信息------需要调用平台的接口
boolean isLegal = false; // 是否合法。false:不合法,true:合法
/*// 获取用户信息和角色信息------需要调用平台的接口
List<UserRoleDO> userRoleDOS = userRoleMapper.selectListByUserId(Long.parseLong(userId));
boolean isLegal = false; // 是否合法。false:不合法,true:合法
// 先查询角色规则
if (null != userRoleDOS && !userRoleDOS.isEmpty()) {
for (UserRoleDO userRoleDO : userRoleDOS) {
......@@ -188,7 +191,7 @@ public class DeviceConnetRuleInfoServiceImpl implements DeviceConnetRuleInfoServ
}
}
}
}*/
// 查询用户规则,如果配置了用户规则,则按照用户规则走
List<DeviceConnetRuleInfoDO> deviceConnetRuleInfoDOList = connetRuleInfoMapper.selectList(new LambdaQueryWrapper<DeviceConnetRuleInfoDO>()
......@@ -202,7 +205,17 @@ public class DeviceConnetRuleInfoServiceImpl implements DeviceConnetRuleInfoServ
);
if (null != deviceConnetRuleInfoDOS && deviceConnetRuleInfoDOS.size() > 0) {
isLegal = true;
} else {
deviceConnetRuleInfoDOS = connetRuleInfoMapper.selectList(new LambdaQueryWrapper<DeviceConnetRuleInfoDO>()
.eq(DeviceConnetRuleInfoDO::getUserId, userId)
.like(DeviceConnetRuleInfoDO::getDeviceSn, deviceLogInfo.getDeviceSn())
);
if (null != deviceConnetRuleInfoDOS && deviceConnetRuleInfoDOS.size() > 0) {
isLegal = true;
}
}
}
if (!isLegal) {
......
......@@ -54,4 +54,5 @@ public interface DeviceReqConfService {
*/
List<DeviceReqConfDO> getDeviceReqConfList(DeviceReqConfListReqVO listReqVO);
String syncPtDevice();
}
\ No newline at end of file
......@@ -4,6 +4,7 @@ import java.util.*;
import javax.validation.*;
import cn.gintone.controller.vo.PtDeptInfoPageReqVO;
import cn.gintone.controller.vo.PtDeptInfoRespVO;
import cn.gintone.controller.vo.PtDeptInfoSaveReqVO;
import cn.gintone.entity.PtDeptInfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
......@@ -54,4 +55,9 @@ public interface PtDeptInfoService {
*/
PageResult<PtDeptInfoDO> getPtDeptInfoPage(PtDeptInfoPageReqVO pageReqVO);
/**
* 同步平台数据
* @return
*/
String syncPtDept();
}
\ No newline at end of file
......@@ -2,9 +2,17 @@ package cn.gintone.service;
import cn.gintone.ErrorInfo;
import cn.gintone.controller.vo.PtDeptInfoPageReqVO;
import cn.gintone.controller.vo.PtDeptInfoRespVO;
import cn.gintone.controller.vo.PtDeptInfoSaveReqVO;
import cn.gintone.dal.PtDeptInfoMapper;
import cn.gintone.dtoPt.PtData;
import cn.gintone.dtoPt.PtDeptInfo;
import cn.gintone.entity.PtDeptInfoDO;
import cn.gintone.myconf.BasicUrlConf;
import cn.gintone.utils.BasicInfoHttpUtils;
import cn.iocoder.yudao.module.system.controller.admin.auth.myVo.PtResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
......@@ -28,6 +36,11 @@ import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionU
public class PtDeptInfoServiceImpl implements PtDeptInfoService {
@Resource
private BasicUrlConf basicUrlConf;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource
private PtDeptInfoMapper ptDeptInfoMapper;
@Override
......@@ -72,4 +85,42 @@ public class PtDeptInfoServiceImpl implements PtDeptInfoService {
return ptDeptInfoMapper.selectPage(pageReqVO);
}
@Override
public String syncPtDept() {
String pdToken = stringRedisTemplate.opsForValue().get("pdToken");
PtResult<PtData<PtDeptInfo>> result = BasicInfoHttpUtils.getDeptInfo(basicUrlConf.getDeptInfoUrl(), "secure", pdToken);
PtData<PtDeptInfo> data = result.getData();
List<PtDeptInfo> rowData = data.getRowData();
if (rowData != null && rowData.size() > 0) {
for (PtDeptInfo deptInfo : rowData) {
PtDeptInfoSaveReqVO createReqVO = new PtDeptInfoSaveReqVO();
createReqVO.setOrgId(deptInfo.getORG_ID());
PtDeptInfoDO ptDeptInfoDO = ptDeptInfoMapper.selectOne(new QueryWrapper<PtDeptInfoDO>()
.lambda()
.eq(PtDeptInfoDO::getOrgId, createReqVO.getOrgId())
);
if (ptDeptInfoDO != null) {
ptDeptInfoDO.setOrgCode(deptInfo.getORG_CODE());
ptDeptInfoDO.setOrgName(deptInfo.getORG_NAME());
ptDeptInfoDO.setOrgType(deptInfo.getORG_TYPE());
ptDeptInfoDO.setParentOrgId(deptInfo.getPARENT_ORG_ID());
ptDeptInfoDO.setParentOrgName(deptInfo.getPARENT_ORG_NAME());
ptDeptInfoMapper.updateById(ptDeptInfoDO);
} else {
createReqVO.setOrgCode(deptInfo.getORG_CODE());
createReqVO.setOrgName(deptInfo.getORG_NAME());
createReqVO.setOrgType(deptInfo.getORG_TYPE());
createReqVO.setParentOrgId(deptInfo.getPARENT_ORG_ID());
createReqVO.setParentOrgName(deptInfo.getPARENT_ORG_NAME());
createPtDeptInfo(createReqVO);
}
}
}
return "同步成功";
}
}
\ No newline at end of file
package cn.gintone.service;
import cn.gintone.controller.vo.WebReqConfSaveReqVO;
import cn.gintone.dal.SysAbbreMapper;
import cn.gintone.dtoPt.PtData;
import cn.gintone.dtoPt.PtMenuInfo;
import cn.gintone.entity.SysAbbreDO;
import cn.gintone.myconf.BasicUrlConf;
import cn.gintone.utils.BasicInfoHttpUtils;
import cn.iocoder.yudao.module.system.controller.admin.auth.myVo.PtResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.List;
@Component
public class PtTimeTaskService {
@Resource
private BasicUrlConf basicUrlConf;
@Autowired
private WebReqConfService webReqConfService;
@Autowired
private SysAbbreMapper sysAbbreMapper;
@Scheduled(fixedDelay = 10000)
public void executeEvery5Minutes() {
SysAbbreDO secure = sysAbbreMapper.selectOne(new QueryWrapper<SysAbbreDO>()
.lambda()
.eq(SysAbbreDO::getAbbreEn, "SLPT")
);
PtResult<PtData<PtMenuInfo>> ptMenuList = BasicInfoHttpUtils.getPtMenu(basicUrlConf.getMenuInfoUrl(), "", "");
PtData<PtMenuInfo> data = ptMenuList.getData();
if (data != null) {
List<PtMenuInfo> rowDataList = data.getRowData();
if (rowDataList != null && rowDataList.size() > 0) {
for (PtMenuInfo rowData : rowDataList) {
String pValue = rowData.getP_VALUE();
if (pValue != null && pValue.length() > 1) {
WebReqConfSaveReqVO webReqConfSaveReqVO = new WebReqConfSaveReqVO();
webReqConfSaveReqVO.setApiUrl(pValue);
webReqConfSaveReqVO.setApiId(rowData.getP_ID() + "");
if (null != rowData.getPARENT_P_ID()) {
webReqConfSaveReqVO.setApiParentId(rowData.getPARENT_P_ID() + "");
}
webReqConfSaveReqVO.setApiName(rowData.getP_NAME());
webReqConfSaveReqVO.setAbbreId(secure.getId());
webReqConfSaveReqVO.setAbbreCn(secure.getAbbreCn());
webReqConfService.myCreateWebReqConf(webReqConfSaveReqVO);
}
}
}
}
System.out.println(123);
}
}
package cn.gintone.service;
import java.util.*;
import javax.validation.*;
import cn.gintone.controller.vo.PtUserInfoPageReqVO;
import cn.gintone.controller.vo.PtUserInfoSaveReqVO;
import cn.gintone.entity.PtUserInfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
/**
* 平台用户 Service 接口
*
* @author 安全系统管理
*/
public interface PtUserInfoService {
/**
* 创建平台用户
*
* @param createReqVO 创建信息
* @return 编号
*/
Long createPtUserInfo(@Valid PtUserInfoSaveReqVO createReqVO);
/**
* 更新平台用户
*
* @param updateReqVO 更新信息
*/
void updatePtUserInfo(@Valid PtUserInfoSaveReqVO updateReqVO);
/**
* 删除平台用户
*
* @param id 编号
*/
void deletePtUserInfo(Long id);
/**
* 获得平台用户
*
* @param id 编号
* @return 平台用户
*/
PtUserInfoDO getPtUserInfo(Long id);
/**
* 获得平台用户分页
*
* @param pageReqVO 分页查询
* @return 平台用户分页
*/
PageResult<PtUserInfoDO> getPtUserInfoPage(PtUserInfoPageReqVO pageReqVO);
String syncPtUser();
}
\ No newline at end of file
package cn.gintone.service;
import cn.gintone.ErrorInfo;
import cn.gintone.controller.vo.PtDeptInfoSaveReqVO;
import cn.gintone.controller.vo.PtUserInfoPageReqVO;
import cn.gintone.controller.vo.PtUserInfoSaveReqVO;
import cn.gintone.dal.PtUserInfoMapper;
import cn.gintone.dtoPt.PtData;
import cn.gintone.dtoPt.PtDeptInfo;
import cn.gintone.dtoPt.PtUserInfo;
import cn.gintone.entity.PtUserInfoDO;
import cn.gintone.myconf.BasicUrlConf;
import cn.gintone.utils.BasicInfoHttpUtils;
import cn.iocoder.yudao.module.system.controller.admin.auth.myVo.PtResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
import org.springframework.transaction.annotation.Transactional;
import java.util.*;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.common.pojo.PageParam;
import cn.iocoder.yudao.framework.common.util.object.BeanUtils;
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception;
/**
* 平台用户 Service 实现类
*
* @author 安全系统管理
*/
@Service
@Validated
public class PtUserInfoServiceImpl implements PtUserInfoService {
@Resource
private BasicUrlConf basicUrlConf;
@Resource
private StringRedisTemplate stringRedisTemplate;
@Resource
private PtUserInfoMapper ptUserInfoMapper;
@Override
public Long createPtUserInfo(PtUserInfoSaveReqVO createReqVO) {
// 插入
PtUserInfoDO ptUserInfo = BeanUtils.toBean(createReqVO, PtUserInfoDO.class);
ptUserInfoMapper.insert(ptUserInfo);
// 返回
return ptUserInfo.getId();
}
@Override
public void updatePtUserInfo(PtUserInfoSaveReqVO updateReqVO) {
// 校验存在
validatePtUserInfoExists(updateReqVO.getId());
// 更新
PtUserInfoDO updateObj = BeanUtils.toBean(updateReqVO, PtUserInfoDO.class);
ptUserInfoMapper.updateById(updateObj);
}
@Override
public void deletePtUserInfo(Long id) {
// 校验存在
validatePtUserInfoExists(id);
// 删除
ptUserInfoMapper.deleteById(id);
}
private void validatePtUserInfoExists(Long id) {
if (ptUserInfoMapper.selectById(id) == null) {
throw exception(ErrorInfo.PT_USER_INFO_NOT_EXISTS);
}
}
@Override
public PtUserInfoDO getPtUserInfo(Long id) {
return ptUserInfoMapper.selectById(id);
}
@Override
public PageResult<PtUserInfoDO> getPtUserInfoPage(PtUserInfoPageReqVO pageReqVO) {
return ptUserInfoMapper.selectPage(pageReqVO);
}
@Override
public String syncPtUser() {
String pdToken = stringRedisTemplate.opsForValue().get("pdToken");
PtResult<PtData<PtUserInfo>> result = BasicInfoHttpUtils.getUserInfo(basicUrlConf.getUserInfoUrl(), "secure", pdToken);
PtData<PtUserInfo> data = result.getData();
List<PtUserInfo> rowData = data.getRowData();
if (rowData != null && rowData.size() > 0) {
for (PtUserInfo ptUserInfo : rowData) {
PtUserInfoSaveReqVO createReqVO = new PtUserInfoSaveReqVO();
createReqVO.setUserId(ptUserInfo.getU_id());
createReqVO.setUserName(ptUserInfo.getU_name());
createReqVO.setUserRealName(ptUserInfo.getU_real_name());
createReqVO.setOrgId(ptUserInfo.getOrg_id());
createReqVO.setOrgName(ptUserInfo.getOrg_name());
PtUserInfoDO ptUserInfoDO = ptUserInfoMapper.selectOne(new QueryWrapper<PtUserInfoDO>()
.lambda()
.eq(PtUserInfoDO::getUserId, createReqVO.getUserId())
);
if (ptUserInfoDO != null) {
ptUserInfoDO.setUserId(createReqVO.getUserId());
ptUserInfoDO.setUserName(createReqVO.getUserName());
ptUserInfoDO.setUserRealName(createReqVO.getUserRealName());
ptUserInfoDO.setOrgId(createReqVO.getOrgId());
ptUserInfoDO.setOrgName(createReqVO.getOrgName());
ptUserInfoMapper.updateById(ptUserInfoDO);
} else {
createPtUserInfo(createReqVO);
}
}
}
return "同步成功";
}
}
\ No newline at end of file
......@@ -150,9 +150,9 @@ public class VisitInfoServiceImpl implements VisitInfoService {
return;
}
// 获取用户信息和角色信息------需要调用平台的接口
List<UserRoleDO> userRoleDOS = userRoleMapper.selectListByUserId(Long.parseLong(userId));
boolean isLegal = false; // 是否合法。false:不合法,true:合法
/*List<UserRoleDO> userRoleDOS = userRoleMapper.selectListByUserId(Long.parseLong(userId));
// 先查询角色规则
if (null != userRoleDOS && !userRoleDOS.isEmpty()) {
for (UserRoleDO userRoleDO : userRoleDOS) {
......@@ -165,7 +165,7 @@ public class VisitInfoServiceImpl implements VisitInfoService {
}
}
}
}*/
// 查询用户规则,如果配置了用户规则,则按照用户规则走
List<VisitInfoDO> visitInfoDOS = visitInfoMapper.selectList(new LambdaQueryWrapper<VisitInfoDO>()
......
......@@ -3,9 +3,12 @@ package cn.gintone.service;
import cn.gintone.ErrorInfo;
import cn.gintone.controller.vo.VisitPageReqVO;
import cn.gintone.controller.vo.VisitSaveReqVO;
import cn.gintone.dal.VisitInfoMapper;
import cn.gintone.dal.VisitMapper;
import cn.gintone.entity.VisitDO;
import cn.gintone.entity.VisitInfoDO;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -29,7 +32,7 @@ public class VisitServiceImpl implements VisitService {
private VisitMapper visitMapper;
@Autowired
private VisitInfoService visitInfoService;
private VisitInfoMapper visitInfoMapper;
@Override
public Long createVisit(VisitSaveReqVO createReqVO) {
......@@ -54,8 +57,11 @@ public class VisitServiceImpl implements VisitService {
// 校验存在
validateVisitExists(id);
// 删除
visitInfoMapper.delete(new UpdateWrapper<VisitInfoDO>()
.lambda()
.eq(VisitInfoDO::getVisitId, id)
);
visitMapper.deleteById(id);
visitInfoService.deleteVisitInfo(id);
}
private void validateVisitExists(Long id) {
......
......@@ -52,4 +52,6 @@ public interface WebReqConfService {
*/
List<WebReqConfDO> getWebReqConfList(WebReqConfListReqVO listReqVO);
Long myCreateWebReqConf(@Valid WebReqConfSaveReqVO createReqVO);
}
\ No newline at end of file
......@@ -7,6 +7,7 @@ import cn.gintone.dal.VisitInfoMapper;
import cn.gintone.dal.WebReqConfMapper;
import cn.gintone.entity.VisitInfoDO;
import cn.gintone.entity.WebReqConfDO;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
......@@ -142,4 +143,30 @@ public class WebReqConfServiceImpl implements WebReqConfService {
return webReqConfMapper.selectList(listReqVO);
}
@Override
public Long myCreateWebReqConf(WebReqConfSaveReqVO createReqVO) {
List<WebReqConfDO> webReqConfDOS = webReqConfMapper.selectList(new QueryWrapper<WebReqConfDO>()
.lambda()
.eq(WebReqConfDO::getApiId, createReqVO.getApiId())
);
if (webReqConfDOS != null && webReqConfDOS.size() > 0) {
for (WebReqConfDO webReqConfDO : webReqConfDOS) {
webReqConfDO.setApiUrl(createReqVO.getApiUrl());
webReqConfDO.setApiName(createReqVO.getApiName());
webReqConfMapper.updateById(webReqConfDO);
}
return 0L;
} else {
// 校验父级id的有效性
// validateParentWebReqConf(null, createReqVO.getParentId());
// 校验api名称的唯一性
// validateWebReqConfApiNameUnique(null, createReqVO.getParentId(), createReqVO.getApiName());
// 插入
WebReqConfDO webReqConf = BeanUtils.toBean(createReqVO, WebReqConfDO.class);
webReqConfMapper.insert(webReqConf);
return webReqConf.getId();
}
}
}
\ No newline at end of file
......@@ -21,7 +21,13 @@ public class BasicInfoHttpUtils {
Map<String, String> headers = new HashMap<String, String>();
headers.put("appkey", appkey);
headers.put("Authorization", pdToken);
String rStr = MyHttpThreeUtils.postJson(url, headers, null);
Map<String, Object> map = new HashMap<>();
map.put("page", 1);
map.put("pageSize", 10000);
String jsonString = JSON.toJSONString(map);
String rStr = MyHttpThreeUtils.postJson(url, headers, jsonString);
PtResult<PtData<PtDeptInfo>> result = JSON.parseObject(rStr, new TypeReference<PtResult<PtData<PtDeptInfo>>>() {});
return result;
}
......@@ -37,7 +43,14 @@ public class BasicInfoHttpUtils {
Map<String, String> headers = new HashMap<String, String>();
headers.put("appkey", appkey);
headers.put("Authorization", pdToken);
String rStr = MyHttpThreeUtils.postJson(url, headers, null);
Map<String, Object> map = new HashMap<>();
map.put("page", 1);
map.put("pageSize", 100000);
String jsonString = JSON.toJSONString(map);
String rStr = MyHttpThreeUtils.postJson(url, headers, jsonString);
PtResult<PtData<PtUserInfo>> result = JSON.parseObject(rStr, new TypeReference<PtResult<PtData<PtUserInfo>>>() {});
return result;
}
......@@ -91,7 +104,23 @@ public class BasicInfoHttpUtils {
}
/**
* 管点信息
* 易涝点设备信息
* @param url
* @param appkey
* @param pdToken
* @return
*/
public static PtResult<PtData<PtYLDInfo>> getYLDInfo(String url, String appkey, String pdToken) {
Map<String, String> headers = new HashMap<String, String>();
headers.put("appkey", appkey);
headers.put("Authorization", pdToken);
String rStr = MyHttpThreeUtils.postJson(url, headers, null);
PtResult<PtData<PtYLDInfo>> result = JSON.parseObject(rStr, new TypeReference<PtResult<PtData<PtYLDInfo>>>() {});
return result;
}
/**
* 管点设备信息
* @param url
* @param appkey
* @param pdToken
......@@ -121,4 +150,21 @@ public class BasicInfoHttpUtils {
PtResult<PtData<PtJgInfo>> result = JSON.parseObject(rStr, new TypeReference<PtResult<PtData<PtJgInfo>>>() {});
return result;
}
/**
* 获取平台菜单信息
* @param url
* @param appkey
* @param pdToken
* @return
*/
public static PtResult<PtData<PtMenuInfo>> getPtMenu(String url, String appkey, String pdToken) {
Map<String, String> headers = new HashMap<String, String>();
headers.put("appkey", appkey);
headers.put("Authorization", pdToken);
String rStr = MyHttpThreeUtils.postJson(url, headers, null);
PtResult<PtData<PtMenuInfo>> result = JSON.parseObject(rStr, new TypeReference<PtResult<PtData<PtMenuInfo>>>() {});
return result;
}
}
<?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="cn.iocoder.yudao.module.ptinfo.dal.mysql.ptdeptinfo.PtDeptInfoMapper">
<mapper namespace="cn.gintone.dal.PtDeptInfoMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
......
<?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="cn.gintone.dal.PtUserInfoMapper">
<!--
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
-->
</mapper>
\ No newline at end of file
......@@ -11,6 +11,7 @@ import cn.iocoder.yudao.framework.security.core.myVo.LoginUserInfo;
import cn.iocoder.yudao.framework.security.core.myVo.PtResult;
import cn.iocoder.yudao.framework.security.core.util.MyHttpTwoUtils;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.security.utils.MyReadApplicationUtils;
import cn.iocoder.yudao.framework.web.core.handler.GlobalExceptionHandler;
import cn.iocoder.yudao.framework.web.core.util.WebFrameworkUtils;
import cn.iocoder.yudao.module.system.api.oauth2.OAuth2TokenApi;
......@@ -52,41 +53,48 @@ public class TokenAuthenticationFilter extends OncePerRequestFilter {
@SuppressWarnings("NullableProblems")
protected void doFilterInternal(HttpServletRequest request, HttpServletResponse response, FilterChain chain)
throws ServletException, IOException {
MyReadApplicationUtils.readApplication();
String pdToken = request.getHeader("pdToken");
StringBuffer requestURL = request.getRequestURL();
stringRedisTemplate.opsForValue().set("pdToken", pdToken);
// System.out.println(requestURL.toString());
if (requestURL.toString().contains("system/") || requestURL.toString().contains("get-by-website") || requestURL.toString().contains("checkPdToken")) {
if (requestURL.toString().contains("system/") || requestURL.toString().contains("get-by-website") || requestURL.toString().contains("checkPdToken") || requestURL.toString().contains("initIotDBDatabase")) {
} else {
if (StrUtil.isBlank(pdToken)) {
pdToken = request.getParameter("pdToken");
if (StrUtil.isBlank(pdToken)) {
CommonResult<?> result = new CommonResult<>();
result.setCode(403);
result.setMsg("未登录");
CommonResult<?> result = new CommonResult<>();
result.setCode(403);
result.setMsg("未登录");
ServletUtils.writeJSON(response, result);
return;
} else {
Map<String, String> headers = new HashMap<>();
headers.put("appkey", MyReadApplicationUtils.getAppkey());
headers.put("Authorization", pdToken);
String rStr = MyHttpTwoUtils.get(MyReadApplicationUtils.getUserByToken(), headers, null);
PtResult<LoginUserInfo> result = JSON.parseObject(rStr, new TypeReference<PtResult<LoginUserInfo>>() {});
if (null == result || result.getCode() != 200) {
CommonResult<?> result1 = new CommonResult<>();
result1.setCode(403);
result1.setMsg("未登录");
ServletUtils.writeJSON(response, result);
return;
} else if (null == result || result.getCode() == 5001) {
CommonResult<?> result1 = new CommonResult<>();
result1.setCode(402);
result1.setMsg("Token无效");
ServletUtils.writeJSON(response, result);
} else {
/*Map<String, String> headers = new HashMap<>();
headers.put("appkey", "secure");
headers.put("Authorization", pdToken);
String rStr = MyHttpTwoUtils.get("http://127.0.0.1:7006/oauth/N100101", headers, null);
PtResult<LoginUserInfo> result = JSON.parseObject(rStr, new TypeReference<PtResult<LoginUserInfo>>() {});
if (null == result || !result.getCode().equals("200")) {
CommonResult<?> result1 = new CommonResult<>();
result1.setCode(403);
result1.setMsg("未登录");
ServletUtils.writeJSON(response, result);
} else {
LoginUserInfo data = result.getData();
String accessToken = data.getAccessToken();
stringRedisTemplate.opsForValue().set("pdToken", accessToken);
}*/
LoginUserInfo data = result.getData();
String accessToken = data.getAccessToken();
String refreshToken = data.getRefreshToken();
stringRedisTemplate.opsForValue().set("pdToken", accessToken);
stringRedisTemplate.opsForValue().set("refreshToken", refreshToken);
stringRedisTemplate.opsForValue().set("pdUserInfo", JSON.toJSONString(data));
}
return;
}
// return;
}
String token = SecurityFrameworkUtils.obtainAuthorization(request,
......
......@@ -4,7 +4,7 @@ public class PtResult<T> {
private String msg;
private String eventId;
private String flag;
private String code;
private Integer code;
private T data;
private String errorStack;
......@@ -12,7 +12,7 @@ public class PtResult<T> {
public PtResult() {
}
public PtResult(String code, String msg, T data, String eventId, String flag, String errorStack) {
public PtResult(Integer code, String msg, T data, String eventId, String flag, String errorStack) {
this.msg = msg;
this.eventId = eventId;
this.flag = flag;
......@@ -45,11 +45,11 @@ public class PtResult<T> {
this.flag = flag;
}
public String getCode() {
public Integer getCode() {
return code;
}
public void setCode(String code) {
public void setCode(Integer code) {
this.code = code;
}
......
......@@ -9,6 +9,7 @@ import org.springframework.http.*;
import org.springframework.http.client.HttpComponentsClientHttpRequestFactory;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestClientException;
import org.springframework.web.client.RestTemplate;
import javax.net.ssl.SSLContext;
......@@ -80,8 +81,14 @@ public class MyHttpTwoUtils {
// 处理URL参数
String fullUrl = buildUrlWithParams(url, params);
ResponseEntity<String> response = restTemplate.exchange(
fullUrl, HttpMethod.GET, requestEntity, String.class);
ResponseEntity<String> response = null;
try {
response = restTemplate.exchange(
fullUrl, HttpMethod.GET, requestEntity, String.class);
} catch (RestClientException e) {
System.out.println(e.getMessage());
return null;
}
return response.getBody();
}
......@@ -100,8 +107,14 @@ public class MyHttpTwoUtils {
}
HttpEntity<String> requestEntity = new HttpEntity<>(body, httpHeaders);
ResponseEntity<String> response = restTemplate.exchange(
url, HttpMethod.POST, requestEntity, String.class);
ResponseEntity<String> response = null;
try {
response = restTemplate.exchange(
url, HttpMethod.POST, requestEntity, String.class);
} catch (RestClientException e) {
System.out.println(e.getMessage());
return null;
}
return response.getBody();
}
......
package cn.iocoder.yudao.framework.security.utils;
import org.yaml.snakeyaml.Yaml;
import java.io.InputStream;
import java.util.Map;
public class MyReadApplicationUtils {
private static MyReadApplicationUtils myReadApplicationUtils;
private static String userByToken;
private static String appkey;
private static String userByrefresh;
private MyReadApplicationUtils() {
}
public static MyReadApplicationUtils getInstance() {
if (myReadApplicationUtils == null) {
myReadApplicationUtils = new MyReadApplicationUtils();
}
return myReadApplicationUtils;
}
public static String getUserByToken() {
if (null == userByToken || "".equals(userByToken)) {
readApplication();
}
return userByToken;
}
public static String getRefreByToken() {
if (null == userByrefresh || "".equals(userByrefresh)) {
readApplication();
}
return userByrefresh;
}
public static String getAppkey() {
if (null == appkey || "".equals(appkey)) {
readApplication();
}
return appkey;
}
public static void readApplication() {
// 1. 加载 application.yml 文件
Yaml yaml = new Yaml();
InputStream inputStream = MyReadApplicationUtils.class
.getClassLoader()
.getResourceAsStream("pttokeninfo.yml");
if (inputStream == null) {
throw new RuntimeException("pttokeninfo.yml 文件未找到!");
}
// 2. 解析 YAML 为 Map
Map<String, Object> yamlMap = yaml.load(inputStream);
// 3. 提取 pttoken 配置
Map<String, Object> pttokenConfig = (Map<String, Object>) yamlMap.get("pttoken");
if (pttokenConfig == null) {
throw new RuntimeException("pttoken 配置未找到!");
}
// 4. 获取具体配置项
userByToken = (String) pttokenConfig.get("user-by-token");
appkey = (String) pttokenConfig.get("appkey");
}
}
package cn.iocoder.yudao.module.system.controller.admin.myUtils;
import cn.iocoder.yudao.module.system.controller.admin.auth.myVo.LoginUserInfo;
import cn.iocoder.yudao.module.system.controller.admin.auth.myVo.PtResult;
import cn.iocoder.yudao.module.system.controller.admin.conf.PtUrlConf;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.TypeReference;
import java.util.HashMap;
import java.util.Map;
public class PtTokenUtils {
public static PtResult<LoginUserInfo> getUserByToken(PtUrlConf ptUrlConf, String appkey, String authorization) {
// 带参数和请求头
Map<String, String> headers = new HashMap<>();
headers.put("appkey", appkey);
headers.put("Authorization", authorization);
String rStr = MyHttpUtils.get(ptUrlConf.getGetUserByToken(), headers, null);
PtResult<LoginUserInfo> result = JSON.parseObject(rStr, new TypeReference<PtResult<LoginUserInfo>>() {});
return result;
}
}
......@@ -2,6 +2,7 @@ package cn.iocoder.yudao.server;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.scheduling.annotation.EnableScheduling;
/**
* 项目的启动类
......@@ -13,6 +14,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication;
* @author 芋道源码
*/
@SuppressWarnings("SpringComponentScan") // 忽略 IDEA 无法识别 ${yudao.info.base-package}
@EnableScheduling
@SpringBootApplication(scanBasePackages = {"${yudao.info.base-package}.server", "${yudao.info.base-package}.module","cn.gintone.**"})
public class YudaoServerApplication {
......
......@@ -54,10 +54,10 @@ spring:
# url: jdbc:oracle:thin:@127.0.0.1:1521:xe # Oracle 连接的示例
# url: jdbc:sqlserver://127.0.0.1:1433;DatabaseName=ruoyi-vue-pro;SelectMethod=cursor;encrypt=false;rewriteBatchedStatements=true;useUnicode=true;characterEncoding=utf-8 # SQLServer 连接的示例
# url: jdbc:dm://127.0.0.1:5236?schema=RUOYI_VUE_PRO # DM 连接的示例
url: jdbc:kingbase8://127.0.0.1:54321/test # 人大金仓 KingbaseES 连接的示例
url: jdbc:kingbase8://127.0.0.1:54321/ht_aq # 人大金仓 KingbaseES 连接的示例
# url: jdbc:postgresql://192.168.19.128:54321/test # OpenGauss 连接的示例
username: kingbase
password: kingbase
username: ht_aq
password: ht@1234
# username: sa # SQL Server 连接的示例
# password: Yudao@2024 # SQL Server 连接的示例
# username: SYSDBA # DM 连接的示例
......@@ -81,8 +81,8 @@ spring:
redis:
host: 127.0.0.1 # 地址
port: 6379 # 端口
database: 0 # 数据库索引
# password: dev # 密码,建议生产环境开启
database: 1 # 数据库索引
password: SXht@062025. # 密码,建议生产环境开启
--- #################### 定时任务相关配置 ####################
......@@ -132,7 +132,7 @@ spring:
# virtual-host: /
# Kafka 配置项,对应 KafkaProperties 配置类
kafka:
bootstrap-servers: 192.168.19.128:9092
bootstrap-servers: localhost:9092
producer:
retries: 3
timeout: 60000
......@@ -278,4 +278,11 @@ justauth:
--- #################### iot相关配置 TODO 芋艿【IOT】:再瞅瞅 ####################
pf4j:
# pluginsDir: /tmp/
pluginsDir: ../plugins
\ No newline at end of file
pluginsDir: ../plugins
iotdb:
# ip: 192.168.19.191
ip: 127.0.0.1
port: 6667
username: root
password: root
\ No newline at end of file
......@@ -4,6 +4,7 @@ spring:
profiles:
active: local
# active: dev
main:
allow-circular-references: true # 允许循环依赖,因为项目是三层架构,无法避免这个情况。
......@@ -364,24 +365,26 @@ debug: false
pf4j:
pluginsDir: /Users/anhaohao/code/gitee/ruoyi-vue-pro/plugins # 插件目录
iotdb:
# ip: 192.168.19.191
ip: 127.0.0.1
port: 6667
username: root
password: root
aes:
Key: sx+htIs=6a2t8qt%
ptauth:
loginUrl: http://3h.sritcloud.com:8000/oauth/N1001
getUserByToken: http://127.0.0.1:7006/oauth/N100101
getUserByCode: http://3h.sritcloud.com:8000/oauth/N100102
logOffToken: http://3h.sritcloud.com:8000/oauth/N1007
refTokenUrl: http://3h.sritcloud.com:8000/oauth/N1010
logOffTokenAndJump: http://3h.sritcloud.com:8000/oauth/oauth/logout?redirect_uri=
loginUrl: http://59.195.13.243:8000/oauth/N1001
getUserByToken: http://59.195.13.243:8000/oauth/N100101
getUserByCode: http://59.195.13.243:8000/oauth/N100102
logOffToken: http://59.195.13.243:8000/oauth/N1007
refTokenUrl: http://59.195.13.243:8000/oauth/N1010
logOffTokenAndJump: http://59.195.13.243:8000/oauth/oauth/logout?redirect_uri=
basicinfo:
userInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/user-info-list
\ No newline at end of file
userInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/user-info-list
deptInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/org-info-list
menuInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/sys-permission
bzInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/bzxxb
fkclInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/fkclxxb
sxtInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/sxtxxb
yldInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/yldsbxx
gdInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/dwd-obj-sbxx-gdsbxx
jgInfoUrl: http://59.195.13.243:8000/srit-open-api/data-service/api/dwd-obj-sbxx-jgsbxx
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