zjh
2023-12-21 d423307d3df56feb412d43f939a49195f3fff92e
ltkj-admin/src/main/java/com/ltkj/web/controller/system/TjCustomerController.java
@@ -65,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) {
            //判断身份证号格式是否正确
@@ -85,18 +85,32 @@
            if ("Y".equals(getInfoFromSqlData)){
                //根据身份证好查信息
                 LtkjTjPat tjPatByIdCard = testMapper.getTjPatByIdCard(cusIdcard);
                 //List<LtkjTjPat> list = testMapper.getTjPat();
//                DynamicDataSourceContextHolder.setDataSourceType(DataSourceType.MASTER.name());
//                for (LtkjTjPat ltkjTjPat : list) {
//                    final boolean save = tjvLtkjvtjpatService.save(ltkjTjPat);
//                }
                //不为空保存到临时表
                if(null != tjPatByIdCard){
                    tjvLtkjvtjpatService.save(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();
                //再根据身份证号写进预约表
                 testMapper.getTjPatByCusId(cusIdcard);
                //再根据身份证号写customer表
                TjCustomer tjCustomer = tjCustomerService.getTjCustomerByCusIdCard(cusIdcard);
                if(null == tjCustomer){
                    testMapper.getTjPatByCusId(cusIdcard);
                    LambdaQueryWrapper<TjCustomer> qw = new LambdaQueryWrapper<>();
                    qw.eq(TjCustomer::getCusIdcard, cusIdcard);
                    TjCustomer customer = tjCustomerService.getOne(qw);
                    customer.setReservationId(customer.getCardId());
                    return success(customer);
                }else {
                    tjCustomer.setReservationId(tjCustomer.getCardId());
                    return success(tjCustomer);
                }
            }
            //end====2023.12.12
            LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>();
@@ -137,7 +151,6 @@
                    tjCustomer1.setReservationId(tjReservation.getId());
                    tjCustomer1.setDiscount(tjReservation.getDiscount());
                    tjCustomer1.setGroupingId(tjReservation.getGroupingId());
                    return success(tjCustomer1);
                }