zjh
2023-12-20 c84162ef2567ee02a0c94d6df336f78c974aca34
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;
    /**
@@ -66,6 +80,20 @@
                    return AjaxResult.error("身份证号码错误");
                }
            }
            //根据配置调取存储过程 将临时表数据存入预约表2023.12.12
            final String getInfoFromSqlData = sysConfigService.selectConfigByKey("getInfoFromSqlData");
            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);
                }
                DynamicDataSourceContextHolder.clearDataSourceType();
                 testMapper.getTjPatByCusId(cusIdcard);
            }
            //end====2023.12.12
            LambdaQueryWrapper<TjReservation> wq = new LambdaQueryWrapper<>();
            wq.eq(TjReservation::getIdCard, cusIdcard);
            wq.eq(TjReservation::getIsExpire, 2);
@@ -98,13 +126,14 @@
                    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 +151,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);
@@ -149,7 +180,7 @@
    /**
     * 查询客户信息列表
     */
    @PreAuthorize("@ss.hasPermi('hosp:customer:list')")
//    @PreAuthorize("@ss.hasPermi('hosp:customer:list')")
    @GetMapping("/list")
    @ApiOperation(value = "查看客户列表")
    public TableDataInfo list(TjCustomer tjCustomer) {