This commit is contained in:
2025-07-24 01:18:01 +08:00
parent eb61058fd1
commit 49b750e1af
8 changed files with 52 additions and 3 deletions

View File

@@ -55,4 +55,6 @@ public interface OrderMapper {
OrderEntity queryTypeOrder(Long userId, Long scenicId, int orderType, Integer priceConfigId);
OrderEntity getUserOrderItem(Long userId, Long scenicId, int orderType, Long configId, Integer goodsType, Long goodsId);
int updateMemberIdByFaceId(OrderEntity orderEntity);
}

View File

@@ -83,4 +83,6 @@ public interface SourceMapper {
void addSourceWatermark(Long sourceId, Long faceId, String type, String url);
int deleteUselessSource();
int updateMemberIdByFaceId(Long faceId, Long memberId);
}

View File

@@ -56,4 +56,6 @@ public interface VideoMapper {
int deleteNotBuyFaceRelations(Long userId, Long faceId);
int deleteUselessVideo();
int updateMemberIdByFaceId(Long faceId, Long memberId);
}

View File

@@ -37,5 +37,5 @@ public interface FaceService {
ApiResponse<List<ContentPageVO>> contentListUseDefaultFace();
void bindFace(Long faceId, Long userId);
void bindFace(Long faceId, Long memberId);
}

View File

@@ -14,6 +14,7 @@ import com.ycwl.basic.mapper.StatisticsMapper;
import com.ycwl.basic.mapper.FaceMapper;
import com.ycwl.basic.mapper.TemplateMapper;
import com.ycwl.basic.mapper.VideoMapper;
import com.ycwl.basic.mapper.OrderMapper;
import com.ycwl.basic.model.mobile.face.FaceRecognizeResp;
import com.ycwl.basic.model.mobile.order.IsBuyRespVO;
import com.ycwl.basic.model.mobile.scenic.content.ContentPageVO;
@@ -28,6 +29,7 @@ import com.ycwl.basic.model.pc.source.entity.MemberSourceEntity;
import com.ycwl.basic.model.pc.source.entity.SourceEntity;
import com.ycwl.basic.model.pc.source.req.SourceReqQuery;
import com.ycwl.basic.model.pc.source.resp.SourceRespVO;
import com.ycwl.basic.model.pc.order.entity.OrderEntity;
import com.ycwl.basic.model.pc.task.entity.TaskEntity;
import com.ycwl.basic.model.pc.video.entity.MemberVideoEntity;
import com.ycwl.basic.model.pc.video.entity.VideoEntity;
@@ -102,6 +104,8 @@ public class FaceServiceImpl implements FaceService {
private TemplateBiz templateBiz;
@Autowired
private DeviceRepository deviceRepository;
@Autowired
private OrderMapper orderMapper;
@Override
public ApiResponse<PageInfo<FaceRespVO>> pageQuery(FaceReqQuery faceReqQuery) {
@@ -493,8 +497,32 @@ public class FaceServiceImpl implements FaceService {
}
@Override
public void bindFace(Long faceId, Long userId) {
public void bindFace(Long faceId, Long memberId) {
FaceEntity face = faceRepository.getFace(faceId);
if (face == null) {
throw new BaseException("人脸数据不存在");
}
Long currentMemberId = face.getMemberId();
if (currentMemberId.equals(memberId)) {
return;
}
FaceEntity updateFace = new FaceEntity();
updateFace.setId(faceId);
updateFace.setMemberId(memberId);
faceMapper.update(updateFace);
sourceMapper.updateMemberIdByFaceId(faceId, memberId);
videoMapper.updateMemberIdByFaceId(faceId, memberId);
OrderEntity orderUpdate = new OrderEntity();
orderUpdate.setFaceId(faceId);
orderUpdate.setMemberId(memberId);
orderMapper.updateMemberIdByFaceId(orderUpdate);
faceRepository.clearFaceCache(faceId);
}

View File

@@ -517,4 +517,9 @@
and oi.goods_id = #{goodsId}
</if>
</select>
<update id="updateMemberIdByFaceId">
update `order`
set member_id = #{memberId}
where face_id = #{faceId}
</update>
</mapper>

View File

@@ -242,4 +242,9 @@
and ms.face_id = #{faceId}
<if test="type!=null">and ms.type = #{type} </if>
</select>
<update id="updateMemberIdByFaceId">
update member_source
set member_id = #{memberId}
where face_id = #{faceId}
</update>
</mapper>

View File

@@ -165,4 +165,9 @@
from video
where id = #{id}
</select>
<update id="updateMemberIdByFaceId">
update member_video
set member_id = #{memberId}
where face_id = #{faceId}
</update>
</mapper>