|
@@ -1,5 +1,6 @@
|
|
|
package org.jeecg.modules.documents.shippingDetails.controller;
|
|
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
import java.util.Arrays;
|
|
|
import java.util.List;
|
|
|
import java.util.Map;
|
|
@@ -8,11 +9,17 @@ import java.io.UnsupportedEncodingException;
|
|
|
import java.net.URLDecoder;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSONObject;
|
|
|
import org.jeecg.common.api.vo.Result;
|
|
|
import org.jeecg.common.exception.JeecgBootException;
|
|
|
import org.jeecg.common.system.query.QueryGenerator;
|
|
|
import org.jeecg.common.aspect.annotation.AutoLog;
|
|
|
import org.jeecg.common.util.oConvertUtils;
|
|
|
+import org.jeecg.modules.documents.seclarationElements.entity.SyDeclarationElements;
|
|
|
+import org.jeecg.modules.documents.seclarationElements.entity.SyDeclarationElementsItem;
|
|
|
+import org.jeecg.modules.documents.seclarationElements.service.ISyDeclarationElementsItemService;
|
|
|
+import org.jeecg.modules.documents.seclarationElements.service.ISyDeclarationElementsService;
|
|
|
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;
|
|
@@ -20,11 +27,17 @@ 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;
|
|
|
import com.baomidou.mybatisplus.core.metadata.IPage;
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.jeecg.common.system.base.controller.JeecgController;
|
|
|
+import org.jeecg.modules.openApi.entity.DxpDataPlan;
|
|
|
+import org.jeecg.modules.openApi.service.IDxpDataPlanService;
|
|
|
+import org.jeecg.modules.system.util.InterfaceConnUtils;
|
|
|
+import org.jeecg.modules.system.util.JsonChangeUtils;
|
|
|
import org.jeecgframework.poi.excel.ExcelImportUtil;
|
|
|
import org.jeecgframework.poi.excel.def.NormalExcelConstants;
|
|
|
import org.jeecgframework.poi.excel.entity.ExportParams;
|
|
@@ -55,6 +68,12 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
private ISyShippingDetailsService syShippingDetailsService;
|
|
|
@Autowired
|
|
|
private ISyShippingDetailsItemService syShippingDetailsItemService;
|
|
|
+ @Autowired
|
|
|
+ private IDxpDataPlanService iDxpDataPlanService;
|
|
|
+ @Autowired
|
|
|
+ private ISyDeclarationElementsService syDeclarationElementsService;
|
|
|
+ @Autowired
|
|
|
+ private ISyDeclarationElementsItemService syDeclarationElementsItemService;
|
|
|
|
|
|
/**
|
|
|
* 分页列表查询
|
|
@@ -68,12 +87,30 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
@AutoLog(value = "发运明细主表-分页列表查询")
|
|
|
@ApiOperation(value="发运明细主表-分页列表查询", notes="发运明细主表-分页列表查询")
|
|
|
@GetMapping(value = "/list")
|
|
|
- public Result<IPage<SyShippingDetailsVo>> queryPageList(SyShippingDetailsVo syShippingDetails,
|
|
|
+ public Result<IPage<SyShippingDetailsVo>> queryPageList(SyShippingDetailsVo syShippingDetails,String startTime,String endTime,
|
|
|
@RequestParam(name="pageNo", defaultValue="1") Integer pageNo,
|
|
|
@RequestParam(name="pageSize", defaultValue="10") Integer pageSize,
|
|
|
HttpServletRequest req) {
|
|
|
Result<IPage<SyShippingDetailsVo>> result = new Result<IPage<SyShippingDetailsVo>>();
|
|
|
- QueryWrapper<SyShippingDetailsVo> queryWrapper = QueryGenerator.initQueryWrapper(syShippingDetails, req.getParameterMap());
|
|
|
+ QueryWrapper<SyShippingDetailsVo> queryWrapper = new QueryWrapper<>();
|
|
|
+ SimpleDateFormat sf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
+ if(oConvertUtils.isNotEmpty(syShippingDetails.getDocumentNo())){
|
|
|
+ queryWrapper.eq("t.documentNo",syShippingDetails.getDocumentNo());
|
|
|
+ }
|
|
|
+ if(oConvertUtils.isNotEmpty(startTime)){
|
|
|
+
|
|
|
+ queryWrapper.ge("t.documentDate",startTime);
|
|
|
+ queryWrapper.le("t.documentDate",endTime);
|
|
|
+ }
|
|
|
+ if(oConvertUtils.isNotEmpty(syShippingDetails.getPreDeliveryDate())){
|
|
|
+ queryWrapper.eq("t.preDeliveryDate",syShippingDetails.getPreDeliveryDate());
|
|
|
+ }
|
|
|
+ if(oConvertUtils.isNotEmpty(syShippingDetails.getSalesman())){
|
|
|
+ queryWrapper.eq("t.salesman",syShippingDetails.getSalesman());
|
|
|
+ }
|
|
|
+ if(oConvertUtils.isNotEmpty(syShippingDetails.getItemNumber())){
|
|
|
+ queryWrapper.eq("t.itemNumber",syShippingDetails.getItemNumber());
|
|
|
+ }
|
|
|
Page<SyShippingDetailsVo> page = new Page<SyShippingDetailsVo>(pageNo, pageSize);
|
|
|
IPage<SyShippingDetailsVo> pageList = syShippingDetailsService.queryShippingDetails(page, queryWrapper);
|
|
|
result.setSuccess(true);
|
|
@@ -169,16 +206,22 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
Result<Integer> result = new Result<>();
|
|
|
|
|
|
if(oConvertUtils.isEmpty(id)){
|
|
|
- throw new JeecgBootException("ID不能为空!");
|
|
|
+ result.setMessage("ID不能为空!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
}
|
|
|
//判断是由有该数据
|
|
|
SyShippingDetails shippingDetails = syShippingDetailsService.getById(id);
|
|
|
if(oConvertUtils.isEmpty(shippingDetails)){
|
|
|
- throw new JeecgBootException("未找到该数据!");
|
|
|
+ result.setMessage("未找到该数据!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
}
|
|
|
//判断是否已提交
|
|
|
if(shippingDetails.getState().equals("1")){
|
|
|
- throw new JeecgBootException("该单据已提交,不允许删除!");
|
|
|
+ result.setMessage("该单据已提交,不允许删除!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
}
|
|
|
|
|
|
int size = syShippingDetailsService.syShippingDetailsDelete(id);
|
|
@@ -294,23 +337,29 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
try {
|
|
|
|
|
|
if(oConvertUtils.isEmpty(id)){
|
|
|
- throw new JeecgBootException("未拿到ID");
|
|
|
+ result.setMessage("未拿到ID");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
}
|
|
|
//判断是否有该数据
|
|
|
SyShippingDetails shippingDetails = syShippingDetailsService.getById(id);
|
|
|
if(oConvertUtils.isEmpty(shippingDetails)){
|
|
|
- throw new JeecgBootException("未找到该数据!");
|
|
|
+ result.setMessage("未找到该数据!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
}
|
|
|
//判断是否已提交
|
|
|
if(shippingDetails.getState().equals("1")){
|
|
|
- throw new JeecgBootException("该单据已提交,不允许再次提交!");
|
|
|
+ result.setMessage("该单据已提交,不允许再次提交!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ int i = syShippingDetailsService.syShippingDetailsSubmit(id);
|
|
|
+ if(i>0){
|
|
|
+ result.setMessage("提交成功!");
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(shippingDetails);
|
|
|
}
|
|
|
- shippingDetails.setState("1");
|
|
|
- syShippingDetailsService.updateById(shippingDetails);
|
|
|
-
|
|
|
- result.setMessage("提交成功!");
|
|
|
- result.setSuccess(true);
|
|
|
- result.setResult(shippingDetails);
|
|
|
|
|
|
}catch (Exception ex){
|
|
|
ex.printStackTrace();
|
|
@@ -361,4 +410,137 @@ public class SyShippingDetailsController extends JeecgController<SyShippingDetai
|
|
|
|
|
|
return result;
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ *发运明细推送接口
|
|
|
+ * @param id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public JSONObject pushSyShipping(String id){
|
|
|
+
|
|
|
+ JSONObject result = new JSONObject();
|
|
|
+
|
|
|
+ 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);
|
|
|
+
|
|
|
+ //查询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();
|
|
|
+ //拼接url
|
|
|
+ String url = resultList.get(0).getItemIp() + resultList.get(0).getItemUrl();
|
|
|
+ //调用doPost
|
|
|
+ InterfaceConnUtils interfaceConnUtils = new InterfaceConnUtils();
|
|
|
+ //处理返回信息
|
|
|
+ JSONObject informationJson = interfaceConnUtils.doPostToBearer(result, url,null, "发运明细接口-");
|
|
|
+ //获取返回信息
|
|
|
+ JSONObject jsonArray = informationJson.getJSONObject("payload");
|
|
|
+
|
|
|
+ }catch (Exception ex){
|
|
|
+
|
|
|
+ ex.printStackTrace();
|
|
|
+ log.error("提交失败:" + ex.getMessage());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询报关要素
|
|
|
+ * @param hsCode
|
|
|
+ * @param request
|
|
|
+ * @param response
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "查询报关要素")
|
|
|
+ @ApiOperation(value="查询报关要素", notes="查询报关要素")
|
|
|
+ @GetMapping(value = "/queryDeclarationElements")
|
|
|
+ public Result<SyDeclarationElements> queryDeclarationElements(String hsCode,
|
|
|
+ HttpServletRequest request, HttpServletResponse response){
|
|
|
+
|
|
|
+ Result<SyDeclarationElements> result = new Result<SyDeclarationElements>();
|
|
|
+
|
|
|
+ if(oConvertUtils.isEmpty(hsCode)){
|
|
|
+ result.setMessage("HsCode没有获取到!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ //查询报关要素主表
|
|
|
+ QueryWrapper<SyDeclarationElements> queryWrapper = new QueryWrapper<SyDeclarationElements>();
|
|
|
+ queryWrapper.eq("hs_code",hsCode).eq("del_flag",0);
|
|
|
+ List<SyDeclarationElements> syDeclarationElements = syDeclarationElementsService.list(queryWrapper);
|
|
|
+ if(syDeclarationElements.size()==0){
|
|
|
+ SyDeclarationElements syDeclarationElementsEntityNull = new SyDeclarationElements();
|
|
|
+ result.setMessage("查询成功!");
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(syDeclarationElementsEntityNull);
|
|
|
+ }else {
|
|
|
+ SyDeclarationElements syDeclarationElementsEntity = syDeclarationElements.get(0);
|
|
|
+ //查询报关要素子表
|
|
|
+ QueryWrapper<SyDeclarationElementsItem> queryWrapperItem = new QueryWrapper<SyDeclarationElementsItem>();
|
|
|
+ queryWrapperItem.eq("sy_declaration_elements_id", syDeclarationElementsEntity.getId()).eq("del_flag", 0);
|
|
|
+ List<SyDeclarationElementsItem> syDeclarationElementsItemsList = syDeclarationElementsItemService.list(queryWrapperItem);
|
|
|
+ syDeclarationElementsEntity.setSyDeclarationElementsItemList(syDeclarationElementsItemsList);
|
|
|
+
|
|
|
+ result.setMessage("查询成功!");
|
|
|
+ result.setSuccess(true);
|
|
|
+ result.setResult(syDeclarationElementsEntity);
|
|
|
+ }
|
|
|
+
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 报关要素新增
|
|
|
+ * @param syDeclarationElements
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @AutoLog(value = "新增报关要素")
|
|
|
+ @ApiOperation(value="新增报关要素", notes="新增报关要素")
|
|
|
+ @GetMapping(value = "/syDeclarationElementsAdd")
|
|
|
+ public Result<SyDeclarationElements> syDeclarationElementsAdd(@RequestBody SyDeclarationElements syDeclarationElements){
|
|
|
+
|
|
|
+ Result<SyDeclarationElements> result = new Result<SyDeclarationElements>();
|
|
|
+ try {
|
|
|
+
|
|
|
+ if(oConvertUtils.isEmpty(syDeclarationElements)){
|
|
|
+ result.setMessage("实体对象不能为空!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ List<SyDeclarationElementsItem> items = syDeclarationElements.getSyDeclarationElementsItemList();
|
|
|
+ if(items.size()==0){
|
|
|
+ result.setMessage("实体对象子表信息不能为空!");
|
|
|
+ result.setSuccess(false);
|
|
|
+ return result;
|
|
|
+ }
|
|
|
+ SyDeclarationElements syDeclarationElementsAdd = syDeclarationElementsService.syDeclarationElementsAdd(syDeclarationElements);
|
|
|
+
|
|
|
+ result.setResult(syDeclarationElementsAdd);
|
|
|
+ result.setMessage("新增成功!");
|
|
|
+ result.setSuccess(true);
|
|
|
+
|
|
|
+ }catch (Exception ex){
|
|
|
+ ex.printStackTrace();
|
|
|
+ log.error("提交失败:" + ex.getMessage());
|
|
|
+ result.error500("提交失败:" + ex.getMessage());
|
|
|
+ }
|
|
|
+ return result;
|
|
|
+ }
|
|
|
}
|