|
@@ -1,9 +1,7 @@
|
|
|
package org.jeecg.modules.documents.shippingDetails.controller;
|
|
|
|
|
|
import java.text.SimpleDateFormat;
|
|
|
-import java.util.Arrays;
|
|
|
-import java.util.List;
|
|
|
-import java.util.Map;
|
|
|
+import java.util.*;
|
|
|
import java.io.IOException;
|
|
|
import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
@@ -11,6 +9,8 @@ import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
+import com.google.gson.Gson;
|
|
|
+import com.google.gson.GsonBuilder;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
@@ -23,10 +23,12 @@ import org.jeecg.modules.documents.seclarationElements.service.ISyDeclarationEle
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetails;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.VO.OrderDataVo;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.entity.VO.PushShippingDeialVo;
|
|
|
+import org.jeecg.modules.documents.shippingDetails.entity.VO.PushShippingVO;
|
|
|
import org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo;
|
|
|
import org.jeecg.modules.documents.shippingDetails.service.ISyShippingDetailsItemService;
|
|
|
import org.jeecg.modules.documents.shippingDetails.service.ISyShippingDetailsService;
|
|
|
-import java.util.Date;
|
|
|
+
|
|
|
import java.util.logging.SimpleFormatter;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
@@ -102,9 +104,6 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
queryWrapper.ge("t.documentDate",startTime);
|
|
|
queryWrapper.le("t.documentDate",endTime);
|
|
|
}
|
|
|
- if(oConvertUtils.isNotEmpty(syShippingDetails.getPreCompletionDate())){
|
|
|
- queryWrapper.ge("t.preCompletionDate",syShippingDetails.getPreCompletionDate());
|
|
|
- }
|
|
|
if(oConvertUtils.isNotEmpty(syShippingDetails.getPreDeliveryDate())){
|
|
|
queryWrapper.eq("t.preDeliveryDate",syShippingDetails.getPreDeliveryDate());
|
|
|
}
|
|
@@ -330,8 +329,8 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
* @param syShippingDetails
|
|
|
* @return
|
|
|
*/
|
|
|
- @AutoLog(value = "发运明细提交")
|
|
|
- @ApiOperation(value = "发运明细提交", notes="发运明细提交")
|
|
|
+ @AutoLog(value = "发运明细提交,(提交:type=1,取消提交:type = 2)")
|
|
|
+ @ApiOperation(value = "发运明细提交,(提交:type=1,取消提交:type = 2)", notes="发运明细提交,(提交:type=1,取消提交:type = 2)")
|
|
|
@PostMapping(value = "/syShippingDetailsSubmit")
|
|
|
public Result<SyShippingDetails> syShippingDetailsSubmit(@RequestBody SyShippingDetails syShippingDetails) {
|
|
|
|
|
@@ -352,12 +351,12 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
return result;
|
|
|
}
|
|
|
//判断是否已提交
|
|
|
- if(shippingDetails.getState().equals("1")){
|
|
|
- result.setMessage("该单据已提交,不允许再次提交!");
|
|
|
- result.setSuccess(false);
|
|
|
- return result;
|
|
|
- }
|
|
|
- int i = syShippingDetailsService.syShippingDetailsSubmit(syShippingDetails.getId());
|
|
|
+// if(shippingDetails.getState().equals("1") && syShippingDetails.getType().equals("1")){
|
|
|
+// result.setMessage("该单据已提交,不允许再次提交!");
|
|
|
+// result.setSuccess(false);
|
|
|
+// return result;
|
|
|
+// }
|
|
|
+ int i = syShippingDetailsService.syShippingDetailsSubmit(syShippingDetails.getId(),syShippingDetails.getType());
|
|
|
if(i>0){
|
|
|
result.setMessage("提交成功!");
|
|
|
result.setSuccess(true);
|
|
@@ -377,7 +376,7 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
/**
|
|
|
* 发运明细查询订单接口
|
|
|
* @param orderNumber
|
|
|
- * @param pkOrg
|
|
|
+ * @param account
|
|
|
* @param pageNo
|
|
|
* @param pageSize
|
|
|
* @param request
|
|
@@ -387,7 +386,7 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
@AutoLog(value = "发运明细查询订单")
|
|
|
@ApiOperation(value="发运明细查询订单", notes="发运明细查询订单")
|
|
|
@GetMapping(value = "/queryOrderData")
|
|
|
- public Result<IPage<OrderDataVo>> queryOrderData(String orderNumber,String pkOrg,
|
|
|
+ public Result<IPage<OrderDataVo>> queryOrderData(String orderNumber,String account,
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
HttpServletRequest request, HttpServletResponse response) {
|
|
@@ -400,8 +399,8 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
if (oConvertUtils.isNotEmpty(orderNumber)) {
|
|
|
queryWrapper.eq("a.order_number", orderNumber);
|
|
|
}
|
|
|
- if (oConvertUtils.isNotEmpty(pkOrg)) {
|
|
|
- queryWrapper.eq("a.pk_org", pkOrg);
|
|
|
+ if (oConvertUtils.isNotEmpty(account)) {
|
|
|
+ queryWrapper.eq("a.account", account);
|
|
|
}
|
|
|
queryWrapper.eq("a.del_flag", 0);
|
|
|
queryWrapper.orderByDesc("a.order_number");
|
|
@@ -420,44 +419,76 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
* @param id
|
|
|
* @return
|
|
|
*/
|
|
|
+ @AutoLog(value = "发运明细推送接口")
|
|
|
+ @ApiOperation(value="发运明细推送接口", notes="发运明细推送接口")
|
|
|
+ @GetMapping(value = "/pushSyShipping")
|
|
|
public JSONObject pushSyShipping(String id){
|
|
|
|
|
|
JSONObject result = new JSONObject();
|
|
|
+ List<PushShippingVO> list = new ArrayList<PushShippingVO>();
|
|
|
|
|
|
try {
|
|
|
-
|
|
|
- //查询主表
|
|
|
- SyShippingDetails shippingDetails = syShippingDetailsService.getById(id);
|
|
|
- //查询子表
|
|
|
- QueryWrapper<SyShippingDetailsItem> syShippingDetailsItemQueryWrapper = new QueryWrapper<SyShippingDetailsItem>();
|
|
|
- syShippingDetailsItemQueryWrapper.eq("shipping_details_id",shippingDetails.getId()).eq("del_flag",0);
|
|
|
- List<SyShippingDetailsItem> syShippingDetailsItemList = syShippingDetailsItemService.list(syShippingDetailsItemQueryWrapper);
|
|
|
- if(syShippingDetailsItemList.size()!=0){
|
|
|
- shippingDetails.setSyShippingDetailsItemList(syShippingDetailsItemList);
|
|
|
- }
|
|
|
- //转JSON
|
|
|
- result.put("payload", JSONObject.toJSON(shippingDetails));
|
|
|
- log.info("JSON数据:" + result);
|
|
|
-
|
|
|
+ if(oConvertUtils.isEmpty(id)){
|
|
|
+ System.out.println("ID为空!");
|
|
|
+ }
|
|
|
//查询IP及账套信息、时间戳
|
|
|
QueryWrapper<DxpDataPlan> queryWrapper = new QueryWrapper<>();
|
|
|
queryWrapper.eq("code", "senYu_syShipping");
|
|
|
Page<DxpDataPlan> page = new Page<DxpDataPlan>(1, 100);
|
|
|
IPage<DxpDataPlan> pageList = iDxpDataPlanService.page(page, queryWrapper);
|
|
|
List<DxpDataPlan> resultList = pageList.getRecords();
|
|
|
+
|
|
|
+ //获取路径
|
|
|
+ QueryWrapper<DxpDataPlan> queryWrappertoken = new QueryWrapper<>();
|
|
|
+ queryWrappertoken.eq("code", "senYu_SH_token");
|
|
|
+ Page<DxpDataPlan> pagetoken = new Page<DxpDataPlan>(1, 100);
|
|
|
+ IPage<DxpDataPlan> tokenpage = iDxpDataPlanService.page(pagetoken, queryWrappertoken);
|
|
|
+ List<DxpDataPlan> tokenList = tokenpage.getRecords();
|
|
|
+ String tokenUrl = tokenList.get(0).getItemIp()+tokenList.get(0).getItemUrl();
|
|
|
+
|
|
|
+ //查询主表
|
|
|
+ PushShippingVO pushShippingVO = syShippingDetailsService.pushSyShipping(id);
|
|
|
+ //查询子表
|
|
|
+ List<PushShippingDeialVo> pushShippingDeialVoList = syShippingDetailsService.pushSyShippingDeial(id);
|
|
|
+ pushShippingVO.setLines(pushShippingDeialVoList);
|
|
|
+
|
|
|
+ list.add(pushShippingVO);
|
|
|
+ //转JSON
|
|
|
+ Gson userGson = new GsonBuilder().create();
|
|
|
+ result.put("payload", userGson.toJson(JSONObject.toJSON(list)));
|
|
|
+ log.info("JSON数据:" + result);
|
|
|
+
|
|
|
//拼接url
|
|
|
String url = resultList.get(0).getItemIp() + resultList.get(0).getItemUrl();
|
|
|
//调用doPost
|
|
|
InterfaceConnUtils interfaceConnUtils = new InterfaceConnUtils();
|
|
|
//处理返回信息
|
|
|
- JSONObject informationJson = interfaceConnUtils.doPostToBearer(result, url,null, "发运明细接口-");
|
|
|
+ JSONObject informationJson = interfaceConnUtils.doPostToBearer(result, url,tokenUrl, "发运明细接口-");
|
|
|
//获取返回信息
|
|
|
JSONObject jsonArray = informationJson.getJSONObject("payload");
|
|
|
|
|
|
+ //回写是否同步成功
|
|
|
+
|
|
|
+ //获取是否成功
|
|
|
+ String code = jsonArray.getString("code");
|
|
|
+ //获取返回消息
|
|
|
+ String message = jsonArray.getString("message");
|
|
|
+
|
|
|
+ SyShippingDetails shippingDetails = syShippingDetailsService.getById(id);
|
|
|
+ if(code.equals("S")){
|
|
|
+ shippingDetails.setPushState("1");
|
|
|
+ shippingDetails.setPushMessage(message);
|
|
|
+
|
|
|
+ }else{
|
|
|
+ shippingDetails.setPushState("2");
|
|
|
+ shippingDetails.setPushMessage(message);
|
|
|
+ }
|
|
|
+ syShippingDetailsService.updateById(shippingDetails);
|
|
|
+
|
|
|
}catch (Exception ex){
|
|
|
|
|
|
ex.printStackTrace();
|
|
|
- log.error("提交失败:" + ex.getMessage());
|
|
|
+ log.error("推送失败:" + ex.getMessage());
|
|
|
}
|
|
|
return result;
|
|
|
}
|
|
@@ -541,8 +572,8 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
ex.printStackTrace();
|
|
|
- log.error("提交失败:" + ex.getMessage());
|
|
|
- result.error500("提交失败:" + ex.getMessage());
|
|
|
+ log.error("保存失败:" + ex.getMessage());
|
|
|
+ result.error500("保存失败:" + ex.getMessage());
|
|
|
}
|
|
|
return result;
|
|
|
}
|