http协议设备注册接口允许照片和压缩包为空

This commit is contained in:
gaoben 2024-07-30 18:15:04 +08:00
parent 5d03d332be
commit 7a60125f71
1 changed files with 77 additions and 64 deletions

View File

@ -350,9 +350,11 @@ public class HttpApiController {
// puser.setActive_end_time(0);
puser.setLast_update_stamp(p.getLastUpdateTime().getTime());
if(p.getOrgImage()!=null && p.getOrgImage().length()>0){
puser.setFace_pic_download_url(globalValue.getMinioEndpoint()+"/"
+ globalValue.getMinioBucketName()+"/"
+ p.getOrgImage());
}
puser.setFace_pic_base64("");
@ -846,7 +848,7 @@ public class HttpApiController {
@ApiImplicitParam(name = "timestamp", value = "timestamp", paramType = "query", dataType = "String", required = true),
@ApiImplicitParam(name = "sign", value = "sign", paramType = "query", dataType = "String", required = true),
})
public R addPerson(@RequestParam("jsonString") String jsonString, @RequestParam("orgImage") MultipartFile orgImage, @RequestParam("sourceFile") MultipartFile sourceFile,@RequestParam("thdFeature") String thdFeature) {
public R addPerson(@RequestParam("jsonString") String jsonString, @RequestParam(value="orgImage",required = false) MultipartFile orgImage, @RequestParam(value="sourceFile",required = false) MultipartFile sourceFile,@RequestParam("thdFeature") String thdFeature) {
JSONObject jsonContent = JSONObject.parseObject(jsonString);
String sn = jsonContent.getString("dev_id");
String appKey = jsonContent.getString("appKey");
@ -871,7 +873,9 @@ public class HttpApiController {
TenPersonEntity tenPerson = JSONObject.toJavaObject(personJson,TenPersonEntity.class);
if(thdFeature!=null && thdFeature.length()>0){
tenPerson.setThdFeature(thdFeature);
}
if(tenPerson.getIdCard()!=null){
if(tenPerson.getIdCard().length() == 15){
@ -939,9 +943,10 @@ public class HttpApiController {
tenPerson.setCellId(deviceEntity.getCellId());
if (orgImage.isEmpty() || orgImage.getSize() == 0 || sourceFile.isEmpty() || sourceFile.getSize() == 0) {
return R.error("文件不能为空");
}
// if (orgImage.isEmpty() || orgImage.getSize() == 0 || sourceFile.isEmpty() || sourceFile.getSize() == 0) {
// return R.error("文件不能为空");
// }
if (orgImage!=null && orgImage.getSize() != 0) {
try {
//保存原始图片
String userFileUrl = globalValue.getImagesDir() + "/" +
@ -962,8 +967,9 @@ public class HttpApiController {
} catch (Exception e) {
return R.error(e.getMessage());
}
}
if (sourceFile!=null && sourceFile.getSize() != 0) {
try {
//保存sourceFiile
String userFileUrl = globalValue.getImagesDir() + "/" +
@ -1001,6 +1007,11 @@ public class HttpApiController {
} catch (Exception e) {
return R.error(e.getMessage());
}
}
//处理类型
//1. 不是固定类型给一个默认的家属类型
if(tenPerson.getPersonType()>10000){
@ -1304,7 +1315,9 @@ public class HttpApiController {
//----------------------------------------以下业务-----------------------------------------------------
JSONObject personJson = jsonContent.getJSONObject("data");
TenPersonEntity tenPerson = JSONObject.toJavaObject(personJson,TenPersonEntity.class);
if(thdFeature!=null && thdFeature.length()>0){
tenPerson.setThdFeature(thdFeature);
}
tenPerson.setPersonId(personJson.getLong("uid"));
if(tenPerson.getIdCard()!=null){