whycxzp
2025-04-03 918fa28b3f48b9598e264d0f483508b92f8d8a3b
src/main/java/com/whyc/service/WmsService.java
@@ -11,6 +11,7 @@
import com.whyc.util.ThreadLocalUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import sun.applet.Main;
import java.util.Date;
import java.util.HashMap;
@@ -93,11 +94,12 @@
        //对结果进行处理
        if(response.getCode() == 1){ //请求成功,data有正常数据
            String dataStr = (String) response.getData();
            //截取dataStr中"data:"后的字符串
            /*//截取dataStr中"data:"后的字符串
            int index = dataStr.indexOf("data");
            dataStr = dataStr.substring(index+6, dataStr.length()-3);
            //WmsLocationDto wmsLocationDto = JsonUtil.getGson().fromJson(dataStr, WmsLocationDto.class);
            List<WmsLocationDto> wmsLocationDtoList = JsonUtil.getGson().fromJson(dataStr, new TypeToken<List<WmsLocationDto>>(){}.getType());
            //WmsLocationDto wmsLocationDto = JsonUtil.getGson().fromJson(dataStr, WmsLocationDto.class);*/
            WmsResponse<List<WmsLocationDto>> wmsResponse = JsonUtil.getGson().fromJson(dataStr, new TypeToken<WmsResponse<List<WmsLocationDto>>>(){}.getType());
            List<WmsLocationDto> wmsLocationDtoList = wmsResponse.getData();
            response.set(1,wmsLocationDtoList);
        }
        return response;
@@ -113,11 +115,13 @@
        //对结果进行处理
        if(response.getCode() == 1){ //请求成功,data有正常数据
            String dataStr = (String) response.getData();
            /*
            //截取dataStr中"data:"后的字符串
            int index = dataStr.indexOf("data");
            dataStr = dataStr.substring(index+6, dataStr.length()-3);
            //WmsLocationDto wmsLocationDto = JsonUtil.getGson().fromJson(dataStr, WmsLocationDto.class);
            List<WmsPallet> wmsPalletList = JsonUtil.getGson().fromJson(dataStr, new TypeToken<List<WmsPallet>>(){}.getType());
            List<WmsPallet> wmsPalletList = JsonUtil.getGson().fromJson(dataStr, new TypeToken<List<WmsPallet>>(){}.getType());*/
            WmsResponse<List<WmsPallet>> wmsResponse = JsonUtil.getGson().fromJson(dataStr, new TypeToken<WmsResponse<List<WmsPallet>>>(){}.getType());
            List<WmsPallet> wmsPalletList = wmsResponse.getData();
            response.set(1,wmsPalletList);
        }
        return response;