优化代码：
package com.simba.taobao.shield.helpers;

import com.alibaba.fastjson.JSON;
import com.alibaba.solar.jupiter.client.dto.outentity.OutEntityMessageDTO;
import com.taobao.item.domain.ItemDO;
import com.taobao.item.domain.ItemImageDO;
import com.taobao.item.domain.query.QueryItemOptionsDO;
import com.taobao.item.domain.result.ItemResultDO;
import com.taobao.item.service.client.ItemQueryServiceClient;
import com.taobao.simba.shield.api.common.FeatureKeys;
import com.taobao.simba.shield.sdk.utils.StringUtils;
import org.apache.commons.collections4.CollectionUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.*;

/**
 * @Author: huafeng
 * @Email: <PRESIDIO_ANONYMIZED_EMAIL_ADDRESS>
 * @Date:2023-04-07 11:23
 */
public class IcFactoryHelper {

    private static ItemQueryServiceClient itemQueryServiceClient;

    private static final Logger inDataLog = LoggerFactory.getLogger("shield_in_data");

    /**
     * 通过ic查到标题、主题、副图,取到后放字段里面
     * 添加宝贝subMessageType = 88
     *宝贝变更subMessageType = 9（主图+副图)，34（标题）
     * @param propertyMap
     * @param itemId
     */
    public static void fillItemTitleAndPicture(Map<String, String> propertyMap, Long itemId, Integer messageType, Integer subMessageType) {
        if (itemId == null || subMessageType == null) {
            return;
        }
        ItemDO itemDO = getItemInfo(itemId);
        if (itemDO == null) {
            return;
        }
        //宝贝变更subMessageType = 34（标题）
        if (StringUtils.isNotBlank(itemDO.getTitle()) && OutEntityMessageDTO.MESSAGE_TYPE_ITEM_TITLE_CHANGE.equals(subMessageType)) {
            propertyMap.put(FeatureKeys.CMS_DESC_TEXT.getKey(), itemDO.getTitle());
        }
        //添加宝贝subMessageType = 88 or 宝贝变更subMessageType = 9（主图+副图)
        if(OutEntityMessageDTO.MESSAGE_TYPE_ITEM_IMAGE_CHANGE.equals(subMessageType) || OutEntityMessageDTO.MESSAGE_TYPE_RSS_CONTENT_ACTIVITY_ITEMS_CHANGE.equals(subMessageType)){
            Set<String> imgs = new HashSet<>();
            //解析主图
            if (StringUtils.isNotBlank(itemDO.getPictUrl())) {
                imgs.add(itemDO.getPictUrl());
            }
            //解析futu 并放到 set里
            if (CollectionUtils.isNotEmpty(itemDO.getCommonItemImageList())) {
                List<ItemImageDO> futus = itemDO.getCommonItemImageList();
                for (ItemImageDO itemImageDO : futus) {
                    //不为空且图片状态正常
                    if (itemImageDO.getImageUrl() != null && itemImageDO.getStatus() == 1) {
                        imgs.add(itemImageDO.getImageUrl());
                    }
                }
            }
            if (CollectionUtils.isNotEmpty(imgs)) {
                propertyMap.put(FeatureKeys.CMS_DESC_IMAGES.getKey(), JSON.toJSONString(imgs));
            }
        }
    }

    /**
     * 调用IC查询 获取商品信息
     *
     * @param itemId 宝贝ID
     * @return 商品信息
     */
    public static ItemDO getItemInfo(long itemId) {
        QueryItemOptionsDO options = new QueryItemOptionsDO();
        //需要查图片 但不需要查库存数量
        options.setIncludeImages(true);
        options.setIncludeQuantity(false);
        ItemResultDO itemResult;
        try {
            itemResult = itemQueryServiceClient.queryItemById(itemId, options);
        } catch (Exception e) {
            inDataLog.warn("itemQueryServiceClient.queryItemById hsf error:", e);
            return null;
        }
        if (itemResult != null && itemResult.isSuccess() && itemResult.getItem() != null) {
            return itemResult.getItem();
        }
        return null;
    }


    public void setItemQueryServiceClient(ItemQueryServiceClient itemQueryServiceClient) {
        IcFactoryHelper.itemQueryServiceClient = itemQueryServiceClient;
    }
}