长庆项目11.06
This commit is contained in:
parent
139718fc34
commit
b08a36222b
|
@ -320,6 +320,37 @@
|
||||||
<groupId>org.springframework.boot</groupId>
|
<groupId>org.springframework.boot</groupId>
|
||||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
<plugin>
|
||||||
|
<!--
|
||||||
|
1. 加密后,方法体被清空,保留方法参数、注解等信息.主要兼容swagger文档注解扫描
|
||||||
|
2. 方法体被清空后,反编译只能看到方法名和注解,看不到方法体的具体内容
|
||||||
|
3. 加密后的项目需要设置javaagent来启动,启动过程中解密class,完全内存解密,不留下任何解密后的文件
|
||||||
|
4. 启动加密后的jar,生成xxx-encrypted.jar,这个就是加密后的jar文件,加密后不可直接执行
|
||||||
|
5. 无密码启动方式,java -javaagent:xxx-encrypted.jar -jar xxx-encrypted.jar
|
||||||
|
6. 有密码启动方式,java -javaagent:xxx-encrypted.jar='-pwd= 密码' -jar xxx-encrypted.jar
|
||||||
|
-->
|
||||||
|
<groupId>net.roseboy</groupId>
|
||||||
|
<artifactId>classfinal-maven-plugin</artifactId>
|
||||||
|
<version>1.2.1</version>
|
||||||
|
<configuration>
|
||||||
|
<password>#</password><!-- #表示启动时不需要密码,事实上对于代码混淆来说,这个密码没什么用,它只是一个启动密码 -->
|
||||||
|
<excludes>org.spring</excludes>
|
||||||
|
<packages>net.shapelight</packages><!-- 加密的包名,多个包用逗号分开 -->
|
||||||
|
<cfgfiles>application.yml,application-dev.yml</cfgfiles><!-- 加密的配置文件,多个包用逗号分开 -->
|
||||||
|
<libjars>hutool-all.jar</libjars> <!-- jar包lib下面要加密的jar依赖文件,多个包用逗号分开 -->
|
||||||
|
<!--<code>xxxxx</code> <!– 指定机器启动,机器码 不绑定机器码 就注释掉此项 –>-->
|
||||||
|
</configuration>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<phase>package</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>classFinal</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
<!-- 跳过单元测试 -->
|
<!-- 跳过单元测试 -->
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
@ -345,6 +376,9 @@
|
||||||
</configuration>
|
</configuration>
|
||||||
<!-- 运行命令 mvn clean package docker:build 打包并生成docker镜像 -->
|
<!-- 运行命令 mvn clean package docker:build 打包并生成docker镜像 -->
|
||||||
</plugin>
|
</plugin>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
</project>
|
</project>
|
||||||
|
|
|
@ -32,8 +32,8 @@ import javax.annotation.PostConstruct;
|
||||||
@EnableFeignClients
|
@EnableFeignClients
|
||||||
//@MapperScan("net.shapelight.modules.sys.dao")
|
//@MapperScan("net.shapelight.modules.sys.dao")
|
||||||
public class AdminApplication {
|
public class AdminApplication {
|
||||||
/* @Autowired
|
@Autowired
|
||||||
CxFeignClient cxFeignClient;*/
|
CxFeignClient cxFeignClient;
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
SpringApplication.run(AdminApplication.class, args);
|
SpringApplication.run(AdminApplication.class, args);
|
||||||
|
@ -61,11 +61,11 @@ public class AdminApplication {
|
||||||
// });
|
// });
|
||||||
}
|
}
|
||||||
|
|
||||||
/*@PostConstruct
|
@PostConstruct
|
||||||
void init() throws Exception {
|
void init() throws Exception {
|
||||||
SslUtils.ignoreSsl();
|
SslUtils.ignoreSsl();
|
||||||
String res = cxFeignClient.getToken("5bb50ad0cc40e10565089c35aa61e7f3","k9?8bCqaQ*R1e2Wx0f65AzY4^]LDp@_Z");
|
String res = cxFeignClient.getToken("5bb50ad0cc40e10565089c35aa61e7f3","k9?8bCqaQ*R1e2Wx0f65AzY4^]LDp@_Z");
|
||||||
CxFeignConfig.token = res;
|
CxFeignConfig.token = res;
|
||||||
}*/
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,10 +33,8 @@ public class FaceEngineFactory extends BasePooledObjectFactory<FaceEngine> {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public FaceEngine create() {
|
public FaceEngine create() {
|
||||||
|
|
||||||
|
|
||||||
FaceEngine faceEngine = new FaceEngine(ArcFaceAutoConfiguration.CACHE_LIB_FOLDER);
|
FaceEngine faceEngine = new FaceEngine(ArcFaceAutoConfiguration.CACHE_LIB_FOLDER);
|
||||||
|
/* FaceEngine faceEngine = new FaceEngine("/softTemp/jar/82K111TPM121XK4H.dat");*/
|
||||||
// FaceEngine faceEngine = new FaceEngine("/home/huangyifang/gb/咸阳师范/ArcSoft_ArcFacePro_linux_java_V4.1/libs/LINUX64/");
|
// FaceEngine faceEngine = new FaceEngine("/home/huangyifang/gb/咸阳师范/ArcSoft_ArcFacePro_linux_java_V4.1/libs/LINUX64/");
|
||||||
int activeCode;
|
int activeCode;
|
||||||
if (StringUtils.isNotEmpty(activeFile)) {
|
if (StringUtils.isNotEmpty(activeFile)) {
|
||||||
|
|
|
@ -331,25 +331,28 @@ public class RtspFrameGrabber {
|
||||||
params.put("personnelId", tenPerson.getOpenId());
|
params.put("personnelId", tenPerson.getOpenId());
|
||||||
params.put("personnelCardId", tenPerson.getIdCard());
|
params.put("personnelCardId", tenPerson.getIdCard());
|
||||||
params.put("personnelType", personnelTypeMap.get(tenPerson.getPersonType()));
|
params.put("personnelType", personnelTypeMap.get(tenPerson.getPersonType()));
|
||||||
params.put("dictSex", tenPerson.getGender() == 0 ? "女" : "男");
|
params.put("dictSex", tenPerson.getGender() == 0 ? "男" : "女");
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
params.put("watchVideoTime", sdf.format(System.currentTimeMillis()));
|
params.put("watchVideoTime", sdf.format(System.currentTimeMillis()));
|
||||||
|
|
||||||
|
if(tenPerson.getIsWatchSafeVideo() != 1){
|
||||||
tenPerson.setIsWatchSafeVideo(faceVideoVo.getIsHeadOnView() == 0 ? 2 : 1);
|
tenPerson.setIsWatchSafeVideo(faceVideoVo.getIsHeadOnView() == 0 ? 2 : 1);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//tenPerson.setIsWatchSafeVideo();
|
||||||
|
|
||||||
tenPersonService.updateById(tenPerson);
|
tenPersonService.updateById(tenPerson);
|
||||||
|
|
||||||
System.out.println("params = " + params);
|
System.out.println("params = " + params);
|
||||||
|
|
||||||
if(faceVideoVo.getIsHeadOnView() == 1){
|
if(faceVideoVo.getIsHeadOnView() == 1){
|
||||||
/* JSONObject jsonObject = feignClient.savePmWatchVideoRecord(params);
|
JSONObject jsonObject = feignClient.savePmWatchVideoRecord(params);
|
||||||
if (jsonObject.getBool("success") != null && jsonObject.getBool("success")) {
|
if (jsonObject.getBool("success") != null && jsonObject.getBool("success")) {
|
||||||
personService.update(new LambdaUpdateWrapper<TenPersonEntity>()
|
personService.update(new LambdaUpdateWrapper<TenPersonEntity>()
|
||||||
.set(TenPersonEntity::getIsWatchSafeVideo, 1)
|
.set(TenPersonEntity::getIsWatchSafeVideo, 1)
|
||||||
.eq(TenPersonEntity::getPersonId, userCompareInfo.getFaceId()));
|
.eq(TenPersonEntity::getPersonId, userCompareInfo.getFaceId()));
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -340,6 +340,8 @@ public class HttpApiController {
|
||||||
JSONObject dataJson = jsonContent.getJSONObject("data");
|
JSONObject dataJson = jsonContent.getJSONObject("data");
|
||||||
Long uid = dataJson.getLong("uid");
|
Long uid = dataJson.getLong("uid");
|
||||||
|
|
||||||
|
System.out.println("uid = " + uid);
|
||||||
|
|
||||||
TenCellEntity cellEntity = tenCellService.getById(deviceEntity.getCellId());
|
TenCellEntity cellEntity = tenCellService.getById(deviceEntity.getCellId());
|
||||||
|
|
||||||
TenPersonEntity p = tenPersonService.getById(uid,cellEntity.getCellId());
|
TenPersonEntity p = tenPersonService.getById(uid,cellEntity.getCellId());
|
||||||
|
@ -877,9 +879,24 @@ public class HttpApiController {
|
||||||
params.put("personnelCardId", memberEntity.getIdCard());
|
params.put("personnelCardId", memberEntity.getIdCard());
|
||||||
|
|
||||||
|
|
||||||
params.put("personnelType",memberEntity.getPersonType());
|
Integer type = null;
|
||||||
|
|
||||||
params.put("entryOrExit",(deviceEntity.getGateFlag()+1) == 1); //1进2出
|
if (memberEntity.getPersonType() == 5001){
|
||||||
|
type = 1;
|
||||||
|
}
|
||||||
|
if (memberEntity.getPersonType() == 5000){
|
||||||
|
type = 2;
|
||||||
|
}
|
||||||
|
if (memberEntity.getPersonType() == 5002){
|
||||||
|
type = 3;
|
||||||
|
}
|
||||||
|
if (memberEntity.getPersonType() == 5005){
|
||||||
|
type = 4;
|
||||||
|
}
|
||||||
|
|
||||||
|
params.put("personnelType",type);
|
||||||
|
|
||||||
|
params.put("entryOrExit", deviceEntity.getGateFlag() + 1); //1进2出
|
||||||
|
|
||||||
SimpleDateFormat sfm = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
SimpleDateFormat sfm = new SimpleDateFormat("yyyy-MM-dd hh:mm:ss");
|
||||||
|
|
||||||
|
@ -890,12 +907,12 @@ public class HttpApiController {
|
||||||
|
|
||||||
System.out.println("params = " + params);
|
System.out.println("params = " + params);
|
||||||
|
|
||||||
/* cn.hutool.json.JSONObject jsonObject = cxFeignClient.savePmEntryExitRecord(params);
|
cn.hutool.json.JSONObject jsonObject = cxFeignClient.savePmEntryExitRecord(params);
|
||||||
if(jsonObject.getBool("success")!=null && jsonObject.getBool("success")){
|
if(jsonObject.getBool("success")!=null && jsonObject.getBool("success")){
|
||||||
log.debug("同步进出场记录成功");
|
log.debug("同步进出场记录成功");
|
||||||
}else {
|
}else {
|
||||||
log.debug("同步进出场记录失败"+"姓名:"+memberEntity.getName()+",errorMessage"+jsonObject.getStr("message"));
|
log.debug("同步进出场记录失败"+"姓名:"+memberEntity.getName()+",errorMessage"+jsonObject.getStr("message"));
|
||||||
}*/
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,28 +1,36 @@
|
||||||
package net.shapelight.modules.iCq.controller;
|
package net.shapelight.modules.iCq.controller.demo;
|
||||||
|
|
||||||
import cn.hutool.json.JSONObject;
|
|
||||||
import com.arcsoft.face.ActiveDeviceInfo;
|
import com.arcsoft.face.ActiveDeviceInfo;
|
||||||
import com.arcsoft.face.FaceEngine;
|
import com.arcsoft.face.FaceEngine;
|
||||||
import com.arcsoft.face.enums.ErrorInfo;
|
import com.arcsoft.face.Rect;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
|
import io.minio.PutObjectOptions;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import net.shapelight.common.config.GlobalValue;
|
import net.shapelight.common.config.GlobalValue;
|
||||||
|
import net.shapelight.common.config.MinioConfig;
|
||||||
import net.shapelight.common.utils.R;
|
import net.shapelight.common.utils.R;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigCellMapper;
|
import net.shapelight.common.utils.UUIDUtil;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigMapper;
|
import net.shapelight.modules.face.rtsp.RtspFrameGrabber;
|
||||||
import net.shapelight.modules.iCq.dal.mysql.enter.CqEnterConfigTypeMapper;
|
import net.shapelight.modules.iCq.controller.video.vo.FaceVideoVo;
|
||||||
import net.shapelight.modules.iCq.service.enter.CqEnterServiceImpl;
|
import net.shapelight.modules.iCq.service.enter.CqEnterServiceImpl;
|
||||||
|
import net.shapelight.modules.iCq.utils.DemoUtil;
|
||||||
import net.shapelight.modules.job.task.PersonSynchronousTask;
|
import net.shapelight.modules.job.task.PersonSynchronousTask;
|
||||||
import net.shapelight.modules.ten.dao.TenCellDao;
|
import net.shapelight.modules.ten.dao.TenCellDao;
|
||||||
import net.shapelight.modules.ten.entity.TenCellEntity;
|
import net.shapelight.modules.ten.dao.TenPersonDao;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
import net.shapelight.modules.face.factory.FaceEngineFactory;
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
import java.util.regex.Pattern;
|
import java.util.regex.Pattern;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
|
@ -33,6 +41,8 @@ public class DemoController {
|
||||||
|
|
||||||
private final CqEnterServiceImpl cqEnterService;
|
private final CqEnterServiceImpl cqEnterService;
|
||||||
|
|
||||||
|
private final TenPersonDao tenPersonDao;
|
||||||
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private PersonSynchronousTask task;
|
private PersonSynchronousTask task;
|
||||||
|
@ -43,6 +53,13 @@ public class DemoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private GlobalValue globalValue;
|
private GlobalValue globalValue;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private RtspFrameGrabber rtspFrameGrabber;
|
||||||
|
|
||||||
|
private final MinioConfig minioConfig;
|
||||||
|
|
||||||
|
private final MinioClient minioClient;
|
||||||
|
|
||||||
@GetMapping("/save1")
|
@GetMapping("/save1")
|
||||||
public void saveSupplier(String type){
|
public void saveSupplier(String type){
|
||||||
/* System.out.println("测试开始");
|
/* System.out.println("测试开始");
|
||||||
|
@ -178,6 +195,93 @@ public class DemoController {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/* @PostMapping("/drawRectangleOnImage")
|
||||||
|
public R DrawRectangleOnImage(@RequestParam("image") MultipartFile image, @RequestParam String cellId) {
|
||||||
|
|
||||||
|
List<FaceVideoVo> recognition = rtspFrameGrabber.recognition(image, cellId);
|
||||||
|
|
||||||
|
List<Rect> rects = new ArrayList<>();
|
||||||
|
|
||||||
|
for (FaceVideoVo faceVideoVo : recognition) {
|
||||||
|
|
||||||
|
rects.add(faceVideoVo.getRect());
|
||||||
|
|
||||||
|
}
|
||||||
|
draw(recognition.get(0).getImageUrl(), rects);
|
||||||
|
|
||||||
|
System.out.println("recognition = " + recognition);
|
||||||
|
|
||||||
|
return R.ok();
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/* private String draw(String imageUrl, List<Rect> rectList) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 从 URL 读取图片
|
||||||
|
BufferedImage image = ImageIO.read(new URL(globalValue.getMinioEndpoint() + "/" +
|
||||||
|
globalValue.getMinioBucketName() + "/" + imageUrl));
|
||||||
|
|
||||||
|
// 获取绘图上下文
|
||||||
|
Graphics2D g2d = image.createGraphics();
|
||||||
|
g2d.setColor(Color.RED); // 设置框的颜色
|
||||||
|
g2d.setStroke(new BasicStroke(3)); // 设置框的线条宽度
|
||||||
|
|
||||||
|
|
||||||
|
// 遍历每个矩形框并绘制
|
||||||
|
for (Rect rect : rectList) {
|
||||||
|
int left = rect.left;
|
||||||
|
int top = rect.top;
|
||||||
|
int width = rect.right - rect.left;
|
||||||
|
int height = rect.bottom - rect.top;
|
||||||
|
|
||||||
|
g2d.drawRect(left, top, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 释放资源
|
||||||
|
g2d.dispose();
|
||||||
|
|
||||||
|
// 将 BufferedImage 转换为 InputStream 以便上传
|
||||||
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
|
ImageIO.write(image, "jpg", os);
|
||||||
|
InputStream inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||||
|
|
||||||
|
// 设置文件目录和名称
|
||||||
|
String catalogue = "temp/";
|
||||||
|
String extension = "jpg"; // 假设是 JPG 格式
|
||||||
|
String fileName = catalogue + "t_" + UUIDUtil.uuid() + "." + extension;
|
||||||
|
|
||||||
|
// 上传文件到 MinIO
|
||||||
|
PutObjectOptions putObjectOptions = new PutObjectOptions(inputStream.available(), -1);
|
||||||
|
putObjectOptions.setContentType("image/jpeg");
|
||||||
|
minioClient.putObject(
|
||||||
|
minioConfig.getBucketName(), fileName, inputStream, putObjectOptions);
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
|
System.out.println("矩形框已绘制并上传到 MinIO,文件路径:" + globalValue.getMinioEndpoint() + "/" +
|
||||||
|
globalValue.getMinioBucketName() + "/" + fileName);
|
||||||
|
|
||||||
|
return fileName;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "error";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
/*@GetMapping("/testUtil")
|
||||||
|
public R testUtil(){
|
||||||
|
return R.ok().put("data", DemoUtil.demo());
|
||||||
|
}*/
|
||||||
|
|
||||||
|
@GetMapping("/temp")
|
||||||
|
public R temp(){
|
||||||
|
tenPersonDao.insertTemp("111");
|
||||||
|
return R.ok();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -0,0 +1,21 @@
|
||||||
|
package net.shapelight.modules.iCq.controller.demo.vo;
|
||||||
|
|
||||||
|
import com.arcsoft.face.Rect;
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.experimental.Accessors;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
@Accessors(chain = true)
|
||||||
|
public class DrawVo {
|
||||||
|
|
||||||
|
private String imageUrl;
|
||||||
|
|
||||||
|
private List<Rect> rectList;
|
||||||
|
|
||||||
|
}
|
|
@ -1,25 +1,33 @@
|
||||||
package net.shapelight.modules.iCq.controller.video;
|
package net.shapelight.modules.iCq.controller.video;
|
||||||
|
|
||||||
|
import com.arcsoft.face.Rect;
|
||||||
|
import io.minio.MinioClient;
|
||||||
|
import io.minio.PutObjectOptions;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
import io.swagger.annotations.ApiOperation;
|
import io.swagger.annotations.ApiOperation;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import net.shapelight.common.config.GlobalValue;
|
||||||
|
import net.shapelight.common.config.MinioConfig;
|
||||||
import net.shapelight.common.utils.R;
|
import net.shapelight.common.utils.R;
|
||||||
import net.shapelight.modules.face.dto.FaceRecognitionResDTO;
|
import net.shapelight.common.utils.UUIDUtil;
|
||||||
import net.shapelight.modules.face.entity.UserCompareInfo;
|
|
||||||
import net.shapelight.modules.face.rtsp.RtspFrameGrabber;
|
import net.shapelight.modules.face.rtsp.RtspFrameGrabber;
|
||||||
import net.shapelight.modules.iCq.controller.video.dto.UpdateVideoDto;
|
import net.shapelight.modules.iCq.controller.video.dto.UpdateVideoDto;
|
||||||
import net.shapelight.modules.iCq.controller.video.dto.UploadVideoDto;
|
import net.shapelight.modules.iCq.controller.video.dto.UploadVideoDto;
|
||||||
import net.shapelight.modules.iCq.controller.video.vo.FaceVideoVo;
|
import net.shapelight.modules.iCq.controller.video.vo.FaceVideoVo;
|
||||||
import net.shapelight.modules.iCq.dal.dataobject.video.TenSafeVideoEntity;
|
|
||||||
import net.shapelight.modules.iCq.dal.mysql.video.CqFileMapper;
|
|
||||||
import net.shapelight.modules.iCq.dal.mysql.video.CqSafeVideoMapper;
|
|
||||||
import net.shapelight.modules.iCq.service.video.CqSafeVideoServiceImpl;
|
import net.shapelight.modules.iCq.service.video.CqSafeVideoServiceImpl;
|
||||||
import net.shapelight.modules.ten.dao.TenCellDao;
|
import net.shapelight.modules.iCq.utils.DrawUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Objects;
|
import java.util.Objects;
|
||||||
|
@ -38,6 +46,14 @@ public class CqSafeVideoController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private RtspFrameGrabber rtspFrameGrabber;
|
private RtspFrameGrabber rtspFrameGrabber;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private GlobalValue globalValue;
|
||||||
|
|
||||||
|
private final MinioConfig minioConfig;
|
||||||
|
|
||||||
|
private final MinioClient minioClient;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private final List<FaceVideoVo> list = new ArrayList<>();
|
private final List<FaceVideoVo> list = new ArrayList<>();
|
||||||
|
|
||||||
|
@ -84,7 +100,7 @@ public class CqSafeVideoController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping("/update")
|
@PostMapping("/update")
|
||||||
@ApiOperation(value = "更新视频接口")
|
@ApiOperation(value = "更新视频接口")
|
||||||
public R update(@RequestBody UpdateVideoDto updateVideoDto,
|
public R update(@RequestBody UpdateVideoDto updateVideoDto,
|
||||||
@RequestHeader(value = "X-HTTP-Method-Override", required = false) String methodOverride) {
|
@RequestHeader(value = "X-HTTP-Method-Override", required = false) String methodOverride) {
|
||||||
|
@ -122,27 +138,112 @@ public class CqSafeVideoController {
|
||||||
}
|
}
|
||||||
System.out.println("list = " + list);
|
System.out.println("list = " + list);
|
||||||
|
|
||||||
|
List<Rect> rects = new ArrayList<>();
|
||||||
|
for (FaceVideoVo faceVideoVo : faceVideoVos) {
|
||||||
|
rects.add(faceVideoVo.getRect());
|
||||||
|
}
|
||||||
|
|
||||||
|
String drawUrl = null;
|
||||||
|
try {
|
||||||
|
drawUrl = DrawUtils.draw(faceVideoVos.get(0).getImageUrl(), rects);
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
System.out.println(e);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (isEnd == 1){
|
if (isEnd == 1){
|
||||||
List<FaceVideoVo> listTemp = new ArrayList<>(list);
|
List<FaceVideoVo> listTemp = new ArrayList<>(list);
|
||||||
list.clear();
|
list.clear();
|
||||||
return R.ok().put("data", listTemp);
|
return R.ok().put("data", listTemp).put("drawUrl", drawUrl);
|
||||||
}
|
}
|
||||||
return R.ok().put("data", list);
|
return R.ok().put("data", list).put("drawUrl", drawUrl);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@PostMapping("/face/recognition")
|
@PostMapping("/face/recognition")
|
||||||
public R aWatchStart(@RequestParam("image") MultipartFile image, @RequestParam String cellId) {
|
public R aWatchStart(@RequestParam("image") MultipartFile image, @RequestParam String cellId) {
|
||||||
List<FaceVideoVo> recognition = rtspFrameGrabber.recognition(image, cellId);
|
List<FaceVideoVo> recognition = rtspFrameGrabber.recognition(image, cellId);
|
||||||
for (FaceVideoVo faceVideoVo : recognition) {
|
for (FaceVideoVo faceVideoVo : recognition) {
|
||||||
System.out.println(faceVideoVo.getImageUrl());
|
System.out.println(faceVideoVo.getImageUrl());
|
||||||
}
|
}
|
||||||
return R.ok().put("data", recognition);
|
List<Rect> rects = new ArrayList<>();
|
||||||
|
for (FaceVideoVo faceVideoVo : recognition) {
|
||||||
|
rects.add(faceVideoVo.getRect());
|
||||||
|
}
|
||||||
|
|
||||||
|
String drawUrl = null;
|
||||||
|
try {
|
||||||
|
drawUrl = DrawUtils.draw(recognition.get(0).getImageUrl(), rects);
|
||||||
|
} catch (IndexOutOfBoundsException e) {
|
||||||
|
System.out.println(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
return R.ok().put("data", recognition).put("drawUrl", drawUrl);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*private String draw(String imageUrl, List<Rect> rectList) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 从 URL 读取图片
|
||||||
|
BufferedImage image = ImageIO.read(new URL(globalValue.getMinioEndpoint() + "/" +
|
||||||
|
globalValue.getMinioBucketName() + "/" + imageUrl));
|
||||||
|
|
||||||
|
// 获取绘图上下文
|
||||||
|
Graphics2D g2d = image.createGraphics();
|
||||||
|
g2d.setColor(Color.RED); // 设置框的颜色
|
||||||
|
g2d.setStroke(new BasicStroke(3)); // 设置框的线条宽度
|
||||||
|
|
||||||
|
|
||||||
|
// 遍历每个矩形框并绘制
|
||||||
|
for (Rect rect : rectList) {
|
||||||
|
int left = rect.left;
|
||||||
|
int top = rect.top;
|
||||||
|
int width = rect.right - rect.left;
|
||||||
|
int height = rect.bottom - rect.top;
|
||||||
|
|
||||||
|
g2d.drawRect(left, top, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 释放资源
|
||||||
|
g2d.dispose();
|
||||||
|
|
||||||
|
// 将 BufferedImage 转换为 InputStream 以便上传
|
||||||
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
|
ImageIO.write(image, "jpg", os);
|
||||||
|
InputStream inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||||
|
|
||||||
|
// 设置文件目录和名称
|
||||||
|
String catalogue = "temp/";
|
||||||
|
String extension = "jpg"; // 假设是 JPG 格式
|
||||||
|
String fileName = catalogue + "t_" + UUIDUtil.uuid() + "." + extension;
|
||||||
|
|
||||||
|
// 上传文件到 MinIO
|
||||||
|
PutObjectOptions putObjectOptions = new PutObjectOptions(inputStream.available(), -1);
|
||||||
|
putObjectOptions.setContentType("image/jpeg");
|
||||||
|
minioClient.putObject(
|
||||||
|
minioConfig.getBucketName(), fileName, inputStream, putObjectOptions);
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
|
System.out.println("矩形框已绘制并上传到 MinIO,文件路径:" + globalValue.getMinioEndpoint() + "/" +
|
||||||
|
globalValue.getMinioBucketName() + "/" + fileName);
|
||||||
|
|
||||||
|
return fileName;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "error";
|
||||||
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
|
@ -36,6 +36,11 @@ public class FaceVideoVo {
|
||||||
*/
|
*/
|
||||||
private Rect rect;
|
private Rect rect;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 绘制后图片url
|
||||||
|
*/
|
||||||
|
|
||||||
|
private String imageWithRectangle;
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
package net.shapelight.modules.iCq.dal.dataobject.personTemp;
|
||||||
|
|
||||||
|
public class TenPersonSyncTempEntity {
|
||||||
|
}
|
|
@ -0,0 +1,24 @@
|
||||||
|
package net.shapelight.modules.iCq.dal.mysql.personTemp;
|
||||||
|
|
||||||
|
import org.apache.ibatis.annotations.Delete;
|
||||||
|
import org.apache.ibatis.annotations.Insert;
|
||||||
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
|
@Mapper
|
||||||
|
public interface TenPersonSyncTempMapper {
|
||||||
|
|
||||||
|
@Insert("INSERT INTO ten_person_sync_temp (open_id) VALUES (#{openId});")
|
||||||
|
public void insertTemp(String openId);
|
||||||
|
|
||||||
|
@Delete("DELETE FROM ten_person_sync_temp;")
|
||||||
|
void removeAll();
|
||||||
|
|
||||||
|
@Delete("DELETE FROM ten_person WHERE open_id NOT IN (SELECT open_id FROM ten_person_sync_temp);")
|
||||||
|
void removeDeletedPerson();
|
||||||
|
|
||||||
|
|
||||||
|
@Delete("DELETE FROM ten_person_sync_836266616957173761 WHERE person_id NOT IN (SELECT person_id from ten_person WHERE open_id in (SELECT open_id FROM ten_person_sync_temp));")
|
||||||
|
void removeDeletedPersonSync();
|
||||||
|
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,90 @@
|
||||||
|
package net.shapelight.modules.iCq.utils;
|
||||||
|
|
||||||
|
import com.arcsoft.face.Rect;
|
||||||
|
import io.minio.MinioClient;
|
||||||
|
import io.minio.PutObjectOptions;
|
||||||
|
import net.shapelight.common.config.GlobalValue;
|
||||||
|
import net.shapelight.common.config.MinioConfig;
|
||||||
|
import net.shapelight.common.utils.UUIDUtil;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
|
||||||
|
import javax.imageio.ImageIO;
|
||||||
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.ByteArrayInputStream;
|
||||||
|
import java.io.ByteArrayOutputStream;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.net.URL;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
public class DrawUtils {
|
||||||
|
|
||||||
|
|
||||||
|
private static GlobalValue globalValue;
|
||||||
|
|
||||||
|
private static MinioClient minioClient;
|
||||||
|
|
||||||
|
private static MinioConfig minioConfig;
|
||||||
|
|
||||||
|
public DrawUtils(GlobalValue globalValue, MinioClient minioClient, MinioConfig minioConfig) {
|
||||||
|
DrawUtils.globalValue = globalValue;
|
||||||
|
DrawUtils.minioClient = minioClient;
|
||||||
|
DrawUtils.minioConfig = minioConfig;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String draw(String imageUrl, List<Rect> rectList) {
|
||||||
|
|
||||||
|
try {
|
||||||
|
// 从 URL 读取图片
|
||||||
|
BufferedImage image = ImageIO.read(new URL(globalValue.getMinioEndpoint() + "/" +
|
||||||
|
globalValue.getMinioBucketName() + "/" + imageUrl));
|
||||||
|
|
||||||
|
// 获取绘图上下文
|
||||||
|
Graphics2D g2d = image.createGraphics();
|
||||||
|
g2d.setColor(Color.RED); // 设置框的颜色
|
||||||
|
g2d.setStroke(new BasicStroke(3)); // 设置框的线条宽度
|
||||||
|
|
||||||
|
|
||||||
|
// 遍历每个矩形框并绘制
|
||||||
|
for (Rect rect : rectList) {
|
||||||
|
int left = rect.left;
|
||||||
|
int top = rect.top;
|
||||||
|
int width = rect.right - rect.left;
|
||||||
|
int height = rect.bottom - rect.top;
|
||||||
|
|
||||||
|
g2d.drawRect(left, top, width, height);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 释放资源
|
||||||
|
g2d.dispose();
|
||||||
|
|
||||||
|
// 将 BufferedImage 转换为 InputStream 以便上传
|
||||||
|
ByteArrayOutputStream os = new ByteArrayOutputStream();
|
||||||
|
ImageIO.write(image, "jpg", os);
|
||||||
|
InputStream inputStream = new ByteArrayInputStream(os.toByteArray());
|
||||||
|
|
||||||
|
// 设置文件目录和名称
|
||||||
|
String catalogue = "temp/";
|
||||||
|
String extension = "jpg"; // 假设是 JPG 格式
|
||||||
|
String fileName = catalogue + "t_" + UUIDUtil.uuid() + "." + extension;
|
||||||
|
|
||||||
|
// 上传文件到 MinIO
|
||||||
|
PutObjectOptions putObjectOptions = new PutObjectOptions(inputStream.available(), -1);
|
||||||
|
putObjectOptions.setContentType("image/jpeg");
|
||||||
|
minioClient.putObject(
|
||||||
|
minioConfig.getBucketName(), fileName, inputStream, putObjectOptions);
|
||||||
|
inputStream.close();
|
||||||
|
|
||||||
|
System.out.println("矩形框已绘制并上传到 MinIO,文件路径:" + globalValue.getMinioEndpoint() + "/" +
|
||||||
|
globalValue.getMinioBucketName() + "/" + fileName);
|
||||||
|
|
||||||
|
return fileName;
|
||||||
|
|
||||||
|
} catch (Exception e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
return "error";
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -56,9 +56,13 @@ public class DbBakTask implements ITask {
|
||||||
fileDir.setWritable(true,false);
|
fileDir.setWritable(true,false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
String mysqlLocation = "SHOW VARIABLES LIKE 'basedir';";
|
||||||
|
|
||||||
//String cmd = "mysqldump -u"+ dbUsername +" -p"+dbPassword +" "+ dbName + " -r " + path;
|
//String cmd = "mysqldump -u"+ dbUsername +" -p"+dbPassword +" "+ dbName + " -r " + path;
|
||||||
//mysqldump -h172.17.0.1 -P3306 -ugb -pgb site_db_docker -r /opt/sl-site/db_bak/13.sql
|
//mysqldump -h172.17.0.1 -P3306 -ugb -pgb site_db_docker -r /opt/sl-site/db_bak/13.sql
|
||||||
String cmd = "mysqldump -h"+dbHost+" -P"+dbPort+" -u"+ dbUsername +" -p"+dbPassword +" --set-charset=UTF8 "+ dbName;
|
String cmd = "mysqldump -h"+dbHost+" -P"+dbPort+" -u"+ dbUsername +" -p"+dbPassword +" --set-charset=UTF8 "+ dbName;
|
||||||
|
/*cmd = cmd + mysqlLocation + "\bin";*/
|
||||||
PrintWriter printWriter = null;
|
PrintWriter printWriter = null;
|
||||||
BufferedReader bufferedReader = null;
|
BufferedReader bufferedReader = null;
|
||||||
try {
|
try {
|
||||||
|
|
|
@ -23,6 +23,7 @@ import net.shapelight.modules.face.service.FaceEngineService;
|
||||||
import net.shapelight.modules.face.util.UserInfo;
|
import net.shapelight.modules.face.util.UserInfo;
|
||||||
import net.shapelight.modules.face.util.UserRamGroup;
|
import net.shapelight.modules.face.util.UserRamGroup;
|
||||||
import net.shapelight.modules.feignClient.CxFeignClient;
|
import net.shapelight.modules.feignClient.CxFeignClient;
|
||||||
|
import net.shapelight.modules.iCq.dal.mysql.personTemp.TenPersonSyncTempMapper;
|
||||||
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
||||||
import net.shapelight.modules.sys.controller.AbstractController;
|
import net.shapelight.modules.sys.controller.AbstractController;
|
||||||
import net.shapelight.modules.ten.entity.*;
|
import net.shapelight.modules.ten.entity.*;
|
||||||
|
@ -70,6 +71,9 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
@Autowired
|
@Autowired
|
||||||
private ServerApiService serverApiService;
|
private ServerApiService serverApiService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private TenPersonSyncTempMapper tenPersonSyncTempMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void run(String params) {
|
public void run(String params) {
|
||||||
|
@ -78,6 +82,8 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
|
|
||||||
//getPmInternalPersonnelList("Contractor");
|
//getPmInternalPersonnelList("Contractor");
|
||||||
|
|
||||||
|
tenPersonSyncTempMapper.removeAll();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
getPmInternalPersonnelList("Person");
|
getPmInternalPersonnelList("Person");
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
|
@ -99,6 +105,12 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
System.err.println("Error while fetching personnel list for Supplier: " + e.getMessage());
|
System.err.println("Error while fetching personnel list for Supplier: " + e.getMessage());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tenPersonSyncTempMapper.removeDeletedPerson();
|
||||||
|
tenPersonSyncTempMapper.removeDeletedPersonSync();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void getPmInternalPersonnelList(String type) {
|
private void getPmInternalPersonnelList(String type) {
|
||||||
|
@ -107,7 +119,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
int pageIndex = 1;
|
int pageIndex = 1;
|
||||||
Map<String, Object> params = new HashMap<>();
|
Map<String, Object> params = new HashMap<>();
|
||||||
params.put("pageIndex", pageIndex);
|
params.put("pageIndex", pageIndex);
|
||||||
params.put("pageSize", 1000);
|
params.put("pageSize", 20);
|
||||||
/* params.put("orgName", item.getName());*/
|
/* params.put("orgName", item.getName());*/
|
||||||
/*params.put("orgId", item.getCellId());*/
|
/*params.put("orgId", item.getCellId());*/
|
||||||
params.put("orgId", item.getOrgId());
|
params.put("orgId", item.getOrgId());
|
||||||
|
@ -148,7 +160,7 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
}
|
}
|
||||||
if (json.getBool("success") != null && json.getBool("success")) {
|
if (json.getBool("success") != null && json.getBool("success")) {
|
||||||
JSONObject data = json.getJSONObject("data");
|
JSONObject data = json.getJSONObject("data");
|
||||||
System.out.println("cssssssssssssssssssssss" + data);
|
/*System.out.println("cssssssssssssssssssssss" + data);*/
|
||||||
JSONArray dataList = data.getJSONArray("list");
|
JSONArray dataList = data.getJSONArray("list");
|
||||||
List<JSONObject> list1 = dataList.toList(JSONObject.class);
|
List<JSONObject> list1 = dataList.toList(JSONObject.class);
|
||||||
|
|
||||||
|
@ -191,6 +203,10 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -438,8 +454,8 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
|
|
||||||
TenPersonEntity tenPerson = new TenPersonEntity();
|
TenPersonEntity tenPerson = new TenPersonEntity();
|
||||||
Date now = new Date();
|
Date now = new Date();
|
||||||
long id = new SnowflakeIdWorker().nextId();
|
/* long id = new SnowflakeIdWorker().nextId();
|
||||||
tenPerson.setPersonId(id);
|
tenPerson.setPersonId(id);*/
|
||||||
tenPerson.setUuid(UUIDUtil.uuid());
|
tenPerson.setUuid(UUIDUtil.uuid());
|
||||||
//tenPerson.setTenantId(cellEntity.getTenantId());
|
//tenPerson.setTenantId(cellEntity.getTenantId());
|
||||||
tenPerson.setCreateBy("sync");
|
tenPerson.setCreateBy("sync");
|
||||||
|
@ -478,14 +494,20 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
tenPerson.setName(person.getStr("contractorName"));
|
tenPerson.setName(person.getStr("contractorName"));
|
||||||
}
|
}
|
||||||
if (person.getStr("personnelName") != null){
|
if (person.getStr("personnelName") != null){
|
||||||
|
|
||||||
|
|
||||||
tenPerson.setName(person.getStr("personnelName"));
|
tenPerson.setName(person.getStr("personnelName"));
|
||||||
}
|
}
|
||||||
|
|
||||||
tenPerson.setGender(person.getInt("dictSex") != null ? person.getInt("dictSex") : 0);
|
tenPerson.setGender(person.getInt("dictSex") != null ? person.getInt("dictSex") : 0);
|
||||||
tenPerson.setMobile(person.getStr("mobile") != null ? person.getStr("mobile") : null);
|
tenPerson.setMobile(person.getStr("mobile") != null ? person.getStr("mobile") : null);
|
||||||
tenPerson.setIdCard(person.getStr("personnelCardId") != null ? person.getStr("personnelCardId") : null);
|
if (person.getStr("personnelCardId") != null) {
|
||||||
|
tenPerson.setIdCard(person.getStr("personnelCardId"));
|
||||||
|
}
|
||||||
|
if (person.getStr("contractorCardId") != null) {
|
||||||
|
tenPerson.setIdCard(person.getStr("contractorCardId"));
|
||||||
|
}
|
||||||
|
if (person.getStr("supplierCardId") != null) {
|
||||||
|
tenPerson.setIdCard(person.getStr("supplierCardId"));
|
||||||
|
}
|
||||||
tenPerson.setNation(person.getStr("dictNation") != null ? Integer.parseInt(person.getStr("dictNation")) : 1);
|
tenPerson.setNation(person.getStr("dictNation") != null ? Integer.parseInt(person.getStr("dictNation")) : 1);
|
||||||
tenPerson.setCellId(cellEntity.getCellId());
|
tenPerson.setCellId(cellEntity.getCellId());
|
||||||
|
|
||||||
|
@ -514,15 +536,29 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
tenPerson.setLiveStart(sfm.parse(person.getStr("enterValidPeriod")));
|
tenPerson.setLiveStart(sfm.parse(person.getStr("enterValidPeriod")));
|
||||||
} else if (person.getStr("validPeriodSta") != null) {
|
} else if (person.getStr("validPeriodSta") != null) {
|
||||||
tenPerson.setLiveStart(sfm.parse(person.getStr("validPeriodSta")));
|
tenPerson.setLiveStart(sfm.parse(person.getStr("validPeriodSta")));
|
||||||
|
} else if(person.getStr("enterValidPeriod") == null){
|
||||||
|
tenPerson.setLiveStart(sfm.parse("1900-01-01 00:00:00"));
|
||||||
|
} else if (person.getStr("validPeriodSta") == null){
|
||||||
|
tenPerson.setLiveStart(sfm.parse("1900-01-01 00:00:00"));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (person.getStr("enterValidPeriodEnd") != null) {
|
if (person.getStr("enterValidPeriodEnd") != null) {
|
||||||
tenPerson.setLiveEnd(sfm.parse(person.getStr("enterValidPeriodEnd")));
|
tenPerson.setLiveEnd(sfm.parse(person.getStr("enterValidPeriodEnd")));
|
||||||
} else if (person.getStr("validPeriodEnd") != null) {
|
} else if (person.getStr("validPeriodEnd") != null) {
|
||||||
tenPerson.setLiveEnd(sfm.parse(person.getStr("validPeriodEnd")));
|
tenPerson.setLiveEnd(sfm.parse(person.getStr("validPeriodEnd")));
|
||||||
|
} else if (person.getStr("enterValidPeriodEnd") == null){
|
||||||
|
tenPerson.setLiveEnd(sfm.parse("2200-01-01 00:00:00"));
|
||||||
|
} else if (person.getStr("validPeriodEnd") == null){
|
||||||
|
tenPerson.setLiveEnd(sfm.parse("2200-01-01 00:00:00"));
|
||||||
}
|
}
|
||||||
|
|
||||||
} catch (ParseException e) {
|
} catch (ParseException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (person.getStr("isEnterSulfurArea") != null) {
|
if (person.getStr("isEnterSulfurArea") != null) {
|
||||||
tenPerson.setIsEnterSulfurArea(person.getStr("isEnterSulfurArea").equals("是") ? 1 : 0);
|
tenPerson.setIsEnterSulfurArea(person.getStr("isEnterSulfurArea").equals("是") ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
@ -669,6 +705,8 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
personTrain.setIsQualified(contractorTrain.getStr("isQualified").equals("是") ? 1 : 0);
|
personTrain.setIsQualified(contractorTrain.getStr("isQualified").equals("是") ? 1 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (contractorTrain.getStr("trainStartDate") != null) {
|
if (contractorTrain.getStr("trainStartDate") != null) {
|
||||||
try {
|
try {
|
||||||
personTrain.setTrainStartDate(sfm1.parse(contractorTrain.getStr("trainStartDate")));
|
personTrain.setTrainStartDate(sfm1.parse(contractorTrain.getStr("trainStartDate")));
|
||||||
|
@ -730,6 +768,31 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
tenPerson.setIsWatchSafeVideo(0);
|
tenPerson.setIsWatchSafeVideo(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
long id;
|
||||||
|
if(tenPersonService.getOne(new QueryWrapper<TenPersonEntity>()
|
||||||
|
.eq("open_id", tenPerson.getOpenId())) != null) {
|
||||||
|
//MyBatis-Plus会优先使用 personId 作为主键,因为它更具体地定义了主键的生成策略。
|
||||||
|
/*tenPersonService.removeById(tenPersonService.getOne(new QueryWrapper<TenPersonEntity>()
|
||||||
|
.eq("open_id", tenPerson.getOpenId())).getPersonId());*/
|
||||||
|
|
||||||
|
id = tenPersonService.getOne(new QueryWrapper<TenPersonEntity>()
|
||||||
|
.eq("open_id", tenPerson.getOpenId())).getPersonId();
|
||||||
|
|
||||||
|
|
||||||
|
tenPerson.setPersonId(id);
|
||||||
|
|
||||||
|
//tenPersonService.updateTenPersonByOpenId(tenPerson);
|
||||||
|
|
||||||
|
//System.out.println("更新成功" + tenPerson);
|
||||||
|
}else {
|
||||||
|
id = new SnowflakeIdWorker().nextId();
|
||||||
|
tenPerson.setPersonId(id);
|
||||||
|
//tenPersonService.saveTenPerson(tenPerson);
|
||||||
|
// System.out.println("新增成功" + tenPerson);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
if (person.getStr("attachment") != null) {
|
if (person.getStr("attachment") != null) {
|
||||||
try {
|
try {
|
||||||
//保存原始图片
|
//保存原始图片
|
||||||
|
@ -784,6 +847,11 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}*/
|
}*/
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
UserInfo userInfo = new UserInfo();
|
UserInfo userInfo = new UserInfo();
|
||||||
userInfo.setFaceId(tenPerson.getPersonId().toString());
|
userInfo.setFaceId(tenPerson.getPersonId().toString());
|
||||||
userInfo.setName(tenPerson.getName());
|
userInfo.setName(tenPerson.getName());
|
||||||
|
@ -804,12 +872,18 @@ public class PersonSynchronousTask extends AbstractController implements ITask {
|
||||||
|
|
||||||
if(tenPersonService.getOne(new QueryWrapper<TenPersonEntity>()
|
if(tenPersonService.getOne(new QueryWrapper<TenPersonEntity>()
|
||||||
.eq("open_id", tenPerson.getOpenId())) != null) {
|
.eq("open_id", tenPerson.getOpenId())) != null) {
|
||||||
//MyBatis-Plus会优先使用 personId 作为主键,因为它更具体地定义了主键的生成策略。
|
|
||||||
tenPersonService.removeById(tenPersonService.getOne(new QueryWrapper<TenPersonEntity>()
|
tenPersonService.updateTenPersonByOpenId(tenPerson);
|
||||||
.eq("open_id", tenPerson.getOpenId())).getPersonId());
|
|
||||||
}
|
System.out.println("更新成功" + tenPerson);
|
||||||
|
}else {
|
||||||
tenPersonService.saveTenPerson(tenPerson);
|
tenPersonService.saveTenPerson(tenPerson);
|
||||||
System.out.println("新增成功" + tenPerson);
|
System.out.println("新增成功" + tenPerson);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
tenPersonSyncTempMapper.insertTemp(tenPerson.getOpenId());
|
||||||
|
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -10,10 +10,12 @@ import java.text.SimpleDateFormat;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.zip.ZipOutputStream;
|
import java.util.zip.ZipOutputStream;
|
||||||
|
|
||||||
|
import cn.hutool.json.JSONObject;
|
||||||
import com.alibaba.excel.EasyExcelFactory;
|
import com.alibaba.excel.EasyExcelFactory;
|
||||||
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
import com.alibaba.excel.write.metadata.style.WriteCellStyle;
|
||||||
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
import com.alibaba.excel.write.style.HorizontalCellStyleStrategy;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import io.minio.PutObjectOptions;
|
import io.minio.PutObjectOptions;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
|
@ -586,7 +588,16 @@ public class TenPersonController extends AbstractController {
|
||||||
params.put("attachment", "data:image/jpeg;base64," + base64);
|
params.put("attachment", "data:image/jpeg;base64," + base64);
|
||||||
|
|
||||||
System.out.println("params = " + params);
|
System.out.println("params = " + params);
|
||||||
// cxFeignClient.savePmVisitorPersonnel(params);
|
JSONObject jsonObject = cxFeignClient.savePmVisitorPersonnel(params);
|
||||||
|
if(jsonObject.getStr("data") != null){
|
||||||
|
String openId = jsonObject.getStr("data");
|
||||||
|
// id
|
||||||
|
tenPerson.setOpenId(openId);
|
||||||
|
|
||||||
|
tenPersonService.update(tenPerson,
|
||||||
|
new UpdateWrapper<TenPersonEntity>().eq("person_id", id));
|
||||||
|
//tenPersonService.updateTenPersonById(tenPerson);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return R.ok();
|
return R.ok();
|
||||||
}
|
}
|
||||||
|
|
|
@ -137,4 +137,6 @@ public interface TenPersonDao extends BaseMapper<TenPersonEntity>{
|
||||||
List<TenDeptPersonCount> findDeptCount(@Param("tenantId")String tenantId);
|
List<TenDeptPersonCount> findDeptCount(@Param("tenantId")String tenantId);
|
||||||
|
|
||||||
int updateWatchSafeVideo(@Param("personId")Long personId,@Param("cellId")Long cellId);
|
int updateWatchSafeVideo(@Param("personId")Long personId,@Param("cellId")Long cellId);
|
||||||
|
|
||||||
|
void insertTemp(String openId);
|
||||||
}
|
}
|
||||||
|
|
|
@ -165,5 +165,8 @@ public interface TenPersonService extends IService<TenPersonEntity> {
|
||||||
|
|
||||||
String saveOrUpdateByField(TenPersonEntity entity,String fieldName);
|
String saveOrUpdateByField(TenPersonEntity entity,String fieldName);
|
||||||
|
|
||||||
|
void updateTenPersonByOpenId(TenPersonEntity tenPerson);
|
||||||
|
|
||||||
|
void insertTemp(String openId);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -7,6 +7,7 @@ import com.arcsoft.face.FaceInfo;
|
||||||
import com.arcsoft.face.enums.ExtractType;
|
import com.arcsoft.face.enums.ExtractType;
|
||||||
import com.arcsoft.face.toolkit.ImageFactory;
|
import com.arcsoft.face.toolkit.ImageFactory;
|
||||||
import com.arcsoft.face.toolkit.ImageInfo;
|
import com.arcsoft.face.toolkit.ImageInfo;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import io.minio.MinioClient;
|
import io.minio.MinioClient;
|
||||||
import io.minio.PutObjectOptions;
|
import io.minio.PutObjectOptions;
|
||||||
|
@ -29,6 +30,7 @@ import net.shapelight.modules.face.service.FaceEngineService;
|
||||||
import net.shapelight.modules.face.util.Base64Util;
|
import net.shapelight.modules.face.util.Base64Util;
|
||||||
import net.shapelight.modules.face.util.UserInfo;
|
import net.shapelight.modules.face.util.UserInfo;
|
||||||
import net.shapelight.modules.face.util.UserRamGroup;
|
import net.shapelight.modules.face.util.UserRamGroup;
|
||||||
|
import net.shapelight.modules.iCq.dal.mysql.personTemp.TenPersonSyncTempMapper;
|
||||||
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
import net.shapelight.modules.nettyapi.service.ServerApiService;
|
||||||
import net.shapelight.modules.ten.controller.TenUserController;
|
import net.shapelight.modules.ten.controller.TenUserController;
|
||||||
import net.shapelight.modules.ten.entity.*;
|
import net.shapelight.modules.ten.entity.*;
|
||||||
|
@ -111,6 +113,9 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
|
||||||
@Value("${global.minio.bucketName}")
|
@Value("${global.minio.bucketName}")
|
||||||
private String bucketName;
|
private String bucketName;
|
||||||
|
|
||||||
|
private TenPersonSyncTempMapper tenPersonSyncTempMapper;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PageUtils queryPage(Map<String, Object> params) {
|
public PageUtils queryPage(Map<String, Object> params) {
|
||||||
|
|
||||||
|
@ -395,6 +400,9 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
|
||||||
InputStream tempInputStream = minioClient.getObject(minioConfig.getBucketName(), tempOrgImageFile);
|
InputStream tempInputStream = minioClient.getObject(minioConfig.getBucketName(), tempOrgImageFile);
|
||||||
//----------------算法检测----------------------------------------------
|
//----------------算法检测----------------------------------------------
|
||||||
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
byte[] buffer = new byte[1024];
|
byte[] buffer = new byte[1024];
|
||||||
int length;
|
int length;
|
||||||
while ((length = tempInputStream.read(buffer)) != -1) {
|
while ((length = tempInputStream.read(buffer)) != -1) {
|
||||||
|
@ -2780,4 +2788,48 @@ public class TenPersonServiceImpl extends ServiceImpl<TenPersonDao,TenPersonEnti
|
||||||
return "update";
|
return "update";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void updateTenPersonByOpenId(TenPersonEntity tenPerson) {
|
||||||
|
|
||||||
|
UpdateWrapper<TenPersonEntity> updateWrapper = new UpdateWrapper<>();
|
||||||
|
// 根据某个字段设置更新条件,比如根据 id 更新
|
||||||
|
updateWrapper.eq("open_id", tenPerson.getOrgId());
|
||||||
|
|
||||||
|
tenPersonDao.update(tenPerson, updateWrapper);
|
||||||
|
|
||||||
|
//发送设备通知
|
||||||
|
List<TenDeviceVo> devList = tenDeviceService.findByCellId(tenPerson.getCellId());
|
||||||
|
//状态是0正常,发送推送
|
||||||
|
if (tenPerson.getStatus() == Constant.PESON_SUATUS_NOMOR) {
|
||||||
|
for (TenDeviceVo dev : devList) {
|
||||||
|
//添加到同步表,下发设备通知
|
||||||
|
TenPersonSyncEntity syncEntity = new TenPersonSyncEntity();
|
||||||
|
syncEntity.setPersonId(tenPerson.getPersonId());
|
||||||
|
syncEntity.setTenantId(tenPerson.getTenantId());
|
||||||
|
syncEntity.setDeviceSn(dev.getSn());
|
||||||
|
syncEntity.setDeviceId(dev.getDeviceId());
|
||||||
|
syncEntity.setState(1);
|
||||||
|
syncEntity.setLastUpdateTime(tenPerson.getLastUpdateTime());
|
||||||
|
tenPersonSyncService.insert(syncEntity);
|
||||||
|
|
||||||
|
//下发通知
|
||||||
|
List<TenPersonOperationVo> list = new ArrayList<>();
|
||||||
|
TenPersonOperationVo vo = new TenPersonOperationVo();
|
||||||
|
vo.setUid(syncEntity.getPersonId());
|
||||||
|
vo.setOperation(1);
|
||||||
|
vo.setLast_update_stamp(syncEntity.getLastUpdateTime());
|
||||||
|
list.add(vo);
|
||||||
|
serverApiService.personOperation(dev.getSn(), list);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void insertTemp(String openId) {
|
||||||
|
tenPersonSyncTempMapper.insertTemp(openId);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -539,6 +539,12 @@
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<insert id="insertTemp">
|
||||||
|
INSERT INTO ten_person_sync_temp (open_id) VALUES (#{openId});
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
|
||||||
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
<update id="updateById" parameterType="net.shapelight.modules.ten.entity.TenPersonEntity">
|
||||||
update ten_person
|
update ten_person
|
||||||
<set>
|
<set>
|
||||||
|
|
Loading…
Reference in New Issue