From fd05507e8595739c80f485d67fdeeed91708f746 Mon Sep 17 00:00:00 2001
From: zjh <zjh@888>
Date: 星期四, 21 十二月 2023 16:32:14 +0800
Subject: [PATCH] zjh 本地 2023/12/21 -1

---
 ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java |   46 +++++++++++++++++++++++++++++++++++++++++++---
 1 files changed, 43 insertions(+), 3 deletions(-)

diff --git a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
index 2ce487d..eb904c8 100644
--- a/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
+++ b/ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
@@ -4,10 +4,16 @@
 import javax.servlet.http.HttpServletResponse;
 import cn.hutool.core.date.DateUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.ltkj.common.enums.DataSourceType;
 import com.ltkj.common.utils.bean.BeanUtils;
 import com.ltkj.framework.config.MatchUtils;
+import com.ltkj.framework.datasource.DynamicDataSourceContextHolder;
 import com.ltkj.hosp.domain.TjReservation;
+import com.ltkj.hosp.mapper.TestMapper;
 import com.ltkj.hosp.service.ITjReservationService;
+import com.ltkj.hosp.service.TjvLtkjvtjpatService;
+import com.ltkj.hosp.sqlDomain.LtkjTjPat;
+import com.ltkj.system.service.ISysConfigService;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
 import io.swagger.annotations.ApiParam;
@@ -44,6 +50,14 @@
     @Resource
     private ITjReservationService tjReservationService;
 
+    @Resource
+    private ISysConfigService sysConfigService;
+
+    @Resource
+    private TestMapper testMapper;
+    @Resource
+    private TjvLtkjvtjpatService tjvLtkjvtjpatService;
+
 
 
     /**
@@ -51,7 +65,7 @@
      */
     @PostMapping(value = "/cusIdcard")
     @ApiOperation(value = "鏍规嵁韬唤璇佸彿鑾峰彇鐢ㄦ埛淇℃伅")
-    @Log(title = "瀹㈡埛韬唤淇℃伅", businessType = BusinessType.EXPORT)
+//    @Log(title = "瀹㈡埛韬唤淇℃伅", businessType = BusinessType.EXPORT)
     public AjaxResult getInfoByIdCard(@RequestParam @ApiParam(value = "瀹㈡埛韬唤璇佸彿") String cusIdcard) {
         if (!"".equals(cusIdcard) && cusIdcard != null) {
             //鍒ゆ柇韬唤璇佸彿鏍煎紡鏄惁姝g‘
@@ -66,6 +80,30 @@
                     return AjaxResult.error("韬唤璇佸彿鐮侀敊璇�");
                 }
             }
+            //鏍规嵁閰嶇疆璋冨彇瀛樺偍杩囩▼ 灏嗕复鏃惰〃鏁版嵁瀛樺叆棰勭害琛�2023.12.12
+            final String getInfoFromSqlData = sysConfigService.selectConfigByKey("getInfoFromSqlData");
+            if ("Y".equals(getInfoFromSqlData)){
+                //鏍规嵁韬唤璇佸ソ鏌ヤ俊鎭�
+                 LtkjTjPat tjPatByIdCard = testMapper.getTjPatByIdCard(cusIdcard);
+                if(null != tjPatByIdCard){
+                    String fcardNo = tjPatByIdCard.getFcardNo();
+                    if(null !=fcardNo){
+                        fcardNo=fcardNo.trim();
+                        tjPatByIdCard.setFcardNo(fcardNo);
+                    }
+                    LtkjTjPat ltkjTjPat = tjvLtkjvtjpatService.getLtkjTjPatByCusIdCard(cusIdcard);
+                    if(null==ltkjTjPat){
+                        tjvLtkjvtjpatService.save(tjPatByIdCard);
+                    }
+                }
+                DynamicDataSourceContextHolder.clearDataSourceType();
+                //鍐嶆牴鎹韩浠借瘉鍙峰啓customer琛�
+                TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdcard);
+                if(null == tjCustomer){
+                    testMapper.getTjPatByCusId(cusIdcard);
+                }
+            }
+            //end====2023.12.12
             LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>();
             wq.eq(TjReservation::getIdCard, cusIdcard);
             wq.eq(TjReservation::getIsExpire, 2);
@@ -98,13 +136,13 @@
                     tjCustomer1.setAgeUnit(tjReservation.getAgeUnit());
                     tjCustomer1.setCareer(tjReservation.getCareer());
 
-
                     tjCustomerService.updateById(tjCustomer1);
                     tjCustomer1.setTeamNo(tjReservation.getTeamNo());
                     tjCustomer1.setCompId(tjReservation.getCompanyId());
                     tjCustomer1.setReservationId(tjReservation.getId());
                     tjCustomer1.setDiscount(tjReservation.getDiscount());
                     tjCustomer1.setGroupingId(tjReservation.getGroupingId());
+
                     return success(tjCustomer1);
                 }
                 TjCustomer tjCustomer = new TjCustomer();
@@ -122,7 +160,9 @@
                 tjCustomer.setAge(tjReservation.getAge());
                 tjCustomer.setAgeUnit(tjReservation.getAgeUnit());
                 tjCustomer.setCareer(tjReservation.getCareer());
-
+                tjCustomer.setDwPhone(tjReservation.getDwPhone());
+                tjCustomer.setCardId(tjReservation.getCardId());
+                tjCustomer.setIndexCard(tjReservation.getIndexCard());
 
                 //鎴彇瀵嗙爜鑷姩鐢熸垚set杩涘幓
                 String substring = cusIdcard.substring(cusIdcard.length() - 6);

--
Gitblit v1.8.0