diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/dto/AllocCanteenModifyDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/dto/AllocCanteenModifyDTO.java index 61d2497f..f840c8dc 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/dto/AllocCanteenModifyDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/dto/AllocCanteenModifyDTO.java @@ -70,7 +70,7 @@ public class AllocCanteenModifyDTO { } public String getImgUrl() { - return SysUtil.getCutPath(this.imgUrl); + return SysUtil.getPrefixToFileUrl(this.imgUrl); } public String getPayCodeUrl() { @@ -202,7 +202,7 @@ public class AllocCanteenModifyDTO { } public void setImgUrl(final String imgUrl) { - this.imgUrl = imgUrl; + this.imgUrl = SysUtil.setPrefixToFileUrl(imgUrl); } public void setCapacity(final Integer capacity) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/dto/AllocCanteenSaveDTO.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/dto/AllocCanteenSaveDTO.java index 4693bf0d..f188711e 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/dto/AllocCanteenSaveDTO.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/dto/AllocCanteenSaveDTO.java @@ -58,7 +58,7 @@ public class AllocCanteenSaveDTO { private Map extendMap; public String getImgUrl() { - return SysUtil.getCutFileUrl(this.imgUrl); + return SysUtil.getPrefixToFileUrl(this.imgUrl); } public String getPayCodeUrl() { @@ -178,7 +178,7 @@ public class AllocCanteenSaveDTO { } public void setImgUrl(final String imgUrl) { - this.imgUrl = imgUrl; + this.imgUrl = SysUtil.setPrefixToFileUrl(imgUrl); } public void setCapacity(final Integer capacity) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/model/AllocCanteen.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/model/AllocCanteen.java index 64ea41e8..ea34e97a 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/model/AllocCanteen.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/allocation/canteen/model/AllocCanteen.java @@ -119,7 +119,7 @@ public class AllocCanteen { } public String getImgUrl() { - return SysUtil.getCutPath(this.imgUrl); + return SysUtil.getPrefixToFileUrl(this.imgUrl); } public String getPayCodeUrl() { @@ -309,7 +309,7 @@ public class AllocCanteen { } public void setImgUrl(final String imgUrl) { - this.imgUrl = imgUrl; + this.imgUrl = SysUtil.setPrefixToFileUrl(imgUrl); } public void setCapacity(final Integer capacity) { diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/common/utils/SysUtil.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/common/utils/SysUtil.java index 7f8835d4..4ab6ebdc 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/common/utils/SysUtil.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/common/utils/SysUtil.java @@ -38,12 +38,35 @@ public class SysUtil { return sysUtilProxy.getPrefix(prefixOn, prefixOff); } + public static String getIpPort() { + return getPrefix().substring(0, getPrefix().lastIndexOf("/")); + } + public static String getBucket() { return bucket; } + + public static String getPrefixToFileUrl(String fileUrl) { + log.info("出参_补图_原路径:{},前缀:{},存储桶:{}, ip_port:{}", new Object[]{fileUrl, getPrefix(), getBucket(), getIpPort()}); + if (!CharSequenceUtil.isBlank(fileUrl) && !fileUrl.startsWith(getPrefix())) { + return getPrefix() + "/" + fileUrl; + } else { + return fileUrl; + } + } + + public static String setPrefixToFileUrl(String fileUrl) { + log.info("出参_补图_原路径:{},前缀:{},存储桶:{}, ip_port:{}", new Object[]{fileUrl, getPrefix(), getBucket(), getIpPort()}); + if (!CharSequenceUtil.isBlank(fileUrl) && !fileUrl.startsWith(getPrefix())) { + return getPrefix() + "/" + fileUrl; + } else { + return fileUrl; + } + } + public static String getCutFileUrl(String fileUrl) { - log.info("出参_补图_原路径:{},前缀:{},存储桶:{}", new Object[]{fileUrl, getPrefix(), getBucket()}); + log.info("出参_补图_原路径:{},前缀:{},存储桶:{}, ip_port:{}", new Object[]{fileUrl, getPrefix(), getBucket(), getIpPort()}); String cutFileUrl = null; try { cutFileUrl = getCutFileUrl(fileUrl, getPrefix(), getBucket()); diff --git a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/service/impl/FaceRegisterServiceImpl.java b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/service/impl/FaceRegisterServiceImpl.java index 8b579c9c..cb9174d4 100644 --- a/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/service/impl/FaceRegisterServiceImpl.java +++ b/bonus-modules/bonus-smart-canteen/src/main/java/com/bonus/canteen/core/customer/service/impl/FaceRegisterServiceImpl.java @@ -235,7 +235,7 @@ public class FaceRegisterServiceImpl implements FaceRegisterService { if ("1".equals(faceMetadataModel.getIfRainbowSoftFaceUrl())){ System.out.println("开始采集虹软人脸"); ArcFaceHelper arcFaceHelper = new ArcFaceHelper(); - FaceResult faceResult = arcFaceHelper.getFaceFeatures("http://192.168.0.14:9090" + registerParamDTO.getMinioPicPath()); + FaceResult faceResult = arcFaceHelper.getFaceFeatures(SysUtil.getIpPort() + registerParamDTO.getMinioPicPath()); System.err.println("采集结束"); if (faceResult != null){ MultiModelFaceVO faceVO = new MultiModelFaceVO();