无关风月
2024-12-30 d69ee0edbb5df260ac6b872357b88499d7914610
manage/src/main/java/com/jilongda/manage/controller/TLensSeriesController.java
@@ -1,6 +1,7 @@
package com.jilongda.manage.controller;
import com.alibaba.fastjson.JSONArray;
import com.alibaba.fastjson.JSONObject;
import com.google.gson.JsonArray;
import com.jilongda.common.basic.ApiResult;
@@ -20,6 +21,7 @@
import java.util.ArrayList;
import java.util.List;
import java.util.Objects;
/**
 * <p>
@@ -97,34 +99,36 @@
    }
    @ApiOperation(value = "根据系列id + 球/非球查询折射率列表 球/非球入参数1为球 2非球 3双飞")
    @GetMapping(value = "/refractiveIndexList")
    public ApiResult<List<String>> refractiveIndexList(Integer id, Integer lensType) {
    public ApiResult<JSONArray> refractiveIndexList(Integer id, Integer lensType) {
        TLensSeries byId = lensSeriesService.getById(id);
        JSONArray jsonArray = null;
        if (lensType==1){
            String sphere = byId.getSphere();
            // 将字符串化为jsonArray
            if (StringUtils.hasLength(sphere)) {
                JSONObject.parseArray(sphere);
                jsonArray = JSONObject.parseArray(sphere);
            } else {
                return ApiResult.success(new ArrayList<String>());
                return ApiResult.success(new JSONArray());
            }
        }
        if (lensType==2){
            String asphericSurface = byId.getAsphericSurface();
            if (StringUtils.hasLength(asphericSurface)) {
                JSONObject.parseArray(asphericSurface);
                jsonArray = JSONObject.parseArray(asphericSurface);
            } else {
                return ApiResult.success(new ArrayList<String>());
                return ApiResult.success(new JSONArray());
            }
        }
        if (lensType==3){
            String doubleNon = byId.getDoubleNon();
            if (StringUtils.hasLength(doubleNon)) {
                JSONObject.parseArray(doubleNon);
                jsonArray = JSONObject.parseArray(doubleNon);
            } else {
                return ApiResult.success(new ArrayList<String>());
                return ApiResult.success(new JSONArray());
            }
        }
        return ApiResult.success(new ArrayList<String>());
        return ApiResult.success(jsonArray);
    }
}