Browse Source

托书/预托书回写

fenghaifu 2 days ago
parent
commit
331d94af9b

+ 9 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/entity/SyLetterDepositItem.java

@@ -252,4 +252,13 @@ public class SyLetterDepositItem {
     private String isTc;
 	@TableField(exist = false)
 	private String packs;
+
+	/**srm推送状态*/
+	@Excel(name = "srm推送状态", width = 15)
+	@ApiModelProperty(value = "srm推送状态")
+	private String pushSrmState;
+	/**srm推送信息*/
+	@Excel(name = "srm推送信息", width = 15)
+	@ApiModelProperty(value = "srm推送信息")
+	private String pushSrmMessage;
 }

+ 18 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/entity/VO/ReqLetterDepositVO.java

@@ -0,0 +1,18 @@
+package org.jeecg.modules.documents.letterDeposit.entity.VO;
+
+import lombok.Data;
+
+import java.util.List;
+
+/**
+ * 推送预托书到SRM头实体
+ * @author fhf
+ * @date 2025/4/1
+ */
+@Data
+public class ReqLetterDepositVO {
+    // 推送token
+    String verifyToken;
+    // 行明细
+    List<ReqLetterDepositItemVO> itemList;
+}

+ 8 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/service/ISyLetterDepositItemService.java

@@ -2,6 +2,9 @@ package org.jeecg.modules.documents.letterDeposit.service;
 
 import org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem;
 import com.baomidou.mybatisplus.extension.service.IService;
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
+
+import java.util.List;
 
 /**
  * @Description: 预托书子表
@@ -11,4 +14,9 @@ import com.baomidou.mybatisplus.extension.service.IService;
  */
 public interface ISyLetterDepositItemService extends IService<SyLetterDepositItem> {
 
+    /**
+     * srm推送回写
+     * @param respUpdateVOList
+     */
+    public void updateSrmPushState(List<RespUpdateVO> respUpdateVOList);
 }

+ 22 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/letterDeposit/service/impl/SyLetterDepositItemServiceImpl.java

@@ -1,12 +1,18 @@
 package org.jeecg.modules.documents.letterDeposit.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem;
 import org.jeecg.modules.documents.letterDeposit.mapper.SyLetterDepositItemMapper;
 import org.jeecg.modules.documents.letterDeposit.service.ISyLetterDepositItemService;
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
 import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import javax.annotation.Resource;
+import java.util.Arrays;
+import java.util.List;
+
 /**
  * @Description: 预托书子表
  * @Author: jeecg-boot
@@ -15,5 +21,20 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  */
 @Service
 public class SyLetterDepositItemServiceImpl extends ServiceImpl<SyLetterDepositItemMapper, SyLetterDepositItem> implements ISyLetterDepositItemService {
-
+    @Resource
+    SyLetterDepositItemMapper syLetterDepositItemMapper;
+    /**
+     * srm推送回写
+     */
+    @Override
+    public void updateSrmPushState(List<RespUpdateVO> respUpdateVOList){
+        for (RespUpdateVO respUpdateVO: respUpdateVOList){
+            LambdaQueryWrapper<SyLetterDepositItem> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(SyLetterDepositItem::getId, respUpdateVO.getExtraInfo());
+            SyLetterDepositItem item = new SyLetterDepositItem();
+            item.setPushSrmState(respUpdateVO.isSuccess()?"1":"2");
+            item.setPushSrmMessage(respUpdateVO.getMessage());
+            syLetterDepositItemMapper.update(item, wrapper);
+        }
+    }
 }

+ 9 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/SyShippingOrderItem.java

@@ -404,6 +404,15 @@ public class SyShippingOrderItem {
 	@TableField(exist = false)
 	private String gender;
 
+	/**srm推送状态*/
+	@Excel(name = "srm推送状态", width = 15)
+	@ApiModelProperty(value = "srm推送状态")
+	private String pushSrmState;
+	/**srm推送信息*/
+	@Excel(name = "srm推送信息", width = 15)
+	@ApiModelProperty(value = "srm推送信息")
+	private String pushSrmMessage;
+
 	public List<Object> toString2(){
 		List<Object> strings=new ArrayList();
 		strings.add(smailPo);

+ 19 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/entity/VO/ReqShippingOrderVO.java

@@ -0,0 +1,19 @@
+package org.jeecg.modules.documents.syShippingOrder.entity.VO;
+
+import lombok.Data;
+import org.jeecg.modules.documents.letterDeposit.entity.VO.ReqLetterDepositItemVO;
+
+import java.util.List;
+
+/**
+ * 推送托书主表实体
+ * @author fhf
+ * @date 2025/4/1
+ */
+@Data
+public class ReqShippingOrderVO {
+    // 推送token
+    String verifyToken;
+    // 行明细
+    List<ReqShippingOrderItemVO> itemList;
+}

+ 8 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/service/ISyShippingOrderItemService.java

@@ -1,8 +1,11 @@
 package org.jeecg.modules.documents.syShippingOrder.service;
 
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
 import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem;
 import com.baomidou.mybatisplus.extension.service.IService;
 
+import java.util.List;
+
 /**
  * @Description: 托书子表实体类
  * @Author: jeecg-boot
@@ -10,5 +13,10 @@ import com.baomidou.mybatisplus.extension.service.IService;
  * @Version: V1.0
  */
 public interface ISyShippingOrderItemService extends IService<SyShippingOrderItem> {
+    /**
+     * srm推送回写
+     * @param respUpdateVOList
+     */
+    public void updateSrmPushState(List<RespUpdateVO> respUpdateVOList);
 
 }

+ 22 - 0
jeecg-boot-module-system/src/main/java/org/jeecg/modules/documents/syShippingOrder/service/impl/SyShippingOrderItemServiceImpl.java

@@ -1,5 +1,8 @@
 package org.jeecg.modules.documents.syShippingOrder.service.impl;
 
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem;
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
 import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem;
 import org.jeecg.modules.documents.syShippingOrder.mapper.SyShippingOrderItemMapper;
 import org.jeecg.modules.documents.syShippingOrder.service.ISyShippingOrderItemService;
@@ -7,6 +10,9 @@ import org.springframework.stereotype.Service;
 
 import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
 
+import javax.annotation.Resource;
+import java.util.List;
+
 /**
  * @Description: 托书子表实体类
  * @Author: jeecg-boot
@@ -15,5 +21,21 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
  */
 @Service
 public class SyShippingOrderItemServiceImpl extends ServiceImpl<SyShippingOrderItemMapper, SyShippingOrderItem> implements ISyShippingOrderItemService {
+    @Resource
+    private SyShippingOrderItemMapper syShippingOrderItemMapper;
 
+    /**
+     * srm推送回写
+     */
+    @Override
+    public void updateSrmPushState(List<RespUpdateVO> respUpdateVOList){
+        for (RespUpdateVO respUpdateVO: respUpdateVOList){
+            LambdaQueryWrapper<SyShippingOrderItem> wrapper = new LambdaQueryWrapper<>();
+            wrapper.eq(SyShippingOrderItem::getId, respUpdateVO.getExtraInfo());
+            SyShippingOrderItem item = new SyShippingOrderItem();
+            item.setPushSrmState(respUpdateVO.isSuccess()?"1":"2");
+            item.setPushSrmMessage(respUpdateVO.getMessage());
+            syShippingOrderItemMapper.update(item, wrapper);
+        }
+    }
 }

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

@@ -9,11 +9,24 @@ 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.letterDeposit.entity.SyLetterDeposit;
+import org.jeecg.modules.documents.letterDeposit.entity.SyLetterDepositItem;
+import org.jeecg.modules.documents.letterDeposit.entity.VO.ReqLetterDepositItemVO;
+import org.jeecg.modules.documents.letterDeposit.entity.VO.ReqLetterDepositVO;
+import org.jeecg.modules.documents.letterDeposit.service.ISyLetterDepositItemService;
+import org.jeecg.modules.documents.letterDeposit.service.ISyLetterDepositService;
 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;
 import org.jeecg.modules.documents.shippingDetails.entity.VO.ReqPurchasePreDeliverVo;
+import org.jeecg.modules.documents.shippingDetails.entity.VO.RespUpdateVO;
 import org.jeecg.modules.documents.shippingDetails.service.ISyShippingDetailsService;
+import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrder;
+import org.jeecg.modules.documents.syShippingOrder.entity.SyShippingOrderItem;
+import org.jeecg.modules.documents.syShippingOrder.entity.VO.ReqShippingOrderItemVO;
+import org.jeecg.modules.documents.syShippingOrder.entity.VO.ReqShippingOrderVO;
+import org.jeecg.modules.documents.syShippingOrder.service.ISyShippingOrderItemService;
+import org.jeecg.modules.documents.syShippingOrder.service.ISyShippingOrderService;
 import org.jeecg.modules.openApi.entity.DxpDataPlan;
 import org.jeecg.modules.openApi.service.IDxpDataPlanService;
 import org.jeecg.modules.system.util.HttpHelper;
@@ -31,6 +44,9 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.stream.Collectors;
 
+/**
+ * 推送SRM出运明细,预托书,托书
+ */
 @Component
 @Slf4j
 public class PushShippingDetailsJob implements Job {
@@ -41,6 +57,15 @@ public class PushShippingDetailsJob implements Job {
     @Autowired
     private IDxpDataPlanService iDxpDataPlanService;
 
+    @Autowired
+    private ISyLetterDepositItemService syLetterDepositItemService;
+    @Autowired
+    private ISyLetterDepositService syLetterDepositService;
+    @Autowired
+    private ISyShippingOrderItemService syShippingOrderItemService;
+    @Autowired
+    private ISyShippingOrderService syShippingOrderService;
+
     // srm调用校验码
     @Value("${srm.access-token}")
     private String srmAccessToken;
@@ -54,38 +79,111 @@ public class PushShippingDetailsJob implements Job {
         }
         isRunning = true;
         try {
-            //查询IP及账套信息、时间戳
+            //推送出运明细到srm预发货单
             QueryWrapper<DxpDataPlan> dxpDataPlanQueryWrapper = new QueryWrapper<>();
             dxpDataPlanQueryWrapper.eq("code", "senYu_Srm_Yfh");
-            List<DxpDataPlan> dxpDataPlans = iDxpDataPlanService.list(dxpDataPlanQueryWrapper);
+            DxpDataPlan dxpDataPlan = iDxpDataPlanService.getOne(dxpDataPlanQueryWrapper);
+            if (dxpDataPlan == null){
+                log.warn("推送出运明细到SRM dxp_data_plan未定义" );
+            }else {
+                List<String> shippingDetailIdList = syShippingDetailsService.getPushSrmIds();
+                shippingDetailIdList = shippingDetailIdList.stream().distinct().collect(Collectors.toList());
+                for (String id : shippingDetailIdList) {
+                    List<PurchasePreDeliverVo> purchasePreDeliverVoList = syShippingDetailsService.getPurchasePreDeliverVoList(id);
+                    if (purchasePreDeliverVoList.size() > 0) {
+                        ReqPurchasePreDeliverVo reqPurchasePreDeliverVo = new ReqPurchasePreDeliverVo();
+                        reqPurchasePreDeliverVo.setVerifyToken(srmAccessToken);
+                        reqPurchasePreDeliverVo.setBillList(purchasePreDeliverVoList);
+                        String reqString = JSONObject.toJSONString(reqPurchasePreDeliverVo);
+                        log.info("查看请求信息\t" + reqString);
+                        //获取url
+                        String url = dxpDataPlan.getItemIp();
+                        //处理返回信息
+                        String respStr = HttpHelper.httpJsonPost(url, reqString, null);
+                        log.info("查看返回信息\t" + respStr);
+                        JSONObject informationJson = JSONObject.parseObject(respStr);
+                        JSONArray jsonArray = informationJson.getJSONArray("result");
+                        log.info("jsonArray\t" + jsonArray);
+                        for (int i = 0; i < jsonArray.size(); i++) {
+                            JSONObject jsonObject = jsonArray.getJSONObject(i);
+                            String syShippingId = jsonObject.getString("extraInfo");
+                            boolean success = jsonObject.getBoolean("success");
+                            String message = oConvertUtils.getString(jsonObject.getString("message"));
+                            String status = success ? "1" : "2";
+                            syShippingDetailsService.setPurshInfo(
+                                    Arrays.asList(syShippingId.split(",")),
+                                    status, message);
+                        }
+                    }
 
-            List<String> shippingDetailIdList = syShippingDetailsService.getPushSrmIds();
-            shippingDetailIdList = shippingDetailIdList.stream().distinct().collect(Collectors.toList());
-            for (String id : shippingDetailIdList){
-                List<PurchasePreDeliverVo> purchasePreDeliverVoList=syShippingDetailsService.getPurchasePreDeliverVoList(id);
-                if (purchasePreDeliverVoList.size()>0){
-                    ReqPurchasePreDeliverVo reqPurchasePreDeliverVo = new ReqPurchasePreDeliverVo();
-                    reqPurchasePreDeliverVo.setVerifyToken(srmAccessToken);
-                    reqPurchasePreDeliverVo.setBillList(purchasePreDeliverVoList);
-                    String reqString = JSONObject.toJSONString(reqPurchasePreDeliverVo);
-                    log.info("查看请求信息\t"+reqString);
-                    //获取url
-                    String url = dxpDataPlans.get(0).getItemIp();
-                    //处理返回信息
-                    String respStr = HttpHelper.httpJsonPost(url, reqString, null);
-                    log.info("查看返回信息\t"+respStr);
-                    JSONObject informationJson = JSONObject.parseObject(respStr);
-                    JSONArray jsonArray=informationJson.getJSONArray("result");
-                    log.info("jsonArray\t"+jsonArray);
-                    for (int i=0;i<jsonArray.size();i++){
-                        JSONObject jsonObject=jsonArray.getJSONObject(i);
-                        String syShippingId=jsonObject.getString("extraInfo");
-                        boolean success=jsonObject.getBoolean("success");
-                        String message= oConvertUtils.getString(jsonObject.getString("message"));
-                        String status = success?"1":"2";
-                        syShippingDetailsService.setPurshInfo(
-                                Arrays.asList(syShippingId.split(",")),
-                                status, message);
+                }
+            }
+            // 推送预托书到srm发货单字段
+            dxpDataPlanQueryWrapper = new QueryWrapper<>();
+            dxpDataPlanQueryWrapper.eq("code", "senYu_Srm_Yts");
+            dxpDataPlan = iDxpDataPlanService.getOne(dxpDataPlanQueryWrapper);
+            if (dxpDataPlan == null){
+                log.warn("推送预托书 dxp_data_plan未定义" );
+            }else {
+                LambdaQueryWrapper<SyLetterDepositItem> queryWrapper = new LambdaQueryWrapper<>();
+                queryWrapper.eq(SyLetterDepositItem::getDelFlag, "0");
+                queryWrapper.eq(SyLetterDepositItem::getPushSrmState, "0");
+                List<SyLetterDepositItem> letterDepositItemList = syLetterDepositItemService.list(queryWrapper);
+                if (letterDepositItemList.size()>0){
+                    LambdaQueryWrapper<SyLetterDeposit> mQueryWrapper = new LambdaQueryWrapper<>();
+                    mQueryWrapper.in(SyLetterDeposit::getId, letterDepositItemList.stream().map(SyLetterDepositItem::getSyLetterDepositId).distinct().collect(Collectors.toList()));
+                    List<SyLetterDeposit> letterDepositList = syLetterDepositService.list(mQueryWrapper);
+                    List<ReqLetterDepositItemVO> reqVoList = new ArrayList<>();
+                    for (SyLetterDepositItem item : letterDepositItemList){
+                        SyLetterDeposit findDetail = letterDepositList.stream().filter(x -> x.getId().equals(item.getSyLetterDepositId())).findFirst().orElse(null);
+                        if (findDetail != null){
+                            ReqLetterDepositItemVO reqVo = new ReqLetterDepositItemVO();
+                            reqVo.fromLetterDeposit(item, findDetail);
+                            reqVoList.add(reqVo);
+                        }
+                    }
+                    if (reqVoList.size()>0){
+                        ReqLetterDepositVO reqVo = new ReqLetterDepositVO();
+                        reqVo.setVerifyToken(srmAccessToken);
+                        reqVo.setItemList(reqVoList);
+                        List<RespUpdateVO> respUpdateVOList = JSONArray.parseArray(HttpHelper.httpJsonPost(dxpDataPlan.getItemIp(), JSONObject.toJSONString(reqVo), null),
+                                RespUpdateVO.class);
+                        syLetterDepositItemService.updateSrmPushState(respUpdateVOList);
+                    }
+                }
+
+            }
+            // 推送托书到srm发货单字段
+            dxpDataPlanQueryWrapper = new QueryWrapper<>();
+            dxpDataPlanQueryWrapper.eq("code", "senYu_Srm_Ts");
+            dxpDataPlan = iDxpDataPlanService.getOne(dxpDataPlanQueryWrapper);
+            if (dxpDataPlan == null){
+                log.warn("推送托书 dxp_data_plan未定义" );
+            }else {
+                LambdaQueryWrapper<SyShippingOrderItem> queryWrapper = new LambdaQueryWrapper<>();
+                queryWrapper.eq(SyShippingOrderItem::getDelFlag, "0");
+                queryWrapper.eq(SyShippingOrderItem::getPushSrmState, "0");
+                List<SyShippingOrderItem> itemList = syShippingOrderItemService.list(queryWrapper);
+                if (itemList.size()>0){
+                    LambdaQueryWrapper<SyShippingOrder> mQueryWrapper = new LambdaQueryWrapper<>();
+                    mQueryWrapper.in(SyShippingOrder::getId, itemList.stream().map(SyShippingOrderItem::getSyShippingOrderItemId).distinct().collect(Collectors.toList()));
+                    List<SyShippingOrder> orderList = syShippingOrderService.list(mQueryWrapper);
+                    List<ReqShippingOrderItemVO> reqVoList = new ArrayList<>();
+                    for (SyShippingOrderItem item : itemList){
+                        SyShippingOrder findOrder = orderList.stream().filter(x -> x.getId().equals(item.getSyShippingOrderItemId())).findFirst().orElse(null);
+                        if (findOrder != null){
+                            ReqShippingOrderItemVO reqVo = new ReqShippingOrderItemVO();
+                            reqVo.fromShippingOrder(item, findOrder);
+                            reqVoList.add(reqVo);
+                        }
+                    }
+                    if (reqVoList.size()>0){
+                        ReqShippingOrderVO reqVo = new ReqShippingOrderVO();
+                        reqVo.setVerifyToken(srmAccessToken);
+                        reqVo.setItemList(reqVoList);
+                        List<RespUpdateVO> respUpdateVOList = JSONArray.parseArray(HttpHelper.httpJsonPost(dxpDataPlan.getItemIp(), JSONObject.toJSONString(reqVo), null),
+                                RespUpdateVO.class);
+                        syShippingOrderItemService.updateSrmPushState(respUpdateVOList);
                     }
                 }
 

+ 1 - 1
jeecg-boot-module-system/src/main/java/org/jeecg/modules/splt/mapper/xml/syPackingListTailoringItemMapper.xml

@@ -406,7 +406,7 @@
 		d.is_tc,
 		c.supplier,
 		b.customer_name,
-		b.customer_abbreviation,
+		d.customer_abbreviation,
 		b.customer_code
 		FROM
 		sy_pre_assembled_packing_list_item a