zjh
2025-04-22 d8f9c8b8cc744ddaefe7144beafc68c8fb8906c3
ltkj-admin/src/main/java/com/ltkj/web/controller/system/SysLoginController.java
@@ -16,8 +16,11 @@
import com.ltkj.framework.config.UserHoder;
import com.ltkj.hosp.domain.DictHosp;
import com.ltkj.hosp.domain.TjCustomer;
import com.ltkj.hosp.domain.TjOrder;
import com.ltkj.hosp.mapper.TjCustomerMapper;
import com.ltkj.hosp.service.IDictHospService;
import com.ltkj.hosp.service.ITjCustomerService;
import com.ltkj.hosp.service.ITjOrderService;
import com.ltkj.system.domain.SysPost;
import com.ltkj.system.domain.SysRoleMenu;
import com.ltkj.system.domain.SysUserPost;
@@ -38,6 +41,7 @@
import com.ltkj.framework.web.service.SysPermissionService;
import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import static com.ltkj.common.core.domain.AjaxResult.success;
@@ -74,6 +78,10 @@
    private boolean secretKeyLogin;
    @Autowired
    private RedisCache redisCache;
    @Autowired
    private ITjOrderService tjOrderService;
    @Autowired
    private TjCustomerMapper tjCustomerMapper;
    /**
     * 登录方法
@@ -84,15 +92,20 @@
    @PostMapping("/login")
    @ApiOperation("登录接口")
    @RepeatSubmit
    public AjaxResult login(@RequestBody @ApiParam(value = "登录对象") LoginBody loginBody) {
    public AjaxResult login(@RequestBody @ApiParam(value = "登录对象") LoginBody loginBody, HttpServletRequest request) {
        String hospId = request.getHeader("hospId");
        AjaxResult ajax = success();
        // 生成令牌
        String token;
        if (loginBody.getMobile()) {
            token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getType(), loginBody.getCode(), loginBody.getUuid());
            token = loginService.login(loginBody.getUsername(), loginBody.getPassword(), loginBody.getType(), loginBody.getCode(), loginBody.getUuid(),hospId);
        } else {
            token = loginService.Cuslogin(loginBody.getUsername(), loginBody.getPassword(), loginBody.getType(), loginBody.getCode(), loginBody.getUuid());
            LambdaQueryWrapper<TjCustomer> wq = new LambdaQueryWrapper<>();
            wq.eq(TjCustomer::getCusPhone, loginBody.getUsername());
            TjCustomer tjCustomer = customerService.getOne(wq);
            List<Map<String ,Object>> customer = tjCustomerMapper.getCusInfoListByCardAndName(tjCustomer.getCusIdcard(),tjCustomer.getCusName());
            ajax.put("orderList",customer);
        }
        if (null == token) {
            return success("该账号正在使用中");