no message
parent
15317f5e1e
commit
68d88d190e
|
|
@ -22,8 +22,10 @@ import com.youchain.basicdata.domain.Point;
|
|||
import com.youchain.basicdata.domain.Studen;
|
||||
import com.youchain.basicdata.service.StudenService;
|
||||
import com.youchain.basicdata.service.dto.StudenQueryCriteria;
|
||||
import com.youchain.businessdata.inputJson.OrderInfo;
|
||||
import com.youchain.config.FileProperties;
|
||||
import com.youchain.exception.handler.ApiError;
|
||||
import com.youchain.exception.handler.ApiResult;
|
||||
import com.youchain.modules.system.domain.Dept;
|
||||
import com.youchain.utils.BaseStatus;
|
||||
import com.youchain.utils.FileUtil;
|
||||
|
|
@ -51,6 +53,7 @@ import java.util.Map;
|
|||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
import static org.springframework.http.HttpStatus.BAD_REQUEST;
|
||||
import static org.springframework.http.HttpStatus.OK;
|
||||
|
||||
/**
|
||||
* @website https://eladmin.vip
|
||||
|
|
@ -69,6 +72,31 @@ public class StudenController {
|
|||
//导入
|
||||
private final FileProperties properties;
|
||||
|
||||
|
||||
@PostMapping("/getOrderInfo")
|
||||
@Log("获取送货单信息")
|
||||
@ApiOperation("获取送货单信息")
|
||||
public ResponseEntity<Object> getOrderInfo(@RequestBody OrderInfo orderInfo){
|
||||
String resultJson = "";
|
||||
try {
|
||||
System.out.println("1111111");
|
||||
resultJson = studenService.getOrderJson(orderInfo);//获取送货单JSON
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
|
||||
if (resultJson == null || resultJson.length() == 0) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), "接口异常!", ""), HttpStatus.BAD_REQUEST);
|
||||
} else {
|
||||
try {
|
||||
studenService.getOrderInfo(resultJson);//获取送货单
|
||||
return new ResponseEntity<>(ApiResult.success(OK.value(), "", resultJson), HttpStatus.OK);
|
||||
} catch (Exception e) {
|
||||
return new ResponseEntity<>(ApiResult.success(BAD_REQUEST.value(), e.getMessage(), ""), HttpStatus.BAD_REQUEST);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Log("导入点位")
|
||||
@PostMapping(value = "/import_studen")
|
||||
@ApiOperation("导入点位")
|
||||
|
|
|
|||
|
|
@ -18,6 +18,7 @@ package com.youchain.basicdata.service;
|
|||
import com.youchain.basicdata.domain.Studen;
|
||||
import com.youchain.basicdata.service.dto.StudenDto;
|
||||
import com.youchain.basicdata.service.dto.StudenQueryCriteria;
|
||||
import com.youchain.businessdata.inputJson.OrderInfo;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import java.util.Map;
|
||||
import java.util.List;
|
||||
|
|
@ -87,4 +88,8 @@ public interface StudenService {
|
|||
* @throws IOException /
|
||||
*/
|
||||
void download(List<StudenDto> all, HttpServletResponse response) throws IOException;
|
||||
|
||||
String getOrderJson(OrderInfo orderInfo);
|
||||
|
||||
void getOrderInfo(String resultJson);
|
||||
}
|
||||
|
|
@ -15,12 +15,12 @@
|
|||
*/
|
||||
package com.youchain.basicdata.service.impl;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.youchain.basicdata.domain.Studen;
|
||||
import com.youchain.basicdata.repository.PointRepository;
|
||||
import com.youchain.utils.FileUtil;
|
||||
import com.youchain.utils.PageUtil;
|
||||
import com.youchain.utils.QueryHelp;
|
||||
import com.youchain.utils.ValidationUtil;
|
||||
import com.youchain.businessdata.inputJson.OrderInfo;
|
||||
import com.youchain.utils.*;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import com.youchain.basicdata.repository.StudenRepository;
|
||||
import com.youchain.basicdata.service.StudenService;
|
||||
|
|
@ -115,4 +115,46 @@ public class StudenServiceImpl implements StudenService {
|
|||
}
|
||||
FileUtil.downloadExcel(list, response);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getOrderJson(OrderInfo orderInfo) {
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||
objMap.put("ifaceCode", orderInfo.getIfaceCode());//获取送货单信息
|
||||
objMap.put("sourceSystem", orderInfo.getSourceSystem());//来源系统
|
||||
objMap.put("params", orderInfo.getParams());
|
||||
jsonObject.putAll(objMap);
|
||||
return HttpPostUtil.sendPostReq(UrlApi.publicApi, jsonObject.toString(), this.getToKen());//返回ResponseJson*/
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getOrderInfo(String resultJson) {
|
||||
|
||||
}
|
||||
public String getToKen() {
|
||||
String toKen = "";
|
||||
String mlsUser = "WMS";
|
||||
String mlsPwd = "EDlsFOvn3xaJm*EH";
|
||||
JSONObject jsonObject = new JSONObject(new LinkedHashMap<>());
|
||||
Map<String, Object> objMap = new LinkedHashMap<>();
|
||||
objMap.put("mlsUser", mlsUser);//快码代码
|
||||
objMap.put("mlsPwd", mlsPwd);//快码值
|
||||
jsonObject.putAll(objMap);
|
||||
String resultJson = HttpPostUtil.sendPostReq(UrlApi.extSignIn, jsonObject.toString());//返回ResponseJson*/
|
||||
JSONObject resulObject = JSON.parseObject(resultJson);
|
||||
//判断接口是否成功
|
||||
if (resulObject == null) {
|
||||
throw new RuntimeException("获取toKen接口返回数据为空!");
|
||||
}
|
||||
|
||||
String code = resulObject.getString("code") == null ? "" : resulObject.getString("code");
|
||||
String msg = resulObject.getString("msg") == null ? "" : resulObject.getString("msg");
|
||||
|
||||
if ("0".equals(code)) {
|
||||
toKen = resulObject.getString("data") == null ? "" : resulObject.getString("data");
|
||||
return toKen;
|
||||
} else {
|
||||
throw new RuntimeException("MLS异常信息:" + msg);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -35,6 +35,7 @@ public class MlsController {
|
|||
@ApiOperation("获取送货单信息")
|
||||
@AnonymousAccess
|
||||
public ResponseEntity<Object> getOrderInfo(@RequestBody OrderInfo orderInfo) {
|
||||
|
||||
String resultJson = "";
|
||||
try {
|
||||
resultJson = mlsService.getOrderJson(orderInfo);//获取送货单JSON
|
||||
|
|
|
|||
Loading…
Reference in New Issue