From 372822d209a560b017294b594906aa89bd46f4ce Mon Sep 17 00:00:00 2001
From: k94314517 <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 11 七月 2025 09:02:41 +0800
Subject: [PATCH] 111

---
 server/services/src/main/java/com/doumee/service/business/impl/IdentityInfoServiceImpl.java |  130 ++++++++++++++++++++++++++++++++++++-------
 1 files changed, 108 insertions(+), 22 deletions(-)

diff --git a/server/services/src/main/java/com/doumee/service/business/impl/IdentityInfoServiceImpl.java b/server/services/src/main/java/com/doumee/service/business/impl/IdentityInfoServiceImpl.java
index c017ad6..f7095cb 100644
--- a/server/services/src/main/java/com/doumee/service/business/impl/IdentityInfoServiceImpl.java
+++ b/server/services/src/main/java/com/doumee/service/business/impl/IdentityInfoServiceImpl.java
@@ -1,5 +1,8 @@
 package com.doumee.service.business.impl;
 
+import com.doumee.core.constants.Constants;
+import com.doumee.core.constants.ResponseStatus;
+import com.doumee.core.exception.BusinessException;
 import com.doumee.core.model.PageData;
 import com.doumee.core.model.PageWrap;
 import com.doumee.core.utils.Utils;
@@ -13,8 +16,11 @@
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.util.CollectionUtils;
+import org.springframework.util.StringUtils;
 
+import java.util.Date;
 import java.util.List;
+import java.util.Objects;
 
 /**
  * 浼氬憳韬唤璁よ瘉淇℃伅琛⊿ervice瀹炵幇
@@ -29,6 +35,30 @@
 
     @Override
     public Integer create(IdentityInfo identityInfo) {
+        if(Objects.isNull(identityInfo)
+        || Objects.isNull(identityInfo.getType())
+        || Objects.isNull(identityInfo.getMemberId())
+        || Objects.isNull(identityInfo.getAuthType())
+                || StringUtils.isEmpty(identityInfo.getLinkName())
+                || StringUtils.isEmpty(identityInfo.getTelephone())
+                || StringUtils.isEmpty(identityInfo.getLocation())
+                || StringUtils.isEmpty(identityInfo.getImg1())
+                || Objects.isNull(identityInfo.getLat())
+                || Objects.isNull(identityInfo.getLgt())
+                || (Constants.equalsInteger(identityInfo.getAuthType(),Constants.ONE) && StringUtils.isEmpty(identityInfo.getCompanyName()))
+                || (Constants.equalsInteger(identityInfo.getAuthType(),Constants.ZERO) && StringUtils.isEmpty(identityInfo.getImg2()))
+                || (Constants.equalsInteger(identityInfo.getAuthType(),Constants.ONE) && Constants.equalsInteger(identityInfo.getType(),Constants.ONE) && StringUtils.isEmpty(identityInfo.getImg2()))
+                || (Constants.equalsInteger(identityInfo.getAuthType(),Constants.ONE) && Constants.equalsInteger(identityInfo.getType(),Constants.TWO) && (StringUtils.isEmpty(identityInfo.getImg2())||StringUtils.isEmpty(identityInfo.getImg3())))
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        //鏌ヨ鐢ㄦ埛鏄惁宸插瓨鍦ㄥ綋鍓嶈韩浠�
+        if(identityInfoMapper.selectCount(new QueryWrapper<IdentityInfo>().lambda().eq(IdentityInfo::getMemberId,identityInfo.getMemberId())
+                .eq(IdentityInfo::getType,identityInfo.getType()))>Constants.ZERO){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"宸插瓨鍦ㄨ韬唤璇峰埛鏂版煡鐪嬶紒");
+        };
+        identityInfo.setCreateTime(new Date());
+        identityInfo.setAuditStatus(Constants.ZERO);
         identityInfoMapper.insert(identityInfo);
         return identityInfo.getId();
     }
@@ -54,7 +84,65 @@
 
     @Override
     public void updateById(IdentityInfo identityInfo) {
+        if(Objects.isNull(identityInfo)
+                || Objects.isNull(identityInfo.getId())
+                || Objects.isNull(identityInfo.getType())
+                || Objects.isNull(identityInfo.getMemberId())
+                || Objects.isNull(identityInfo.getAuthType())
+                || StringUtils.isEmpty(identityInfo.getLinkName())
+                || StringUtils.isEmpty(identityInfo.getTelephone())
+                || StringUtils.isEmpty(identityInfo.getLocation())
+                || StringUtils.isEmpty(identityInfo.getImg1())
+                || Objects.isNull(identityInfo.getLat())
+                || Objects.isNull(identityInfo.getLgt())
+                || (Constants.equalsInteger(identityInfo.getAuthType(),Constants.ONE) && StringUtils.isEmpty(identityInfo.getCompanyName()))
+                || (Constants.equalsInteger(identityInfo.getAuthType(),Constants.ZERO) && StringUtils.isEmpty(identityInfo.getImg2()))
+                || (Constants.equalsInteger(identityInfo.getAuthType(),Constants.ONE) && Constants.equalsInteger(identityInfo.getType(),Constants.ONE) && StringUtils.isEmpty(identityInfo.getImg2()))
+                || (Constants.equalsInteger(identityInfo.getAuthType(),Constants.ONE) && Constants.equalsInteger(identityInfo.getType(),Constants.TWO) && (StringUtils.isEmpty(identityInfo.getImg2())||StringUtils.isEmpty(identityInfo.getImg3())))
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        IdentityInfo model = identityInfoMapper.selectById(identityInfo.getId());
+        if (Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!Constants.equalsInteger(model.getMemberId(),identityInfo.getMemberId())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炴偍鐨勬暟鎹棤娉曡繘琛岃鎿嶄綔");
+        }
+        if(!Constants.equalsInteger(model.getAuditStatus(),Constants.THREE)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠鐘舵�佹棤娉曡繘琛岃鎿嶄綔");
+        }
+        identityInfo.setUpdateTime(new Date());
         identityInfoMapper.updateById(identityInfo);
+    }
+
+
+    @Override
+    public void updateLocation(IdentityInfo identityInfo) {
+        if(Objects.isNull(identityInfo)
+                || Objects.isNull(identityInfo.getId())
+                || Objects.isNull(identityInfo.getMemberId())
+                || StringUtils.isEmpty(identityInfo.getLocation())
+                || Objects.isNull(identityInfo.getLat())
+                || Objects.isNull(identityInfo.getLgt())
+        ){
+            throw new BusinessException(ResponseStatus.BAD_REQUEST);
+        }
+        IdentityInfo model = identityInfoMapper.selectById(identityInfo.getId());
+        if (Objects.isNull(model)){
+            throw new BusinessException(ResponseStatus.DATA_EMPTY);
+        }
+        if(!Constants.equalsInteger(model.getMemberId(),identityInfo.getMemberId())){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"闈炴偍鐨勬暟鎹棤娉曡繘琛岃鎿嶄綔");
+        }
+        if(!Constants.equalsInteger(model.getAuditStatus(),Constants.TWO)){
+            throw new BusinessException(ResponseStatus.NOT_ALLOWED.getCode(),"褰撳墠鐘舵�佹棤娉曡繘琛岃鎿嶄綔");
+        }
+        model.setLocation(identityInfo.getLocation());
+        model.setLat(identityInfo.getLat());
+        model.setLgt(identityInfo.getLgt());
+        model.setUpdateTime(new Date());
+        identityInfoMapper.updateById(model);
     }
 
     @Override
@@ -69,8 +157,27 @@
 
     @Override
     public IdentityInfo findById(Integer id) {
-        return identityInfoMapper.selectById(id);
+        IdentityInfo identityInfo = identityInfoMapper.selectById(id);
+        //缂哄け鍓嶇紑
+        identityInfo.setPrefix("");
+        return identityInfo;
     }
+
+
+    @Override
+    public IdentityInfo findByMemberType(Integer type,Integer memberId){
+        IdentityInfo identityInfo = identityInfoMapper.selectOne(new QueryWrapper<IdentityInfo>().lambda()
+                .eq(IdentityInfo::getMemberId,memberId).eq(IdentityInfo::getType,type));
+        if(Objects.nonNull(identityInfo)){
+            //缂哄け鍓嶇紑
+            identityInfo.setPrefix("");
+        }else{
+            identityInfo = new IdentityInfo();
+        }
+        return identityInfo;
+    }
+
+
 
     @Override
     public IdentityInfo findOne(IdentityInfo identityInfo) {
@@ -138,27 +245,6 @@
         }
         if (pageWrap.getModel().getLgt() != null) {
             queryWrapper.lambda().eq(IdentityInfo::getLgt, pageWrap.getModel().getLgt());
-        }
-        if (pageWrap.getModel().getIdentityFront() != null) {
-            queryWrapper.lambda().eq(IdentityInfo::getIdentityFront, pageWrap.getModel().getIdentityFront());
-        }
-        if (pageWrap.getModel().getIdentityBack() != null) {
-            queryWrapper.lambda().eq(IdentityInfo::getIdentityBack, pageWrap.getModel().getIdentityBack());
-        }
-        if (pageWrap.getModel().getBusinessLicense() != null) {
-            queryWrapper.lambda().eq(IdentityInfo::getBusinessLicense, pageWrap.getModel().getBusinessLicense());
-        }
-        if (pageWrap.getModel().getOtherFile() != null) {
-            queryWrapper.lambda().eq(IdentityInfo::getOtherFile, pageWrap.getModel().getOtherFile());
-        }
-        if (pageWrap.getModel().getTransportFile() != null) {
-            queryWrapper.lambda().eq(IdentityInfo::getTransportFile, pageWrap.getModel().getTransportFile());
-        }
-        if (pageWrap.getModel().getFoodBusinessFile() != null) {
-            queryWrapper.lambda().eq(IdentityInfo::getFoodBusinessFile, pageWrap.getModel().getFoodBusinessFile());
-        }
-        if (pageWrap.getModel().getHealthFile() != null) {
-            queryWrapper.lambda().eq(IdentityInfo::getHealthFile, pageWrap.getModel().getHealthFile());
         }
         if (pageWrap.getModel().getAuditStatus() != null) {
             queryWrapper.lambda().eq(IdentityInfo::getAuditStatus, pageWrap.getModel().getAuditStatus());

--
Gitblit v1.9.3