Browse Source

增加SRM推送的预装箱单、装箱单(面料/成衣)接口

fenghaifu 1 week ago
parent
commit
49eab65a3a

+ 3 - 1
jeecg-boot-base/jeecg-boot-base-core/src/main/java/org/jeecg/config/shiro/ShiroConfig.java

@@ -100,7 +100,9 @@ public class ShiroConfig {
         filterChainDefinitionMap.put("/openApi/**", "anon");//openApi接口排除
         filterChainDefinitionMap.put("/report/FabricLoss/getFile", "anon");//图片预览 &下载文件不限制token
         filterChainDefinitionMap.put("/report/FabricLoss/applyCallback", "anon");//面损表oa回调
-
+        filterChainDefinitionMap.put("/spapl/syPreAssembledPackingList/srmAdd", "anon");//srm推送预装箱单接口
+        filterChainDefinitionMap.put("/splfi/syPackingListFabric/srmAdd", "anon");//srm推送面料装箱单接口
+        filterChainDefinitionMap.put("/splt/syPackingListTailoring/srmAdd", "anon");//srm推送成衣装箱单接口
 
         filterChainDefinitionMap.put("/sys/getLoginQrcode/**", "anon"); //登录二维码
         filterChainDefinitionMap.put("/sys/getQrcodeToken/**", "anon"); //监听扫码

+ 14 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/shippingDetails/entity/VO/RespUpdateVO.java

@@ -0,0 +1,14 @@
+package org.jeecg.modules.documents.shippingDetails.entity.VO;
+
+import lombok.Data;
+
+/**
+ * SRM调用返回的实体类
+ * @author fhf
+ * @date 2025/03/21
+ */
+@Data
+public class RespUpdateVO {
+    private boolean success;
+    private String message;
+}

+ 8 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/quartz/job/PushShippingDetailsJob.java

@@ -8,6 +8,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.google.gson.Gson;
 import com.google.gson.GsonBuilder;
+import lombok.extern.slf4j.Slf4j;
 import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetails;
 import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
 import org.jeecg.modules.documents.shippingDetails.entity.VO.PurchasePreDeliverVo;
@@ -21,10 +22,14 @@ import org.quartz.Job;
 import org.quartz.JobExecutionContext;
 import org.quartz.JobExecutionException;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Component;
 
 import java.util.ArrayList;
 import java.util.List;
 
+@Component
+@Slf4j
 public class PushShippingDetailsJob implements Job {
 
     @Autowired
@@ -34,7 +39,9 @@ public class PushShippingDetailsJob implements Job {
     private IDxpDataPlanService iDxpDataPlanService;
 
     // srm调用校验码
-    private static final String srmAccessToken = "cE9lQ5wT7rW9hA2y";
+    @Value("${srm.access-token}")
+    private String srmAccessToken;
+
 
     @Override
     public void execute(JobExecutionContext context) throws JobExecutionException {

+ 38 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/controller/SyPreAssembledPackingListController.java

@@ -34,6 +34,7 @@ import org.jeecg.common.exception.JeecgBootException;
 import org.jeecg.common.system.base.controller.JeecgController;
 import org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem;
 import org.jeecg.modules.documents.shippingDetails.entity.SyShippingDetailsItem;
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
 import org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo;
 import org.jeecg.modules.documents.shippingDetails.service.ISyShippingDetailsItemService;
 import org.jeecg.modules.openApi.entity.DxpDataPlan;
@@ -63,6 +64,7 @@ import org.jeecgframework.poi.excel.entity.enmus.ExcelType;
 import org.jeecgframework.poi.excel.view.JeecgTemplateExcelView;
 import org.springframework.beans.BeanUtils;
 import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.beans.factory.annotation.Value;
 import org.springframework.util.ResourceUtils;
 import org.springframework.web.bind.annotation.*;
 import org.springframework.web.servlet.ModelAndView;
@@ -94,7 +96,9 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
     @Autowired
     private IDxpDataPlanService iDxpDataPlanService;
 
-
+    // srm调用校验码
+    @Value("${srm.access-token}")
+    private String srmAccessToken;
 
     /**
      * 分页列表查询
@@ -2519,4 +2523,37 @@ public class SyPreAssembledPackingListController extends JeecgController<SyPreAs
         return Result.ok(packing);
     }
 
+    /**
+     * SRM推送添加
+     *
+     * @param syPreAssembledPackingList
+     * @return
+     */
+    @AutoLog(value = "预装箱单主表-SRM推送添加")
+    @ApiOperation(value="预装箱单主表-SRM推送添加", notes="预装箱单主表-SRM推送添加")
+    @PostMapping(value = "/srmAdd")
+    public RespUpdateVO srmAdd(@RequestBody SyPreAssembledPackingList syPreAssembledPackingList) {
+        RespUpdateVO respUpdateVO = new RespUpdateVO();
+        respUpdateVO.setSuccess(false);
+        if (!srmAccessToken.equals(syPreAssembledPackingList.getAccessToken())){
+            respUpdateVO.setMessage("认证失败,请联系管理员");
+            return respUpdateVO;
+        }
+        try{
+            if(oConvertUtils.isEmpty(syPreAssembledPackingList.getItemNumber())){
+                respUpdateVO.setMessage("请先填好信息再提交");
+                return respUpdateVO;
+            }
+            syPreAssembledPackingList=syPreAssembledPackingListService.saveMain2(syPreAssembledPackingList);
+            respUpdateVO.setMessage(syPreAssembledPackingList.getDocumentNo());
+            respUpdateVO.setSuccess(true);
+        }catch (Exception ex){
+            ex.printStackTrace();
+            log.error("添加失败:" + ex.getMessage());
+            respUpdateVO.setMessage(ex.getMessage());
+            return respUpdateVO;
+        }
+        return respUpdateVO;
+    }
+
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/spapl/entity/SyPreAssembledPackingList.java

@@ -337,4 +337,8 @@ public class SyPreAssembledPackingList implements Serializable {
 		}
 		return max;
 	}
+
+	// srm推送时传的token
+	@TableField(exist = false)
+	String accessToken;
 }

+ 38 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/controller/SyPackingListFabricController.java

@@ -31,8 +31,10 @@ import org.jeecg.modules.documents.orderData.entity.SyOrderData;
 import org.jeecg.modules.documents.orderData.entity.SyOrderDataItem;
 import org.jeecg.modules.documents.orderData.mapper.SyOrderDataItemMapper;
 import org.jeecg.modules.documents.orderData.mapper.SyOrderDataMapper;
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
 import org.jeecg.modules.documents.shippingDetails.entity.VO.SyShippingDetailsVo;
 import org.jeecg.modules.documents.shippingDetails.mapper.SyShippingDetailsItemMapper;
+import org.jeecg.modules.spapl.entity.SyPreAssembledPackingList;
 import org.jeecg.modules.splt.service.ISyPackingListTailoringService;
 import org.jeecg.modules.system.controller.CommonController;
 import org.jeecgframework.poi.excel.def.NormalExcelConstants;
@@ -81,6 +83,9 @@ public class SyPackingListFabricController implements Job {
 	private ISyPackingListFabricService syPackingListFabricService;
 	@Autowired
 	private ISyPackingListFabricItemService syPackingListFabricItemService;
+	 // srm调用校验码
+	 @Value("${srm.access-token}")
+	 private String srmAccessToken;
 	
 	/**
 	 *
@@ -1792,4 +1797,37 @@ public class SyPackingListFabricController implements Job {
 	 	 return ids;
 	 }
 
+	 /**
+	  * SRM推送添加
+	  *
+	  * @param syPackingListFabric
+	  * @return
+	  */
+	 @AutoLog(value = "装箱单-面辅料-SRM添加")
+	 @ApiOperation(value="装箱单-面辅料-SRM添加", notes="装箱单-面辅料-SRM添加")
+	 @PostMapping(value = "/srmAdd")
+	 public RespUpdateVO srmAdd(@RequestBody SyPackingListFabric syPackingListFabric) {
+		 RespUpdateVO respUpdateVO = new RespUpdateVO();
+		 respUpdateVO.setSuccess(false);
+		 if (!srmAccessToken.equals(syPackingListFabric.getAccessToken())){
+			 respUpdateVO.setMessage("认证失败,请联系管理员");
+			 return respUpdateVO;
+		 }
+
+		 if(oConvertUtils.isEmpty(syPackingListFabric)){
+			 respUpdateVO.setMessage("请填写信息再提交");
+			 return respUpdateVO;
+		 }
+		 List<String> ids=new ArrayList<>();
+		 for (SyPackingListFabricItem item : syPackingListFabric.getSyPackingListFabricItem()){
+			 ids.add(item.getSyOrderDataId());
+		 }
+		 Map<String,String> maps=orderNumber(ids);
+		 syPackingListFabricService.saveMain(syPackingListFabric,"");
+		 respUpdateVO.setSuccess(true);
+		 respUpdateVO.setMessage(syPackingListFabric.getDocumentNo());
+
+		 return respUpdateVO;
+	 }
+
  }

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/entity/SyPackingListFabric.java

@@ -280,4 +280,8 @@ public class SyPackingListFabric implements Serializable {
 		//createTime=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").parse(strs[0]) ;
 		//documentNo=strs[0];
 	}
+
+	// srm推送时传的token
+	@TableField(exist = false)
+	String accessToken;
 }

+ 4 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splfi/service/impl/SyPackingListFabricServiceImpl.java

@@ -173,7 +173,10 @@ public class SyPackingListFabricServiceImpl extends ServiceImpl<SyPackingListFab
 		syPackingListFabric.setStatus("0");
 		syPackingListFabric.setDocumentNo(dateNo);//单据号
 		syPackingListFabric.setDataSource("参照出运明细");//参照
-		String username=getUsername(token);
+		String username="admin";
+		if (oConvertUtils.isNotEmpty(token)){
+			username = getUsername(token);
+		}
 		syPackingListFabric.setPreparedBy(username);//将admin设置为制单人
 		syPackingListFabric.setCreateBy(username);//将admin设置为制单人
 		if(username!=null&&username.equals("周泽济")){

+ 26 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/controller/SyPackingListTailoringController.java

@@ -44,6 +44,7 @@ import org.jeecg.modules.documents.orderData.entity.SyOrderData;
 import org.jeecg.modules.documents.orderData.entity.SyOrderDataItem;
 import org.jeecg.modules.documents.orderData.mapper.SyOrderDataItemMapper;
 import org.jeecg.modules.documents.orderData.mapper.SyOrderDataMapper;
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
 import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem;
 import org.jeecg.modules.spapl.entity.SizeTable;
 import org.jeecg.modules.spapl.entity.SyPreAssembledPackingList;
@@ -111,6 +112,9 @@ public class SyPackingListTailoringController implements Job {
 	private RedisUtil redisUtil;//redisUtill
     @Autowired
  	private SysDictServiceImpl sysDictService;
+	 // srm调用校验码
+	 @Value("${srm.access-token}")
+	 private String srmAccessToken;
 
 	/**
 	 * 分页列表查询
@@ -2234,4 +2238,26 @@ public class SyPackingListTailoringController implements Job {
 	 	 return messages;
 	 }
 
+
+	 @AutoLog(value = "装箱单成衣-SRM添加")
+	 @ApiOperation(value="装箱单成衣-SRM添加", notes="装箱单成衣-SRM添加")
+	 @PostMapping(value = "/srmAdd")
+	 public RespUpdateVO srmAdd(@RequestBody SyPackingListTailoring syPackingListTailoring) {
+		 RespUpdateVO respUpdateVO = new RespUpdateVO();
+		 respUpdateVO.setSuccess(false);
+		 if (!srmAccessToken.equals(syPackingListTailoring.getAccessToken())){
+			 respUpdateVO.setMessage("认证失败,请联系管理员");
+			 return respUpdateVO;
+		 }
+
+		 if(oConvertUtils.isEmpty(syPackingListTailoring)){
+			 respUpdateVO.setMessage("对象为空");
+			 return respUpdateVO;
+		 }
+		 syPackingListTailoringService.saveMain2(syPackingListTailoring);
+		 respUpdateVO.setSuccess(true);
+		 respUpdateVO.setMessage(syPackingListTailoring.getDocumentNo());
+		 return respUpdateVO;
+	 }
+
 }

+ 4 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/entity/SyPackingListTailoring.java

@@ -327,4 +327,8 @@ public class SyPackingListTailoring implements Serializable {
 		syPreAssembledPackingListId=params[10];// 主表id
 	}
 
+	// srm推送时传的token
+	@TableField(exist = false)
+	String accessToken;
+
 }