# InternalOperationController.java

    package cloud.wconnect.rateshop.controller.internal.rateshop;

    import cloud.wconnect.commonlib.controller.BaseInternalController;
    import cloud.wconnect.commonlib.pojo.dto.PropertyDTO;
    import cloud.wconnect.commonlib.service.PropertyInternalService;
    import cloud.wconnect.rateshop.pojo.dto.rateshop.internal.InternalOperationDTO;
    import cloud.wconnect.rateshop.service.rateshop.IPropertyOperationService;
    import lombok.extern.slf4j.Slf4j;
    import org.apache.commons.collections.CollectionUtils;
    import org.springframework.beans.factory.annotation.Autowired;
    import org.springframework.beans.factory.annotation.Value;
    import org.springframework.validation.annotation.Validated;
    import org.springframework.web.bind.annotation.*;

    import jakarta.validation.Valid;
    import java.util.Collections;
    import java.util.List;
    import java.util.Map;

    /**
     * Internal Controller: 采集资产运营数据
     *
     * @author zc
     * @date 2024/03/23
     */
    @Slf4j
    @Validated
    @RestController
    @RequestMapping("/internal/operation/collect")
    public class InternalOperationController extends BaseInternalController {

        @Autowired
        private PropertyInternalService propertyInternalService;
        @Autowired
        private IPropertyOperationService propertyOperationService;

        @Value("${internal.service.auth-key.basic}")
        private String authKey;

        /**
         * 保存采集运营数据
         *
         * @param tenant           租户标识
         * @param property         资产标识
         * @param sign             签名
         * @param operationDTOList 运营数据DTO集合
         * @return empty map
         * @author zc
         * @date 2024/3/23
         */
        @PostMapping
        public Map<Object, Object> saveCollectOperation(String tenant, String property, @RequestHeader String sign,
                                                        @RequestBody List<@Valid InternalOperationDTO> operationDTOList) {
            log.info("Rate shop internal - save operation start, tenant:{}, property:{}", tenant, property);

            // 校验签名
            checkIntranetParams(authKey, sign, tenant, property);

            if (CollectionUtils.isEmpty(operationDTOList)) {
                return Collections.emptyMap();
            }
            PropertyDTO propertyDTO = propertyInternalService.getOne(property, tenant);

            propertyOperationService.saveCollectOperation(propertyDTO, operationDTOList);

            log.info("Rate shop internal - save operation end, tenant:{}, property:{}", tenant, property);

            return Collections.emptyMap();
        }
    }