This commit is contained in:
rj
2025-10-29 21:58:55 +08:00
commit 582d7fceae
35 changed files with 2360 additions and 0 deletions

33
.gitignore vendored Normal file
View File

@@ -0,0 +1,33 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/

109
pom.xml Normal file
View File

@@ -0,0 +1,109 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.12.RELEASE</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>org.paperflow</groupId>
<artifactId>helpProjects</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>helpProjects</name>
<description>helpProjects</description>
<properties>
<java.version>8</java.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-validation</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-elasticsearch</artifactId>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-boot-starter</artifactId>
<version>3.5.3.1</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
<version>4.5.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-redis</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-cache</artifactId>
</dependency>
<dependency>
<groupId>org.postgresql</groupId>
<artifactId>postgresql</artifactId>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>3.3.2</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>5.8.25</version>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>33.0.0-jre</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>8.1.0</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.bouncycastle</groupId>
<artifactId>bcpkix-jdk18on</artifactId>
<version>1.78</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>
</build>
</project>

View File

@@ -0,0 +1,17 @@
package org.paperflow.helpprojects;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cache.annotation.EnableCaching;
@EnableCaching
@MapperScan("org.paperflow.helpprojects.**.mapper")
@SpringBootApplication
public class HelpProjectsApplication {
public static void main(String[] args) {
SpringApplication.run(HelpProjectsApplication.class, args);
}
}

View File

@@ -0,0 +1,10 @@
package org.paperflow.helpprojects.config;
import org.springframework.context.annotation.Configuration;
/**
* @author vicro
*/
//@Configuration
public class RedisConfig {
}

View File

@@ -0,0 +1,5 @@
package org.paperflow.helpprojects.inoutRecordService;
public interface BaseMapper<T> extends com.baomidou.mybatisplus.core.mapper.BaseMapper<T> {
}

View File

@@ -0,0 +1,11 @@
package org.paperflow.helpprojects.inoutRecordService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.paperflow.helpprojects.inoutRecordService.domain.SuperEntity;
import org.springframework.validation.annotation.Validated;
@Validated
public class BaseService<M extends BaseMapper<T>, T extends SuperEntity> extends ServiceImpl<M, T>{
}

View File

@@ -0,0 +1,86 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import cn.hutool.core.date.DatePattern;
import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@TableName("af_in_out_record")
@ApiModel( description = "道闸出入记录 实体")
@ExcelIgnoreUnannotated
public class AfInOutRecord extends BaseEntity {
/**
* The Constant serialVersionUID.
*/
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "名称")
@TableField(exist = false)
@ExcelProperty(value = "名称",order=1)
private String name;
@ApiModelProperty(value = "用户ID")
private String userId;
@ApiModelProperty(value = "人员类型: 1_外部人员 2_内部人员 owner_Type")
@ExcelProperty(value = "人员类型",order = 2)
private String userType;
@ApiModelProperty(value = "出入类型: 0_进门 1_出门 access_type")
@ExcelProperty(value = "出入类型",order = 3)
private String type;
@ApiModelProperty(value = "通行方式: 1_刷卡 2_刷码 3_刷脸 ,4_身份证,0_未知 security_passage_mode")
@ExcelProperty(value = "通行方式",order = 4)
private String passageMode;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss") // 入参格式化 前端传给后端的
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss", timezone = "GMT+8") // 出参格式化 后端传给前端的
@ApiModelProperty(value = "通行时间")
@com.alibaba.excel.annotation.format.DateTimeFormat(DatePattern.NORM_DATETIME_PATTERN)
@ExcelProperty(value = "通行时间",order = 5)
private Date passageTime;
@ApiModelProperty(value = "体温")
@ExcelProperty(value = "体温",order = 6)
private String temperature;
@ApiModelProperty(value = "抓拍图片")
private String img;
@ApiModelProperty(value = "园区ID")
private String parkId;
@ApiModelProperty(value = "设备key")
private String deviceKey;
@ApiModelProperty(value = "设备名称")
@TableField(exist = false)
@ExcelProperty(value = "设备名",order = 7)
private String deviceName;
@ApiModelProperty(value = "访客电话")
@TableField(exist = false)
@ExcelProperty(value = "手机",order = 8)
private String userPhone;
@ApiModelProperty(value = "所属部门")
@TableField(exist = false)
@ExcelProperty(value = "部门",order = 9)
private String officeName;
}

View File

@@ -0,0 +1,84 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* @author 86136
* @create 2021-10-26 10:49
* @desc
**/
@Data
@TableName("af_person_track")
@ApiModel( description = "道闸出入记录 实体")
public class AfPersonTrack extends BaseEntity {
@ApiModelProperty(value = "用户ID")
private String userId;
@ApiModelProperty(value = "1内部人员 2外部人员 3陌生人")
private String userType;
@ApiModelProperty(value = "设备key")
private String deviceKey;
@ApiModelProperty(value = "检查方式")
private String productType;
@ApiModelProperty(value = "抓拍图片id")
private String attachId;
@ApiModelProperty(value = "检测轨迹时间")
private String trackTime;
@ApiModelProperty(value = "园区ID")
private String parkId;
@ApiModelProperty(value = "人员名称")
@TableField(exist = false)
private String userName;
@ApiModelProperty(value = "人员联系方式")
@TableField(exist = false)
private String userPhone;
@ApiModelProperty(value = "人员头像")
@TableField(exist = false)
private String userPhoto;
@ApiModelProperty(value = "所属部门名称")
@TableField(exist = false)
private String officeName;
@ApiModelProperty(value = "监控设备名称")
@TableField(exist = false)
private String deviceName;
@ApiModelProperty(value = "设备位置")
@TableField(exist = false)
private String aliasName;
@ApiModelProperty(value = "抓拍图片路径")
@TableField(exist = false)
private String fileUrl;
@ApiModelProperty(value = "开始时间")
@TableField(exist = false)
private String startTime;
@ApiModelProperty(value = "结束时间")
@TableField(exist = false)
private String endTime;
@ApiModelProperty(value = "经度")
@TableField(exist = false)
private String longitude;
@ApiModelProperty(value = "维度")
@TableField(exist = false)
private String latitude;
}

View File

@@ -0,0 +1,56 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableLogic;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;
import java.util.Date;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(description = "基础实体类")
public class BaseEntity extends IdEntity {
@ApiModelProperty(value = "创建人")
@TableField(value="create_by", fill = FieldFill.INSERT)
private String createBy;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale="zh", timezone="GMT+8")
@ApiModelProperty(value = "创建时间")
@TableField(value="create_date", fill = FieldFill.INSERT)
private Date createDate;
@ApiModelProperty(value = "更新人")
@TableField(value="update_by", fill = FieldFill.INSERT_UPDATE)
private String updateBy;
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale="zh", timezone="GMT+8")
@ApiModelProperty(value = "更新时间")
@TableField(value="update_date", fill = FieldFill.INSERT_UPDATE)
private Date updateDate;
@ApiModelProperty(value = "备注")
private String remarks;
/** 是否删除 1删除 0未删除**/
@TableLogic(value = "0", delval = "1")
@ApiModelProperty(value = "是否删除")
@TableField(value="del_flag", fill = FieldFill.INSERT)
private String delFlag;
/********************************* 非数据库字段 **********************************/
/** 多条件查询 **/
@TableField(exist = false)
private String conditionQuery;
}

View File

@@ -0,0 +1,36 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import lombok.Data;
import java.util.Date;
@Data
public class DeviceEntity extends BaseEntity{
private static final long serialVersionUID = -6716200226645140363L;
/** 产品名称 **/
private String productName;
/** 产品key **/
private String productKey;
/** 产品类型 **/
private String productType;
/** 产品型号 **/
private String productModel;
/** 提供商名称 **/
private String manufacturerName;
/** 描述 **/
private String description;
/** 设备名称 **/
private String deviceName;
/** 设备key **/
private String deviceKey;
/** 设备状态 0离线 1在线 **/
private String state;
/** 心跳类型 0手动 1自动 **/
private String heartbeatType;
/** 上级设备key **/
private String parentDeviceKey;
/** 心跳时间*/
private Date heartbeatTime;
}

View File

@@ -0,0 +1,28 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import lombok.Data;
/**
* ClassName: DeviceReport
* @Description: TODO
* @author zx
* @date 2020年9月2日
*/
@Data
public class DeviceReport {
/** 园区ID **/
private String parkId;
/** 设备key **/
private String deviceKey;
/** 产品类型 **/
private String productType;
/** 产品key **/
private String productKey;
/** 时间戳 **/
private long timestamp;
/** 上报数据 **/
private String data;
/** 设备名称**/
private String deviceName;
}

View File

@@ -0,0 +1,31 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
/**
* ClassName:FkCustomerManage <br>
* Function: 人行道闸
* @author zsh
* @version 2020-3-18
*/
@EqualsAndHashCode(callSuper = true)
@Data
@TableName(value = "fk_guest_walk_device")
public class DeviceWalk extends DeviceEntity {
private static final long serialVersionUID = 504733878790448334L;
/** 园区id **/
private String parkId;
/** 出入类型 0:进1:出 **/
private String accessType;
// /**经度*/
// @ApiModelProperty("经度")
// private String longitude;
// /**维度*/
// @ApiModelProperty("维度")
// private String latitude;
}

View File

@@ -0,0 +1,185 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.experimental.Accessors;
import java.io.Serializable;
import java.util.Date;
/**
* ClassName: HeatRecord
*
* @author zx
* @Description: 人脸体温记录
* @date 2020年3月7日
*/
@TableName(value = "jk_face_heat_record")
@Data
@EqualsAndHashCode(callSuper = true)
@Accessors(chain = true)
@ApiModel( description = "测温记录 实体类")
public class HeatRecord extends BaseEntity implements Serializable {
/**
* serialVersionUID
*/
private static final long serialVersionUID = -348274013933261305L;
/**
* 用户ID
*/
@ApiModelProperty(value = "用户ID")
private String userId;
/**
* 用户
*/
@ApiModelProperty(value = "用户")
private String name;
/**数据来源 1表示魔方2表示华府**/
@TableField(exist = false)
private String sourceType;
/**第三方流水号id*/
@ApiModelProperty(value = "第三方流水号id")
private String taskId;
/**
* 人脸识别唯一码
*/
@ApiModelProperty(value = "人脸识别唯一码")
private String code;
/**
* 公司名称
*/
@ApiModelProperty(value = "公司名称")
private String companyName;
/**
* 部门名称
*/
@ApiModelProperty(value = "部门名称")
private String deptName;
/**
* 手机
*/
@ApiModelProperty(value = "手机")
private String mobile;
/**
* 温度
*/
@ApiModelProperty(value = "温度")
private String heat;
/**
* 是否佩戴口罩
*/
@ApiModelProperty(value = "是否佩戴口罩 0未知 1未识别 2没戴口罩 3戴口罩")
private String isMasks;
/**
* 人脸图
*/
@ApiModelProperty(value = "人脸图")
private String face;
/**
* 抓拍
*/
@ApiModelProperty(value = "抓拍")
private String snap;
/**
* 识别率
*/
@ApiModelProperty(value = "识别率")
private String similarity;
/**
* 是否正常
*/
@ApiModelProperty(value = "是否正常 1 正常 0不正常")
private String isNormal;
/**
* 记录时间
*/
@ApiModelProperty(value = "记录时间")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date reportTime;
/**
* 用户类别
*/
@ApiModelProperty(value = "用户类别,1内部人员2外部人员")
private String userType;
/**
* parkId
*/
private String parkId;
/**
* 设备key
*/
@ApiModelProperty(value = "设备key")
private String deviceKey;
/**
* 年龄
*/
@ApiModelProperty(value = "年龄")
private Integer age;
/**
* 性别
*/
@ApiModelProperty(value = "性别 0未知 1男 2女")
private String sex;
/**
* 是否有帽子
*/
@ApiModelProperty(value = "是否有帽子")
private String isHat;
/**
* 是否有眼镜
*/
@ApiModelProperty(value = "是否有眼镜")
private String isGlasses;
/**
* 预警温度
*/
@ApiModelProperty(value = "预警温度")
private String warnHeat;
/**
* 位置
*/
@ApiModelProperty(value = "位置")
@TableField(exist = false)
private String buildName;
/**
* startTime
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField(exist = false)
private Date startTime;
/**
* endTime
*/
@JsonFormat(pattern = "yyyy-MM-dd")
@TableField(exist = false)
private Date endTime;
}

View File

@@ -0,0 +1,48 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import lombok.Data;
/**
* @author vicro
*/
@Data
public class HfFace {
/**
* 健康码状态 健康码颜色0-绿色1-黄色2-红色3-未知4-数据异常5-验证失败 by wxd 2022-7-26 成电健康通
*/
private String healthCode;
/**访客身份证号 **/
private String userICard;
/**抓拍图片*/
private String entryPhoto;
/**手机号*/
private String userPhone;
/**用户名*/
private String userName;
/**卡号*/
private String userCardNo;
/**比对时间*/
private String entryTime;
/**道闸deviceKey*/
private String barrierGateId;
/**识别方式 1-刷卡 2-人脸识别*/
private String entryType;
/**园区id*/
private String parkId;
/**相似度*/
private String confidence;
/**是否佩戴口罩*/
private String mask;
/**体温*/
private String temperature;
/**设备名称*/
private String deviceName;
/**任务id*/
private String taskId;
/**数据来源,日志中用到记录数据合并来源目前1为魔方2为华付*/
private String sourceType;
/**识别是否成功*/
private Integer isSuccess;
}

View File

@@ -0,0 +1,20 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
@EqualsAndHashCode(callSuper = true)
@Data
@ApiModel(description = "ID实体类")
public class IdEntity extends SuperEntity {
@ApiModelProperty(value = "主键")
@TableId(value = "id", type = IdType.ASSIGN_ID)
public String id;
}

View File

@@ -0,0 +1,37 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import com.alibaba.excel.annotation.ExcelProperty;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import javax.validation.constraints.NotBlank;
import java.io.Serializable;
@Data
@NoArgsConstructor
@TableName("park_user")
public class ParkUser extends SuperEntity {
/**
* 工号
**/
@ExcelProperty(value = "用户id",index = 0)
@ApiModelProperty(value = "工号")
private String userId;
/**
* 姓名
**/
@ExcelProperty(value = "姓名",index = 2)
@ApiModelProperty(value = "姓名")
@NotBlank(message = "姓名不能为空")
private String name;
@ExcelProperty(value = "手机号",index = 1)
private String phone;
@ExcelProperty(value = "园区id",index = 3)
private String parkId;
}

View File

@@ -0,0 +1,14 @@
package org.paperflow.helpprojects.inoutRecordService.domain;
import java.io.Serializable;
/**
* @author zhaoxuan
* @title: SuperEntity
* @projectName iot-park
* @description: TODO
* @date 2021/11/1213:53
*/
public class SuperEntity implements Serializable {
}

View File

@@ -0,0 +1,14 @@
package org.paperflow.helpprojects.inoutRecordService.mapper;
import org.paperflow.helpprojects.inoutRecordService.BaseMapper;
import org.paperflow.helpprojects.inoutRecordService.domain.AfInOutRecord;
/**
* @Author:wangb
* @Description: 通道出入记录
* @Date 2021-04-16
**/
public interface AfInOutRecordMapper extends BaseMapper<AfInOutRecord> {
}

View File

@@ -0,0 +1,15 @@
package org.paperflow.helpprojects.inoutRecordService.mapper;
import org.paperflow.helpprojects.inoutRecordService.BaseMapper;
import org.paperflow.helpprojects.inoutRecordService.domain.DeviceWalk;
/**
* ClassName: FootWalkDeviceDao <br>
* Function: '%Y-%m-%d'DAO接口
* @author zsh
* @version 2020-3-18
*/
public interface DeviceWalkDao extends BaseMapper<DeviceWalk> {
}

View File

@@ -0,0 +1,9 @@
package org.paperflow.helpprojects.inoutRecordService.mapper;
import org.paperflow.helpprojects.inoutRecordService.BaseMapper;
import org.paperflow.helpprojects.inoutRecordService.domain.HeatRecord;
public interface HeatRecordDao extends BaseMapper<HeatRecord> {
}

View File

@@ -0,0 +1,10 @@
package org.paperflow.helpprojects.inoutRecordService.mapper;
import org.paperflow.helpprojects.inoutRecordService.BaseMapper;
import org.paperflow.helpprojects.inoutRecordService.domain.HeatRecord;
import org.paperflow.helpprojects.inoutRecordService.domain.ParkUser;
public interface ParkUserMapper extends BaseMapper<ParkUser> {
}

View File

@@ -0,0 +1,15 @@
package org.paperflow.helpprojects.inoutRecordService.mapper;
import org.paperflow.helpprojects.inoutRecordService.BaseMapper;
import org.paperflow.helpprojects.inoutRecordService.domain.AfPersonTrack;
import java.util.List;
/**
* @author 86136
* @create 2021-10-26 11:04
* @desc
**/
public interface PersonTrackMapper extends BaseMapper<AfPersonTrack> {
}

View File

@@ -0,0 +1,40 @@
package org.paperflow.helpprojects.inoutRecordService.service;
import org.apache.ibatis.annotations.Param;
import org.paperflow.helpprojects.inoutRecordService.BaseService;
import org.paperflow.helpprojects.inoutRecordService.domain.AfInOutRecord;
import org.paperflow.helpprojects.inoutRecordService.mapper.AfInOutRecordMapper;
import org.springframework.stereotype.Component;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource;
import java.util.List;
import java.util.Map;
/**
* @Author:ALP
* @Description: 通道出入记录
* @Date 2021-04-16
**/
@Transactional(readOnly = true)
@Service
public class AfInOutRecordService extends BaseService<AfInOutRecordMapper, AfInOutRecord> {
/**
* @param entity 通道记录DO
* @return boolean
*/
@Override
@Transactional(rollbackFor = Exception.class)
public boolean save(AfInOutRecord entity) {
if(entity!=null){
return super.save(entity);
}else{
return Boolean.FALSE;
}
}
}

View File

@@ -0,0 +1,34 @@
package org.paperflow.helpprojects.inoutRecordService.service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.paperflow.helpprojects.inoutRecordService.BaseService;
import org.paperflow.helpprojects.inoutRecordService.domain.DeviceEntity;
import org.paperflow.helpprojects.inoutRecordService.domain.DeviceWalk;
import org.paperflow.helpprojects.inoutRecordService.mapper.DeviceWalkDao;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Component;
import org.springframework.transaction.annotation.Transactional;
/**
* ClassName: FootWalkDeviceService
* Function: 人行道闸服务层service
*
* @author zsh
* @version 2020-3-18
*/
@Slf4j
@Component
@Transactional(readOnly = true)
@RequiredArgsConstructor
public class DeviceWalkService extends BaseService<DeviceWalkDao, DeviceWalk> {
@Cacheable(value = "deviceWalk", key = "#deviceKey", unless = "#result == null")
public DeviceWalk getByDeviceKey(String deviceKey) {
return getOne(Wrappers.lambdaQuery(DeviceWalk.class)
.eq(DeviceWalk::getDeviceKey, deviceKey)
.last("limit 1"));
}
}

View File

@@ -0,0 +1,17 @@
package org.paperflow.helpprojects.inoutRecordService.service;
import lombok.extern.slf4j.Slf4j;
import org.paperflow.helpprojects.inoutRecordService.BaseService;
import org.paperflow.helpprojects.inoutRecordService.domain.HeatRecord;
import org.paperflow.helpprojects.inoutRecordService.mapper.HeatRecordDao;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
@Transactional(readOnly = true)
public class HeatRecordService extends BaseService<HeatRecordDao, HeatRecord> {
}

View File

@@ -0,0 +1,26 @@
package org.paperflow.helpprojects.inoutRecordService.service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import lombok.extern.slf4j.Slf4j;
import org.paperflow.helpprojects.inoutRecordService.BaseService;
import org.paperflow.helpprojects.inoutRecordService.domain.HeatRecord;
import org.paperflow.helpprojects.inoutRecordService.domain.ParkUser;
import org.paperflow.helpprojects.inoutRecordService.mapper.HeatRecordDao;
import org.paperflow.helpprojects.inoutRecordService.mapper.ParkUserMapper;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@Slf4j
@Service
@Transactional(readOnly = true)
public class ParkUserService extends BaseService<ParkUserMapper, ParkUser> {
@Cacheable(value = "parkUser", key = "#userPhone+':'+#parkId", unless = "#result == null")
public ParkUser getUserByMobileAndParkId(String userPhone, String parkId) {
return getOne(Wrappers.lambdaQuery(ParkUser.class)
.eq(ParkUser::getPhone, userPhone)
.eq(ParkUser::getParkId, parkId).last("limit 1"));
}
}

View File

@@ -0,0 +1,18 @@
package org.paperflow.helpprojects.inoutRecordService.service;
import org.paperflow.helpprojects.inoutRecordService.BaseService;
import org.paperflow.helpprojects.inoutRecordService.domain.AfPersonTrack;
import org.paperflow.helpprojects.inoutRecordService.mapper.PersonTrackMapper;
import org.springframework.stereotype.Service;
/**
* @author 86136
* @create 2021-10-26 11:03
* @desc
**/
@Service
public class PersonTrackService extends BaseService<PersonTrackMapper, AfPersonTrack> {
}

View File

@@ -0,0 +1,13 @@
spring:
application:
name: helpProjects
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://10.206.20.45:5432/rev_park?stringtype=unspecified&currentSchema=recovery
username: postgres
password: zhyq@2023
redis:
host: 10.206.20.45
port: 6379
password: zhyq@2023
database: 3

View File

@@ -0,0 +1,2 @@
2699b530e3bfc730f510760efb37d1fcf861d7fe08f7b33760c2a7d914e98f8ef27bdf493021e54d51079b0a9abbbf182c219fb2a4bcced438fcea4f681f03c
e26ae46ac22e98741d79f357bc8e9799c49514a17e10b28f3cbb011c00bc5e6f00998365e32436eb391fbb2ed0894381b542a8b5472a3578715f5e96a21de33b

View File

@@ -0,0 +1,675 @@
{
"openapi": "3.0.3",
"info": {
"title": "标题world_cup后台管理系统_接口文档",
"description": "描述用于管理集团旗下公司的此后台管理系统_接口文档",
"contact": {
"name": "admin"
},
"version": "版本号: 3.2.0"
},
"servers": [
{
"url": "https://api.alphadogepool.club:443",
"description": "Inferred Url"
}
],
"tags": [
{
"name": "ASIC矿机管理",
"description": "Bsc Asic Controller"
},
{
"name": "用户管理",
"description": "Bsc User Controller"
},
{
"name": "通用管理",
"description": "Bsc Common Controller"
}
],
"paths": {
"/prod-api/app/asic/list": {
"get": {
"tags": [
"ASIC矿机管理"
],
"summary": "查询ASIC矿机列表",
"operationId": "listUsingGET",
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/请求响应对象«List«ASIC矿机视图对象»»"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"Authorization": [
"global"
]
}
]
}
},
"/prod-api/app/common/getDate": {
"get": {
"tags": [
"通用管理"
],
"summary": "获取服务器时间",
"operationId": "getDateUsingGET",
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/请求响应对象«date-time»"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"Authorization": [
"global"
]
}
]
}
},
"/prod-api/app/common/getDictValues": {
"get": {
"tags": [
"通用管理"
],
"summary": "获取字典数据",
"description": "111-审计报告 112-检查公司 113-中文电报群组 114-英文电报群组 115-在线客服 116-小狐狸 117-币安 118-飞机",
"operationId": "getDictValuesUsingGET",
"parameters": [
{
"name": "dict",
"in": "query",
"description": "字典数组",
"required": false,
"style": "form",
"explode": true,
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/请求响应对象"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"Authorization": [
"global"
]
}
]
}
},
"/prod-api/app/user/getAlgebra": {
"get": {
"tags": [
"用户管理"
],
"summary": "查询代数列表",
"operationId": "getAlgebraUsingGET",
"parameters": [
{
"name": "address",
"in": "query",
"description": "address",
"required": true,
"style": "form",
"schema": {
"type": "string"
}
},
{
"name": "chainId",
"in": "query",
"description": "chainId",
"required": true,
"style": "form",
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/请求响应对象"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"Authorization": [
"global"
]
}
]
}
},
"/prod-api/app/user/getInfo": {
"get": {
"tags": [
"用户管理"
],
"summary": "账户仪表盘",
"operationId": "getInfoUsingGET",
"parameters": [
{
"name": "address",
"in": "query",
"description": "address",
"required": true,
"style": "form",
"schema": {
"type": "string"
}
},
{
"name": "chainId",
"in": "query",
"description": "chainId",
"required": true,
"style": "form",
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/请求响应对象"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"Authorization": [
"global"
]
}
]
}
},
"/prod-api/app/user/getUserByAddress": {
"get": {
"tags": [
"用户管理"
],
"summary": "获取用户信息",
"operationId": "getUserByAddressUsingGET",
"parameters": [
{
"name": "address",
"in": "query",
"description": "address",
"required": true,
"style": "form",
"schema": {
"type": "string"
}
},
{
"name": "chainId",
"in": "query",
"description": "chainId",
"required": true,
"style": "form",
"schema": {
"type": "integer",
"format": "int64"
}
}
],
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/请求响应对象«用户视图对象»"
}
}
}
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"Authorization": [
"global"
]
}
]
}
},
"/prod-api/app/user/register": {
"post": {
"tags": [
"用户管理"
],
"summary": "用户注册",
"description": "非必传邀请人",
"operationId": "registerUsingPOST",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/用户管理业务对象"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/请求响应对象"
}
}
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"Authorization": [
"global"
]
}
]
}
},
"/prod-api/app/user/withdrawal": {
"post": {
"tags": [
"用户管理"
],
"summary": "提现",
"operationId": "withdrawalUsingPOST",
"requestBody": {
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/充值提现对象"
}
}
}
},
"responses": {
"200": {
"description": "OK",
"content": {
"*/*": {
"schema": {
"$ref": "#/components/schemas/请求响应对象"
}
}
}
},
"201": {
"description": "Created"
},
"401": {
"description": "Unauthorized"
},
"403": {
"description": "Forbidden"
},
"404": {
"description": "Not Found"
}
},
"security": [
{
"Authorization": [
"global"
]
}
]
}
}
},
"components": {
"schemas": {
"ASIC矿机视图对象": {
"title": "ASIC矿机视图对象",
"type": "object",
"properties": {
"cf": {
"type": "string",
"description": "算力"
},
"createTime": {
"type": "string",
"description": "创建日期",
"format": "date-time"
},
"dailyEarnings": {
"type": "number",
"description": "日收益",
"format": "bigdecimal"
},
"holdingAmount": {
"type": "number",
"description": "持有额度",
"format": "bigdecimal"
},
"id": {
"type": "integer",
"description": "id",
"format": "int64"
},
"name": {
"type": "string",
"description": "硬件类型"
},
"profitMargin": {
"type": "number",
"description": "区块利润率",
"format": "bigdecimal"
},
"remarks": {
"type": "string",
"description": "备注"
}
}
},
"充值提现对象": {
"title": "充值提现对象",
"required": [
"address",
"txid"
],
"type": "object",
"properties": {
"address": {
"type": "string",
"description": "地址"
},
"chainId": {
"type": "integer",
"description": "0波场 1eth 56bsc",
"format": "int64"
},
"txid": {
"type": "string",
"description": "txid"
}
}
},
"用户管理业务对象": {
"title": "用户管理业务对象",
"required": [
"address"
],
"type": "object",
"properties": {
"address": {
"type": "string",
"description": "地址"
},
"chainId": {
"type": "integer",
"description": "0波场 1eth 56bsc",
"format": "int64"
},
"upAddress": {
"type": "string",
"description": "邀请人地址"
}
}
},
"用户视图对象": {
"title": "用户视图对象",
"type": "object",
"properties": {
"address": {
"type": "string",
"description": "地址"
},
"approveBalance": {
"type": "number",
"description": "授权额度",
"format": "bigdecimal"
},
"chainId": {
"type": "integer",
"description": "链id0-波场 1-ETH主网 56-BSC主网 ",
"format": "int64"
},
"createTime": {
"type": "string",
"description": "创建日期",
"format": "date-time"
},
"id": {
"type": "integer",
"description": "id",
"format": "int64"
},
"ipAddr": {
"type": "string",
"description": "ip"
},
"isFreeze": {
"type": "integer",
"description": "0正常 1冻结",
"format": "int64"
},
"recommendCount": {
"type": "integer",
"description": "直推人数",
"format": "int64"
},
"txBalance": {
"type": "number",
"description": "待领取余额",
"format": "bigdecimal"
},
"upAddress": {
"type": "string",
"description": "邀请人"
},
"usdtBalance": {
"type": "number",
"description": "USDT余额",
"format": "bigdecimal"
}
}
},
"请求响应对象": {
"title": "请求响应对象",
"type": "object",
"properties": {
"code": {
"type": "integer",
"description": "消息状态码",
"format": "int32"
},
"data": {
"type": "object",
"description": "数据对象"
},
"msg": {
"type": "string",
"description": "消息内容"
}
}
},
"请求响应对象«List«ASIC矿机视图对象»»": {
"title": "请求响应对象«List«ASIC矿机视图对象»»",
"type": "object",
"properties": {
"code": {
"type": "integer",
"description": "消息状态码",
"format": "int32"
},
"data": {
"type": "array",
"description": "数据对象",
"items": {
"$ref": "#/components/schemas/ASIC矿机视图对象"
}
},
"msg": {
"type": "string",
"description": "消息内容"
}
}
},
"请求响应对象«date-time»": {
"title": "请求响应对象«date-time»",
"type": "object",
"properties": {
"code": {
"type": "integer",
"description": "消息状态码",
"format": "int32"
},
"data": {
"type": "string",
"description": "数据对象",
"format": "date-time"
},
"msg": {
"type": "string",
"description": "消息内容"
}
}
},
"请求响应对象«用户视图对象»": {
"title": "请求响应对象«用户视图对象»",
"type": "object",
"properties": {
"code": {
"type": "integer",
"description": "消息状态码",
"format": "int32"
},
"data": {
"description": "数据对象",
"$ref": "#/components/schemas/用户视图对象"
},
"msg": {
"type": "string",
"description": "消息内容"
}
}
}
},
"securitySchemes": {
"Authorization": {
"type": "apiKey",
"name": "Authorization",
"in": "header"
}
}
}
}

View File

@@ -0,0 +1,96 @@
<?xml version="1.0" encoding="UTF-8"?>
<!-- 日志级别从低到高分为TRACE < DEBUG < INFO < WARN < ERROR < FATAL如果设置为WARN则低于WARN的信息都不会输出 -->
<!-- scan:当此属性设置为true时配置文件如果发生改变将会被重新加载默认值为true -->
<!-- scanPeriod:设置监测配置文件是否有修改的时间间隔如果没有给出时间单位默认单位是毫秒。当scan为true时此属性生效。默认的时间间隔为1分钟。 -->
<!-- debug:当此属性设置为true时将打印出logback内部日志信息实时查看logback运行状态。默认值为false。 -->
<configuration scan="true" scanPeriod="10 seconds">
<contextName>logback</contextName>
<!--
使用logback打印日志读取配置的变量时出现大量XXX_IS_UNDEFINED日志文件的问题的原因并提供了对应的解决方案。
1、注意bootstrap.properties->application.properties的加载顺序
2、注意logback.xml->application.properties->logback-spring.xml的加载顺序
3、通过logging.config属性指定logback配置文件保证logback配置文件在spring属性文件之后加载
所以修改logback-spring.xml 为 logback-spring.xml
-->
<springProperty scope="context" name="APP_NAME" source="spring.application.name" defaultValue="park-service"/>
<springProperty scope="context" name="LOG_PATH" source="logging.path" defaultValue="./logs"/>
<springProperty scope="context" name="LOG_LEVEL" source="logging.level.root" defaultValue="info"/>
<!-- 彩色日志依赖的渲染类 -->
<conversionRule conversionWord="clr" converterClass="org.springframework.boot.logging.logback.ColorConverter" />
<conversionRule conversionWord="wex" converterClass="org.springframework.boot.logging.logback.WhitespaceThrowableProxyConverter" />
<conversionRule conversionWord="wEx" converterClass="org.springframework.boot.logging.logback.ExtendedWhitespaceThrowableProxyConverter" />
<!-- 主机IP地址转换器 -->
<conversionRule conversionWord="ip" converterClass="com.sccl.park.gateway.custom.CustomLogConverter" />
<!-- 彩色日志格式 -->
<property name="CONSOLE_LOG_PATTERN" value="${CONSOLE_LOG_PATTERN:-%clr(%d{yyyy-MM-dd HH:mm:ss.SSS}){faint} [trackId=%X{trackId}] %clr(${LOG_LEVEL_PATTERN:-%5p}) %clr(${PID:- }){magenta} %clr(---){faint} %clr([%15.15t]){faint} %clr(%-40.40logger{39}){cyan} %clr(:){faint} %m%n${LOG_EXCEPTION_CONVERSION_WORD:-%wEx}}"/>
<!--输出到控制台-->
<appender name="CONSOLE" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<Pattern>${CONSOLE_LOG_PATTERN}</Pattern>
<!-- 设置字符集 -->
<charset>UTF-8</charset>
</encoder>
<!--此日志appender是为开发使用只配置最底级别控制台输出的日志级别是大于或等于此级别的日志信息-->
<filter class="ch.qos.logback.classic.filter.ThresholdFilter">
<level>DEBUG</level>
</filter>
</appender>
<appender name="FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/${APP_NAME}.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{trackId}] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset>
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 文件限制20mb每个-->
<maxFileSize>20MB</maxFileSize>
<!-- 归档文件名-->
<fileNamePattern>${LOG_PATH}/${APP_NAME}.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- 历史记录最多保存30天-->
<maxHistory>30</maxHistory>
<!-- 归档文件整体最多保存10GB-->
<totalSizeCap>10GB</totalSizeCap>
</rollingPolicy>
</appender>
<!-- 时间滚动输出 level为 ERROR 日志,用于方便的查找错误信息 -->
<appender name="ERROR_FILE" class="ch.qos.logback.core.rolling.RollingFileAppender">
<!-- 正在记录的日志文件的路径及文件名 -->
<file>${LOG_PATH}/${APP_NAME}_error.log</file>
<!--日志文件输出格式-->
<encoder>
<pattern>%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] [%X{trackId}] %-5level %logger{50} - %msg%n</pattern>
<charset>UTF-8</charset> <!-- 此处设置字符集 -->
</encoder>
<!-- 日志记录器的滚动策略,按日期,按大小记录 -->
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<!-- 文件限制20mb每个-->
<maxFileSize>20MB</maxFileSize>
<!-- 归档文件名-->
<fileNamePattern>${LOG_PATH}/${APP_NAME}_error.%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!-- 历史记录最多保存30天-->
<maxHistory>30</maxHistory>
<!-- 归档文件整体最多保存10GB-->
<totalSizeCap>10GB</totalSizeCap>
</rollingPolicy>
<!-- 此日志文件只记录ERROR级别的 -->
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<level>ERROR</level>
<onMatch>ACCEPT</onMatch>
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<root level="${LOG_LEVEL}">
<appender-ref ref="CONSOLE" />
<appender-ref ref="FILE" />
<appender-ref ref="ERROR_FILE" />
</root>
</configuration>

View File

@@ -0,0 +1,172 @@
package org.paperflow.helpprojects;
import cn.hutool.core.util.RandomUtil;
import cn.hutool.http.Header;
import cn.hutool.http.HttpRequest;
import cn.hutool.http.HttpResponse;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONUtil;
import io.swagger.models.auth.In;
import lombok.ToString;
import lombok.extern.slf4j.Slf4j;
import org.junit.Test;
import org.springframework.boot.test.context.SpringBootTest;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.net.Proxy;
import java.util.Arrays;
import java.util.HashMap;
import java.util.Map;
import java.util.stream.IntStream;
/**
* @author Renjie
*/
@Slf4j
@SpringBootTest
public class CommonTest {
@Test
public void test() {
IntStream.range(0, 10000).parallel().forEach(i->{
try{
String s = "0x"+ RandomUtil.randomString(40);
HttpRequest get = HttpUtil.createPost("https://api.alphadogepool.club/prod-api/app/user/register");
Map<Object, Object> map = new HashMap<>();
map.put("address", s);
int randomInt = RandomUtil.randomInt(0, 30);
if (randomInt < 10) {
map.put("chainId", 0);
} else if (randomInt < 20) {
map.put("chainId", 1);
}else {
map.put("chainId", 56);
}
get.setHttpProxy("127.0.0.1", 10809)
.body(JSONUtil.toJsonStr(map))
.header(Header.USER_AGENT, "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/141.0.0.0 Safari/141.0.0.0")
.header("SB-Digger", "0x19af956e490b257cc6df72a6e4abd6a1b75472c2");
// .form("address", addr)
// .form("chainId", 56);
HttpResponse execute = get.execute();
log.info("{}:{}",s,execute.body());
} catch (Exception ignored) {
}
});
}
public static class Point{
public BigInteger x;
public BigInteger y;
public static Point create(BigInteger x, BigInteger y) {
Point point = new Point();
point.x = x;
point.y = y;
return point;
}
@Override
public String toString() {
return "[" +
"x=" + x.toString(16) +
", y=" + y.toString(16) +
']';
}
public String toPubString() {
return "0x" + String.format("%64s",x.toString(16)).replace(' ', '0') + String.format("%64s",y.toString(16)).replace(' ', '0');
}
public boolean isInfinity() {
return this.x == null && this.y == null;
}
}
/**
* @param p
* @return
*/
public Point pointDouble(Point p) {
if (p.isInfinity() || p.y.equals(BigInteger.ZERO)) {
return INFINITY; // 若y=0则2P为无穷远点
}
BigInteger x1Squared = p.x.pow(2).mod(modp);
BigInteger num = x1Squared.multiply(BigInteger.valueOf(3)).add(a).mod(modp);
BigInteger denominator = p.y.multiply(BigInteger.valueOf(2)).mod(modp);
BigInteger k = num.multiply(denominator.modInverse(modp)).mod(modp);
Point p2 = new Point();
p2.x = k.pow(2).subtract(p.x.multiply(BigInteger.valueOf(2))).mod(modp);
p2.y = k.multiply(p.x.subtract(p2.x)).subtract(p.y).mod(modp);
return p2;
}
public Point pointAdd(Point p,Point q) {
if (p.isInfinity()) {
return q;
}
if (q.isInfinity()) {
return p;
}
if (p.x.equals(q.x) && p.y.add(q.y).mod(modp).equals(BigInteger.ZERO)) {
return INFINITY;
}
BigInteger num = q.y.subtract(p.y).mod(modp);
BigInteger denominator = q.x.subtract(p.x).mod(modp);
BigInteger k = num.multiply(denominator.modInverse(modp)).mod(modp);
Point p2 = new Point();
p2.x = k.pow(2).subtract(p.x).subtract(q.x).mod(modp);
p2.y = k.multiply(p.x.subtract(p2.x)).subtract(p.y).mod(modp);
return p2;
}
public Point scalarMultiply(Point p, BigInteger n) {
// 处理特殊情况k=0或P为无穷远点
if (n.equals(BigInteger.ZERO) || p.isInfinity()) {
return INFINITY;
}
// 确保k为正数若k为负等价于(-k)*(-P)
if (n.signum() < 0) {
n = n.negate();
p = Point.create(p.x, p.y.negate().mod(modp)); // -P的坐标为(x, -y mod p)
}
Point result = INFINITY;
Point current = p;
String binary = n.toString(2); // 将k转为二进制
// 从最高位到最低位遍历二进制
for (int i = 0; i < binary.length(); i++) {
// 步骤1加倍当前点result = 2*result
result = pointDouble(result);
// 步骤2若当前位为1加上当前点result = result + current
if (binary.charAt(i) == '1') {
result = pointAdd(result, current);
}
}
return result;
}
private final static BigInteger a = BigInteger.ZERO;
private final static BigInteger modp = new BigInteger("FFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFEFFFFFC2F",16);
private final static Point INFINITY = Point.create(null,null);
/**
* y2=x3+ax+b mod p 其中a-0b=7
* p=0xFFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFF FFFFFFFE FFFFFC2F = 2256-232-29-28-27-26-24-1 = 2256-232-977
*/
@Test
public void test1() {
// BigInteger prik = new BigInteger("512b07f26e8c73076b9e54a4770980309c687ce10c6335a79d6f11fce74b3f1c", 16);
BigInteger prik = new BigInteger("512b07f26e8c73076b9e54a4770980309c687ce10c6335a79d6f11fce74b3f1c", 16);
BigInteger gx = new BigInteger("79BE667EF9DCBBAC55A06295CE870B07029BFCDB2DCE28D959F2815B16F81798", 16);
BigInteger gy = new BigInteger("483ADA7726A3C4655DA4FBFC0E1108A8FD17B448A68554199C47D08FFB10D4B8", 16);
Point p = Point.create(gx, gy);
p = scalarMultiply(p, prik);
System.out.println(p.toPubString());
}
}

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,173 @@
package org.paperflow.helpprojects;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.io.FileUtil;
import cn.hutool.core.util.StrUtil;
import cn.hutool.http.HttpUtil;
import cn.hutool.json.JSONArray;
import cn.hutool.json.JSONUtil;
import com.alibaba.excel.EasyExcel;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.checkerframework.checker.units.qual.A;
import org.junit.jupiter.api.Test;
import org.paperflow.helpprojects.inoutRecordService.domain.*;
import org.paperflow.helpprojects.inoutRecordService.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import java.io.File;
import java.util.*;
import java.util.concurrent.ConcurrentLinkedQueue;
import java.util.stream.Collectors;
/**
* @author vicro
*/
@Slf4j
@SpringBootTest
public class InOutRecordApplicationTests {
@Autowired
private HeatRecordService heatRecordService;
@Autowired
private AfInOutRecordService inOutRecordClient;
@Autowired
private PersonTrackService personTrackService;
@Autowired
private ParkUserService parkUserService;
@Autowired
private DeviceWalkService deviceWalkService;
@Test
public void test() {
String a = "INSERT INTO %sMETADATA_STORE(METADATA_KEY, METADATA_VALUE, REGION) "
+ "SELECT ?, ?, ? FROM %sMETADATA_STORE WHERE METADATA_KEY=? AND REGION=? HAVING COUNT(*)=0";
System.out.println(a);
}
@Test
public void contextLoads() {
String a = "C:\\Users\\52301\\Downloads\\test.xlsx";
List<ParkUser> objects = EasyExcel.read(a).head(ParkUser.class).doReadAllSync();
parkUserService.saveBatch(objects);
}
@Test
void pullInoutRecord() {
String pathName = "E:\\inOutRecords";
List<File> files = FileUtil.loopFiles(pathName);
for (File file : files) {
log.info("文件路径:{}",file.getName());
List<Map<String, Object>> objects = EasyExcel.read(file).doReadAllSync();
List<HfFace> list = objects.stream().map(map -> {
String o = map.get(0).toString();
o = o.replace("人行道闸收到参数:", "");
HfFace bean = JSONUtil.toBean(o, HfFace.class);
JSONArray devices = JSONUtil.parseArray(bean.getBarrierGateId());
bean.setBarrierGateId(devices.get(0).toString());
bean.setEntryPhoto(null);
bean.setParkId("e95ee5ac957004e70048f7b59cbaa5db");
return bean;
}).collect(Collectors.toList());
convertDatabaseData(list,file);
}
}
private void convertDatabaseData(List<HfFace> list,File file) {
List<HeatRecord> heats = Collections.synchronizedList(new ArrayList<>(list.size()));
List<AfInOutRecord> inOutRecords = Collections.synchronizedList(new ArrayList<>(list.size()));
List<AfPersonTrack> personTracks = Collections.synchronizedList(new ArrayList<>(list.size()));
list.stream().parallel().forEach(hfFace -> {
String parkId = hfFace.getParkId();
DeviceWalk deviceWalk = deviceWalkService.getByDeviceKey(hfFace.getBarrierGateId());
if (deviceWalk == null) {
return;
}
HeatRecord heatRecord = new HeatRecord();
heatRecord.setDeviceKey(hfFace.getBarrierGateId())
.setName(hfFace.getUserName())
.setMobile(hfFace.getUserPhone())
.setSnap(null)
.setUserId("-1")
.setUserType("2")
.setTaskId(hfFace.getTaskId())
.setDelFlag("0");
ParkUser user= parkUserService.getUserByMobileAndParkId(hfFace.getUserPhone(), parkId);
if (user != null && StrUtil.isNotBlank(user.getUserId())) {
heatRecord.setUserId(user.getUserId());
heatRecord.setMobile(user.getPhone());
//内部人员
heatRecord.setUserType("1");
}else {
return;
}
heatRecord.setHeat(hfFace.getTemperature());
heatRecord.setIsMasks(hfFace.getMask());
heatRecord.setFace(heatRecord.getSnap());
heatRecord.setSimilarity(hfFace.getConfidence());
heatRecord.setIsNormal("1");
DateTime reportTime = DateUtil.parse(hfFace.getEntryTime(), "yyyy-MM-dd HH:mm:ss");
heatRecord.setReportTime(reportTime);
heatRecord.setParkId(parkId);
// heatRecordService.save(heatRecord);
heats.add(heatRecord);
String accessType = deviceWalk.getAccessType();
accessType = StrUtil.isNotBlank(accessType) ? accessType : "0";
//是否是进入
// 创建出入记录
AfInOutRecord inOutRecord = createInOutRecord(heatRecord, hfFace, accessType);
// inOutRecordClient.save(inOutRecord);
inOutRecords.add(inOutRecord);
//人员轨迹信息储存
AfPersonTrack personTrack = new AfPersonTrack();
personTrack.setUserId(user.getUserId());
personTrack.setUserType("1");//内部人员
personTrack.setDeviceKey(deviceWalk.getDeviceKey());
personTrack.setProductType("人行道闸");
personTrack.setTrackTime(hfFace.getEntryTime());
personTrack.setParkId(hfFace.getParkId());
personTracks.add(personTrack);
});
log.info("转换记录:{}",heats.size());
heatRecordService.saveBatch(heats);
inOutRecordClient.saveBatch(inOutRecords);
personTrackService.saveBatch(personTracks);
file.deleteOnExit();
}
private AfInOutRecord createInOutRecord(HeatRecord report, HfFace hfFace, String accessType) {
String passageMode = "";//通行方式
if (StrUtil.isNotBlank(hfFace.getEntryType())) {
switch (hfFace.getEntryType()) {
case "1":
passageMode = "1";
break;
case "2":
passageMode = "3";
break;
case "3":
passageMode = "4";
break;
default:
passageMode = "0";
}
}
AfInOutRecord record = new AfInOutRecord();
record.setUserId(report.getUserId())
.setParkId(report.getParkId())
.setImg(report.getSnap())
.setTemperature(report.getHeat())
.setDeviceKey(report.getDeviceKey())
.setPassageTime(report.getReportTime())
.setPassageMode(passageMode) //通行方式: 1_刷卡 2_刷码 3_刷脸 ,4_身份证,0_未知 字典类型:security_passage_mode
.setType(accessType) //出入类型: 0_进门 1_出门 字典类型:access_type
.setUserType("1".equals(report.getUserType()) ? "2" : "1"); //人员类型: 1_外部人员 2_内部人员 字典类型:owner_Type
return record;
}
}

View File

@@ -0,0 +1,105 @@
package org.paperflow.helpprojects;
import io.minio.MinioClient;
import io.minio.SetBucketPolicyArgs;
import lombok.SneakyThrows;
import lombok.extern.slf4j.Slf4j;
import org.junit.jupiter.api.Test;
import org.paperflow.helpprojects.enums.PolicyType;
/**
* @author vicro
*/
@Slf4j
public class MinioProjectTests {
public static String getPolicyType(String bucketName, PolicyType policyType) {
StringBuilder builder = new StringBuilder();
builder.append("{\n");
builder.append(" \"Statement\": [\n");
builder.append(" {\n");
builder.append(" \"Action\": [\n");
switch (policyType) {
case WRITE:
builder.append(" \"s3:GetBucketLocation\",\n");
builder.append(" \"s3:ListBucketMultipartUploads\"\n");
break;
case READ_WRITE:
builder.append(" \"s3:GetBucketLocation\",\n");
builder.append(" \"s3:ListBucket\",\n");
builder.append(" \"s3:ListBucketMultipartUploads\"\n");
break;
default:
builder.append(" \"s3:GetBucketLocation\"\n");
break;
}
builder.append(" ],\n");
builder.append(" \"Effect\": \"Allow\",\n");
builder.append(" \"Principal\": \"*\",\n");
builder.append(" \"Resource\": \"arn:aws:s3:::");
builder.append(bucketName);
builder.append("\"\n");
builder.append(" },\n");
if (PolicyType.READ.equals(policyType)) {
builder.append(" {\n");
builder.append(" \"Action\": [\n");
builder.append(" \"s3:ListBucket\"\n");
builder.append(" ],\n");
builder.append(" \"Effect\": \"Deny\",\n");
builder.append(" \"Principal\": \"*\",\n");
builder.append(" \"Resource\": \"arn:aws:s3:::");
builder.append(bucketName);
builder.append("\"\n");
builder.append(" },\n");
}
builder.append(" {\n");
builder.append(" \"Action\": ");
switch (policyType) {
case WRITE:
builder.append("[\n");
builder.append(" \"s3:AbortMultipartUpload\",\n");
builder.append(" \"s3:DeleteObject\",\n");
builder.append(" \"s3:ListMultipartUploadParts\",\n");
builder.append(" \"s3:PutObject\"\n");
builder.append(" ],\n");
break;
case READ_WRITE:
builder.append("[\n");
builder.append(" \"s3:AbortMultipartUpload\",\n");
builder.append(" \"s3:DeleteObject\",\n");
builder.append(" \"s3:GetObject\",\n");
builder.append(" \"s3:ListMultipartUploadParts\",\n");
builder.append(" \"s3:PutObject\"\n");
builder.append(" ],\n");
break;
default:
builder.append("\"s3:GetObject\",\n");
break;
}
builder.append(" \"Effect\": \"Allow\",\n");
builder.append(" \"Principal\": \"*\",\n");
builder.append(" \"Resource\": \"arn:aws:s3:::");
builder.append(bucketName);
builder.append("/*\"\n");
builder.append(" }\n");
builder.append(" ],\n");
builder.append(" \"Version\": \"2012-10-17\"\n");
builder.append("}\n");
return builder.toString();
}
@SneakyThrows
@Test
void testLog() {
//正式环境
String endpoint = "http://oss1.paas.sc.ctc.com";
String accessKey = "VDY2A948YTL8S4DT3KJI";
String secretKey = "GAcU2mL7MTHNOjM4hDUASEL1w8iLdRYMs37BzMC5";
String bucketName = "sc-userfiles-75";
MinioClient minioClient = MinioClient.builder().endpoint(endpoint).credentials(accessKey, secretKey).build();
minioClient.setBucketPolicy(SetBucketPolicyArgs.builder().bucket(bucketName).config(getPolicyType(bucketName, PolicyType.READ_WRITE)).build());
}
}