Compare commits

...

2 Commits

Author SHA1 Message Date
masong 3fbfb8939d 修复bug 2 years ago
masong 78f0651e10 readme.md 2 years ago
  1. 29
      pom.xml
  2. 1
      readme.md
  3. 8
      src/main/java/com/cjy/controller/AccessController.java
  4. 4
      src/main/java/com/cjy/service/AccessService.java
  5. 21
      src/main/java/com/cjy/service/impl/AccessServiceImpl.java
  6. 9
      src/main/resources/application.yml

@ -20,14 +20,11 @@
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
<artifactId>spring-boot-starter</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
<scope>runtime</scope>
<optional>true</optional>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
@ -40,14 +37,7 @@
<scope>test</scope>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-bom</artifactId>
<version>5.8.17</version>
<type>pom</type>
<!-- 注意这里是import -->
<scope>import</scope>
</dependency>
<dependency>
<groupId>httpClient</groupId>
<artifactId>httpClient</artifactId>
@ -115,9 +105,9 @@
<build>
<finalName>${project.artifactId}-${project.version}</finalName>
<resources>
<resource>
<directory>src/main/resources</directory>
</resource>
<!-- <resource>-->
<!-- <directory>src/main/resources</directory>-->
<!-- </resource>-->
<resource>
<directory>lib</directory>
@ -132,7 +122,12 @@
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<configuration>
<includeSystemScope>true</includeSystemScope>
<excludes>
<exclude>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</exclude>
</excludes>
</configuration>
</plugin>
</plugins>

@ -3,6 +3,7 @@
<p>涉及:添加权限、删除权限、生成二维码、设置访客、取消访客等操作具体见接口文档</p>
<p>若使用二维码需开启二维码穿透 已集成接口</p>
<p>不管是刷卡还是二维码都需要添加权限否则进门失败</p>
<p>流程</p>
<p>1.电脑与门禁控制在同一局域网下启用 001-控制器.exe 搜索区域网设备进行设备配置 建议采用TCP形式 连接1001CloudServer</p>
<p>2.启用本接口程序 注意在静态资源中配置 1001CloudServer地址和门禁设备设备号(一般在板子上有写明S/N)</p>

@ -72,7 +72,7 @@ public class AccessController {
* @return
*/
@PostMapping("/batchUploadPermissions")
public AjaxResult batchUploadPermissions(ArrayList<AccessRight> list){
public AjaxResult batchUploadPermissions(@RequestBody ArrayList<AccessRight> list){
return accessService.batchUploadPermissions(list);
}
/**
@ -135,13 +135,13 @@ public class AccessController {
/**
* 获取二维码
* @param idCard 卡号身份证号
* @param timeLimit 时间限制
* @param endTime 时间限制
* @return
*/
@GetMapping("/updateQRCode")
public AjaxResult updateQRCode(@RequestParam("idCard") Long idCard,@RequestParam("timeLimit") int timeLimit){
public AjaxResult updateQRCode(@RequestParam("idCard") Long idCard,@RequestParam("endTime") String endTime){
return accessService.updateQRCode(idCard,timeLimit);
return accessService.updateQRCode(idCard,endTime);
}
/**

@ -90,10 +90,10 @@ public interface AccessService {
/**
* 刷新二维码
* @param idCard 身份证号
* @param timeLimit 时限
* @param endTime 时限
* @return
*/
AjaxResult updateQRCode(Long idCard,int timeLimit);
AjaxResult updateQRCode(Long idCard,String endTime);
/**
* 清除全部访客信息

@ -25,7 +25,7 @@ import java.util.ArrayList;
*/
@Service
public class AccessServiceImpl implements AccessService {
@Value("${controller.url}")
@Value("${controller.server}")
private String url;
@Value("${controller.sn}")
private int controllerSN;
@ -824,17 +824,17 @@ public class AccessServiceImpl implements AccessService {
}
@Override
public AjaxResult updateQRCode(Long idCard, int timeLimit) {
public AjaxResult updateQRCode(Long idCard, String endTime) {
String op = "生成二维码信息";
long cardno = idCard; //测试的卡号开始
int validMinute = timeLimit;
String formatStr = "yyyy-MM-dd HH:mm:ss";
LocalDateTime now = LocalDateTime.now();
now = now.plusMinutes(validMinute); //10分钟有效
DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(formatStr);
String endTime = now.format(dateTimeFormatter);
// int validMinute = timeLimit;
//
// String formatStr = "yyyy-MM-dd HH:mm:ss";
// LocalDateTime now = LocalDateTime.now();
// now = now.plusMinutes(validMinute); //10分钟有效
// DateTimeFormatter dateTimeFormatter = DateTimeFormatter.ofPattern(formatStr);
// String endTime = now.format(dateTimeFormatter);
// endTime= "2029-12-31 23:59:00";
try {
@ -874,6 +874,9 @@ public class AccessServiceImpl implements AccessService {
WgWebapi.logInfo(String.format("原因: %s", result.get("原因:").asText()));
return AjaxResult.error("操作失败",result.get("原因:").asText());
}
if(result.has("截止日期时间已过时")){
return AjaxResult.error("截止日期时间已过时");
}
return AjaxResult.error("操作失败");
}
} catch (Exception e) {

@ -1,8 +1,7 @@
server:
port: 7834
spring:
application:
name: access-control-equipment
port: 33307
servlet:
context-path: /
controller:
url: http://localhost:61080/
server: http://localhost:61080
sn: 153217233
Loading…
Cancel
Save