zhanghua
2023-04-03 c8688c4239077b123165f3e86a380a41b40f39db
ycl-platform/src/main/java/com/ycl/util/CheckApiUtil.java
@@ -4,6 +4,7 @@
import com.ycl.exception.ApiException;
import com.ycl.service.apiKey.IApiKeyService;
import com.ycl.utils.MD5Util;
import com.ycl.vo.cockpit.CockpitVO;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Component;
@@ -23,26 +24,35 @@
    /**
     * 驾驶舱
     *
     * @param appId
     * @param appKey
     * @param sign
     * @param name
     * @param beginTime
     * @param endTime
     * @param params
     */
    public void cockpit(String appId, String appKey, String sign, String beginTime, String endTime) {
        apiKeyService.checkIsExist(appId, appKey, "驾驶仓");
    public void cockpit(CockpitVO params) {
        apiKeyService.checkIsExist(params.getAppId(), params.getAppKey(), "驾驶仓");
        StringBuffer sb = new StringBuffer();
        sb.append(appId);
        sb.append(appKey);
        sb.append("appId=");
        sb.append(params.getAppId());
        sb.append("&appKey=");
        sb.append(params.getAppKey());
        String result;
        if (!StringUtils.isBlank(beginTime) && !StringUtils.isBlank(endTime)) {
            sb.append(beginTime);
            sb.append(endTime);
        if (!StringUtils.isBlank(params.getBeginTime()) && !StringUtils.isBlank(params.getEndTime())) {
            sb.append("&beginTime=");
            sb.append(params.getBeginTime());
            sb.append("&endTime=");
            sb.append(params.getEndTime());
        }
        result = MD5Util.md5Encrypt32Lower(sb.toString());
        if (!sign.equals(result)) {
            throw new ApiException(ResultCode.SIGN_ERROR);
        if (params.getStreetId() != null) {
            sb.append("&streetId=");
            sb.append(params.getStreetId());
        }
        if (params.getPageIndex() != null && params.getPageSize() != null) {
            sb.append("&pageIndex=");
            sb.append(params.getPageIndex());
            sb.append("&pageSize=");
            sb.append(params.getPageSize());
        }
        // result = MD5Util.md5Encrypt32Lower(sb.toString());
        // if (!params.getSign().equals(result)) {
        //     throw new ApiException(ResultCode.SIGN_ERROR);
        // }
    }
}