|
@@ -75,9 +75,13 @@ import org.slf4j.Logger;
|
|
|
import org.slf4j.LoggerFactory;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.http.*;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
|
|
+import org.springframework.util.LinkedMultiValueMap;
|
|
|
+import org.springframework.util.MultiValueMap;
|
|
|
+import org.springframework.web.client.RestTemplate;
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
import java.io.*;
|
|
@@ -2964,6 +2968,127 @@ public class TWarehouseBillsServiceImpl implements ITWarehouseBillsService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ public AjaxResult ruoYiVersionOrderListNew(TWarehouseBills tWarehouseBills) {
|
|
|
+ List<Map<String,Object>> result = tWarehouseBillsMapper.ruoYiVersionOrderList(tWarehouseBills);
|
|
|
+ List<ShipperDataVo> list = new ArrayList<>();
|
|
|
+ for (Map<String,Object> map : result) {
|
|
|
+ // 新建实体
|
|
|
+ ShipperDataVo dataVo = new ShipperDataVo();
|
|
|
+ dataVo.setBillOfLadingNo((String) map.get("fBillno"));
|
|
|
+ dataVo.setOrderEnterprise((String) map.get("corpName"));
|
|
|
+ dataVo.setOrderEnterpriseNo("91370220334191898X");
|
|
|
+ dataVo.setConsignee((String) map.get("fConsigneername"));
|
|
|
+ dataVo.setConsigneeAddress((String) map.get("fConsigneername"));
|
|
|
+ dataVo.setConsigneePersonPhone((String) map.get("fConsigneetel"));
|
|
|
+ dataVo.setBillTime(StringUtils.nowTimeStr(map.get("createTime")));
|
|
|
+ dataVo.setShipAgent("青岛凯和志成");
|
|
|
+ dataVo.setShipAgentNo("BH1234678767");
|
|
|
+ dataVo.setSendEnterprise("青岛凯和志成");
|
|
|
+ dataVo.setSendType("2");
|
|
|
+ dataVo.setSwitchBillPerson("OP");
|
|
|
+ dataVo.setDeliveryClause((String) map.get("fServiceitems"));
|
|
|
+ //dataVo.setContractNo("HT2345678");
|
|
|
+ //dataVo.setBillType("A");
|
|
|
+ //dataVo.setOceanFreight("到付海运费");
|
|
|
+ //dataVo.setCurrency("币种");
|
|
|
+ dataVo.setShipCompany("青岛凯和志成");
|
|
|
+ dataVo.setXsgsm("GSM001");
|
|
|
+ dataVo.setImportZone("进口关区");
|
|
|
+ dataVo.setFirstTrans("第一程运输");
|
|
|
+ dataVo.setTradeFlag("N");
|
|
|
+ dataVo.setMtdm("QQCTN");
|
|
|
+ dataVo.setLoadingPort((String) map.get("loadportName"));
|
|
|
+ dataVo.setDischargePort((String) map.get("destportName"));
|
|
|
+ //dataVo.setDestination("目的地");
|
|
|
+ //dataVo.setDischargePlace("卸货地点");
|
|
|
+ dataVo.setArrivalDatetime((String) map.get("fEta"));
|
|
|
+ dataVo.setBillMark((String) map.get("fMarks"));
|
|
|
+ //dataVo.setVesselNameCn("中文船名");
|
|
|
+ dataVo.setVesselNameEn("KaiHeZhinCheng");
|
|
|
+ dataVo.setVoyageNumber((String) map.get("fVoyTwoName"));
|
|
|
+ dataVo.setImo("IMO001");
|
|
|
+ dataVo.setMtdm("TDH2345678");
|
|
|
+ dataVo.setMtVesselCode("QD22334455");
|
|
|
+ dataVo.setMtVoyageNumber("HC12345678");
|
|
|
+ dataVo.setGoodsName((String) map.get("goodsName"));
|
|
|
+ dataVo.setPackages("12");
|
|
|
+ dataVo.setPackagesUnit("吨");
|
|
|
+ dataVo.setWeight("12.3");
|
|
|
+ dataVo.setWeightUnit("吨");
|
|
|
+ dataVo.setVolume("23.1");
|
|
|
+ dataVo.setVolumeUnit("体积单位");
|
|
|
+ //dataVo.setTransferRemark("备注(换单备注)");
|
|
|
+ dataVo.setConDescribe((String) map.get("fNo"));
|
|
|
+ dataVo.setLclType("0");
|
|
|
+ List<ShipperContList> contLists = new ArrayList<>();
|
|
|
+
|
|
|
+ //配箱信息
|
|
|
+ TWarehousebillsCntritems warehousebillsCntritems = new TWarehousebillsCntritems();
|
|
|
+ warehousebillsCntritems.setfPid(Long.valueOf(map.get("fId").toString()));
|
|
|
+ List<TWarehousebillsCntritems> tWarehousebillsCntritems = tWarehousebillsCntritemsMapper.selectTWarehousebillsCntritemsList(warehousebillsCntritems);
|
|
|
+ if (CollectionUtils.isNotEmpty(tWarehousebillsCntritems)) {
|
|
|
+ for (TWarehousebillsCntritems cntritems : tWarehousebillsCntritems) {
|
|
|
+ ShipperContList contList = new ShipperContList();
|
|
|
+ contList.setContainerNo(cntritems.getfCntrno());
|
|
|
+ contList.setContainerType(cntritems.getfCntrid().toString());
|
|
|
+ contList.setContainerSize(cntritems.getfPackageid());
|
|
|
+ contList.setSealno(cntritems.getfSealno());
|
|
|
+ //contList.setConPackages("12");
|
|
|
+ //contList.setConWeight("1.2");
|
|
|
+ //contList.setConVolume("21");
|
|
|
+ contList.setLclType("0");
|
|
|
+ contLists.add(contList);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ dataVo.setContList(contLists);
|
|
|
+ // list.add(dataVo);
|
|
|
+ String json = JSONObject.toJSONString(dataVo);
|
|
|
+ System.err.println("json:" + json);
|
|
|
+ //String jsonStr = JSONObject.toJSONString(dataVo);
|
|
|
+ // 请求路径 (测试)
|
|
|
+ // String postUrl = "https://api.qingdao-port.net/container/web/eir/edo/shipagent/insertEdo.do";
|
|
|
+ String postUrl = "https://api.qingdao-port.net/container/web/eir/edo/shipagent/insertEdo.do";
|
|
|
+ // 请求路径 (正式)
|
|
|
+ //String postUrl = "https://api.qingdao-port.net/container/web/wlds_eir/edo/shipagent/insertEdo.do";
|
|
|
+ // 请求参数
|
|
|
+ Map<String,String> params = new HashMap<>();
|
|
|
+ params.put("customerCode","A00001");
|
|
|
+ params.put("sign","abcdef");
|
|
|
+ params.put("reqTime",StringUtils.nowTimeStr());
|
|
|
+ params.put("data",json);
|
|
|
+ System.err.println(params);
|
|
|
+ TResponseVo responseVo = sendPostRequest(postUrl,params);
|
|
|
+ System.err.println(responseVo);
|
|
|
+ if (!responseVo.isSuccess()) {
|
|
|
+ return AjaxResult.error(responseVo.getMessage().get("msg"));
|
|
|
+ } else {
|
|
|
+ return AjaxResult.success(responseVo.getMessage().get("msg"));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // String json = JSONObject.toJSONString(list);
|
|
|
+ return AjaxResult.success("成功");
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 向目的 URL 发送 post 请求
|
|
|
+ * @param url 目的 url
|
|
|
+ * @param params 发送的参数
|
|
|
+ * @return ResponseVo
|
|
|
+ */
|
|
|
+ public static TResponseVo sendPostRequest(String url, Map<String,String> params) {
|
|
|
+ RestTemplate client = new RestTemplate();
|
|
|
+ HttpHeaders headers = new HttpHeaders();
|
|
|
+ HttpMethod method = HttpMethod.POST;
|
|
|
+ // 以表单的方式提交
|
|
|
+ headers.setContentType(MediaType.APPLICATION_JSON);
|
|
|
+ // 将请求头部和参数合成一个请求
|
|
|
+ HttpEntity<Map<String,String>> requestEntity = new HttpEntity<>(params,headers);
|
|
|
+ // 执行 HTTP 请求,将返回的结构使用 ResponseVo 类格式化
|
|
|
+ ResponseEntity<TResponseVo> response = client.exchange(url, method, requestEntity, TResponseVo.class);
|
|
|
+ return response.getBody();
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
public List<Map<String, Object>> webVersionOrderMessage(LoginUser loginUser, TWarehouseBills tWarehouseBills) {
|
|
|
TWarehouseBills warehouseBills = new TWarehouseBills();
|
|
|
if (tWarehouseBills != null) {
|