From 3824d0fdba2c522d45e58a7b437e9bb0ed143162 Mon Sep 17 00:00:00 2001
From: fhx <308050795@qq.com>
Date: 星期一, 02 九月 2024 10:17:31 +0800
Subject: [PATCH] 1.新增结账更新治疗单关联用户项目逻辑

---
 phi_platform_user/src/main/java/com/hx/phip/util/api/OrderPayMoneyUtil.java |   25 +++++++++++++++++++++++++
 1 files changed, 25 insertions(+), 0 deletions(-)

diff --git a/phi_platform_user/src/main/java/com/hx/phip/util/api/OrderPayMoneyUtil.java b/phi_platform_user/src/main/java/com/hx/phip/util/api/OrderPayMoneyUtil.java
index 8d8d5db..efc6be1 100644
--- a/phi_platform_user/src/main/java/com/hx/phip/util/api/OrderPayMoneyUtil.java
+++ b/phi_platform_user/src/main/java/com/hx/phip/util/api/OrderPayMoneyUtil.java
@@ -2000,6 +2000,8 @@
             }
             setUserProjectItem(ordersTotal, userProject, userProjectItem, date, vo,orderItemSon,1);
             commonService.insert(UserProjectItemMapper.class,userProjectItem);//鏂板鐢ㄦ埛椤圭洰瀛愰」璁板綍
+            //缁撹处鏇存柊娌荤枟鍗曢」鐩叧鑱旂敤鎴烽」鐩�
+            updateTreatProjectAssocUserProjectItem(commonService, userProjectItem, ordersTotal.getId(), vo.getId(), orderItemSon == null ? null : orderItemSon.getId());
         }else{
             map.put("commonId",vo.getCommonId());
             UserProject userProject=commonService.selectOne(UserProjectMapper.class,sqlSentence);
@@ -2030,6 +2032,9 @@
             }
             setUserProjectItem(ordersTotal, userProject, userProjectItem, date, vo,orderItemSon,0);
             commonService.insert(UserProjectItemMapper.class,userProjectItem);//鏂板鐢ㄦ埛椤圭洰瀛愰」璁板綍
+            //缁撹处鏇存柊娌荤枟鍗曢」鐩叧鑱旂敤鎴烽」鐩�
+            updateTreatProjectAssocUserProjectItem(commonService, userProjectItem, ordersTotal.getId(), vo.getId(), orderItemSon == null ? null : orderItemSon.getId());
+
         }
     }
 
@@ -2388,4 +2393,24 @@
         }
         return stringBuffer.toString();
     }
+
+    /** 缁撹处鏇存柊娌荤枟鍗曢」鐩叧鑱旂敤鎴烽」鐩� */
+    private static void updateTreatProjectAssocUserProjectItem(CommonService commonService, UserProjectItem userProjectItem, String orderId, String orderItemId, String orderItemSonId){
+        if(userProjectItem == null || StringUtils.isEmpty(userProjectItem.getId())){
+            return;
+        }
+        SqlSentence sqlSentence = new SqlSentence();
+        Map<String, Object> values = new HashMap<>();
+        sqlSentence.setM(values);
+        values.put("userProjectItemId", userProjectItem.getId());
+        values.put("orderId", orderId);
+        values.put("orderItemId", orderItemId);
+        if(StringUtils.isEmpty(orderItemSonId)){
+            sqlSentence.setSqlSentence(" userProjectItemId = #{m.userProjectItemId} where orderId = #{m.orderId} and orderItemId = #{m.orderItemId} and userProjectItemId is null ");
+        }else{
+            values.put("orderItemSonId", orderItemSonId);
+            sqlSentence.setSqlSentence(" userProjectItemId = #{m.userProjectItemId} where orderId = #{m.orderId} and orderItemId = #{m.orderItemId} and orderItemSonId = #{m.orderItemSonId} and userProjectItemId is null ");
+        }
+        commonService.updateWhere(TreatProjectMapper.class, sqlSentence);
+    }
 }

--
Gitblit v1.8.0