| | |
| | | package com.whyc.service; |
| | | |
| | | import com.google.gson.reflect.TypeToken; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.dto.WmsLocationDto; |
| | | import com.whyc.dto.WmsMaterialDto; |
| | |
| | | import com.whyc.util.HttpUtil; |
| | | import com.whyc.util.JsonUtil; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.List; |
| | | |
| | | @Service |
| | | public class WmsService { |
| | |
| | | //对结果进行处理 |
| | | if(response.getCode() == 1){ //请求成功,data有正常数据 |
| | | String dataStr = (String) response.getData(); |
| | | WmsMaterialDto wmsMaterialDto = JsonUtil.getGson().fromJson(dataStr, WmsMaterialDto.class); |
| | | //WmsMaterialDto wmsMaterialDto = JsonUtil.getGson().fromJson(dataStr, WmsMaterialDto.class); |
| | | WmsMaterialDto wmsMaterialDto = JsonUtil.getGson().fromJson(dataStr, new TypeToken<List<WmsMaterialDto>>(){}.getType()); |
| | | response.set(1,wmsMaterialDto); |
| | | } |
| | | return response; |
| | |
| | | //对结果进行处理 |
| | | if(response.getCode() == 1){ //请求成功,data有正常数据 |
| | | String dataStr = (String) response.getData(); |
| | | WmsLocationDto wmsLocationDto = JsonUtil.getGson().fromJson(dataStr, WmsLocationDto.class); |
| | | //WmsLocationDto wmsLocationDto = JsonUtil.getGson().fromJson(dataStr, WmsLocationDto.class); |
| | | WmsLocationDto wmsLocationDto = JsonUtil.getGson().fromJson(dataStr, new TypeToken<List<WmsLocationDto>>(){}.getType()); |
| | | response.set(1,wmsLocationDto); |
| | | } |
| | | return response; |