Compare commits

..

No commits in common. "730d2065a5e9edf10afff22712ec08f1d88f36ba" and "374a82a78d12fdd2b0c79fb2b4c372f30d032916" have entirely different histories.

15 changed files with 55 additions and 259 deletions

View File

@ -46,7 +46,6 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<include refid="selectPartnerCustomerInfoVo"/> <include refid="selectPartnerCustomerInfoVo"/>
where id = #{id} where id = #{id}
</select> </select>
<select id="pagePartnerCustomerInfoList" <select id="pagePartnerCustomerInfoList"
resultType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo"> resultType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
select pci.*, select pci.*,

View File

@ -1,13 +1,10 @@
package cn.iocoder.yudao.module.jx.controller.admin; package cn.iocoder.yudao.module.jx.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.jx.core.controller.BaseController; import cn.iocoder.yudao.module.jx.core.controller.BaseController;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolInfo; import cn.iocoder.yudao.module.jx.domain.DriveSchoolInfo;
import cn.iocoder.yudao.module.jx.payment.vo.PayVo; import cn.iocoder.yudao.module.jx.payment.vo.PayVo;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolInfoService; import cn.iocoder.yudao.module.jx.service.IDriveSchoolInfoService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
@ -27,8 +24,6 @@ public class DriveSchoolInfoController extends BaseController
{ {
@Resource @Resource
private IDriveSchoolInfoService driveSchoolInfoService; private IDriveSchoolInfoService driveSchoolInfoService;
@Resource
private AdminUserApi userApi;
/** /**
* 查询自己的订单 * 查询自己的订单
@ -86,10 +81,7 @@ public class DriveSchoolInfoController extends BaseController
@GetMapping("/getSchoolInfoByDeptId") @GetMapping("/getSchoolInfoByDeptId")
public CommonResult getSchoolInfoByDeptId() public CommonResult getSchoolInfoByDeptId()
{ {
Long userId = SecurityFrameworkUtils.getLoginUserId(); return CommonResult.success(driveSchoolInfoService.getSchoolInfoByDeptId());
AdminUserRespDTO sysUser = userApi.getUser(userId);
Long deptId = sysUser.getDeptId();
return success(driveSchoolInfoService.getSchoolInfoByDeptId(deptId));
} }
/** /**

View File

@ -2,16 +2,12 @@ package cn.iocoder.yudao.module.jx.controller.admin;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.module.jx.core.controller.BaseController; import cn.iocoder.yudao.module.jx.core.controller.BaseController;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolSeparate;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper; import cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolSwiperService; import cn.iocoder.yudao.module.jx.service.IDriveSchoolSwiperService;
import cn.iocoder.yudao.module.jx.utils.ExcelUtil; import cn.iocoder.yudao.module.jx.utils.ExcelUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.security.PermitAll;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.util.List; import java.util.List;
@ -39,21 +35,13 @@ public class DriveSchoolSwiperController extends BaseController
return CommonResult.success(list); return CommonResult.success(list);
} }
/**
* 分页查询驾校-轮播图列表
*/
@GetMapping("/pclist") @GetMapping("/pclist")
@PermitAll public CommonResult pclist(DriveSchoolSwiper driveSchoolSwiper)
public CommonResult pclist(DriveSchoolSwiper driveSchoolSwiper) { {
Page<DriveSchoolSwiper> page = new Page<>(driveSchoolSwiper.getPageNum(), driveSchoolSwiper.getPageSize()); List<DriveSchoolSwiper> list = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper);
IPage<DriveSchoolSwiper> driveSchoolSeparateIPage = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper, page); return CommonResult.success(list);
// IPage<DriveSchoolSwiper> page = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper, current, size);
return CommonResult.success(driveSchoolSeparateIPage);
} }
/** /**
* 导出驾校-轮播图列表 * 导出驾校-轮播图列表
*/ */

View File

@ -8,7 +8,6 @@ import cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolInfo; import cn.iocoder.yudao.module.jx.domain.DriveSchoolInfo;
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolCoachMapper; import cn.iocoder.yudao.module.jx.mapper.DriveSchoolCoachMapper;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolInfoService; import cn.iocoder.yudao.module.jx.service.IDriveSchoolInfoService;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO; import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.permission.PermissionService; import cn.iocoder.yudao.module.system.service.permission.PermissionService;
@ -45,33 +44,25 @@ public class JxAuthController {
private DriveSchoolCoachMapper driveSchoolCoachMapper; private DriveSchoolCoachMapper driveSchoolCoachMapper;
@Resource @Resource
private IDriveSchoolInfoService driveSchoolInfoService; private IDriveSchoolInfoService driveSchoolInfoService;
@Resource
private AdminUserApi userApi;
/** /**
* 获取Jx用户信息 * 获取
* *
* @return 用户信息 * @return 用户信息
*/ */
@GetMapping("/getJxInfo") @GetMapping("/getJxInfo")
public CommonResult getJxInfo() public CommonResult getJxInfo()
{ {
// 获取当前用户信息
// Long userId = SecurityFrameworkUtils.getLoginUserId();
// AdminUserRespDTO sysUser = userApi.getUser(userId);
// Long deptId = sysUser.getDeptId();
LoginUser user = SecurityFrameworkUtils.getLoginUser(); LoginUser user = SecurityFrameworkUtils.getLoginUser();
// 获取当前登录用户角色编码 // 获取当前登录用户角色编码
Set<String> roles = permissionService.getRolePermission(user.getId()); Set<String> roles = permissionService.getRolePermission(user.getId());
//获取驾校的 //获取驾校的
Long userId = user.getId(); Long userId = user.getId();
AdminUserDO sysUser = userService.getUser(userId);
Long deptId = sysUser.getDeptId();
AdminUserDO sysUser = userService.getUser(userId);
String phonenumber = sysUser.getMobile(); String phonenumber = sysUser.getMobile();
//根据手机号查询驾校教练 //根据手机号查询驾校教练
DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber); DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber);
@ -79,7 +70,7 @@ public class JxAuthController {
if (ObjectUtils.isNotEmpty(driveSchoolCoach)){ if (ObjectUtils.isNotEmpty(driveSchoolCoach)){
sysUser.setAvatar(driveSchoolCoach.getImage()); sysUser.setAvatar(driveSchoolCoach.getImage());
} }
DriveSchoolInfo driveSchoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId(deptId); DriveSchoolInfo driveSchoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId();
Map<String,Object> result = new HashMap<>(); Map<String,Object> result = new HashMap<>();
result.put("user", sysUser); result.put("user", sysUser);

View File

@ -67,19 +67,8 @@ public interface DriveSchoolInfoMapper
*/ */
public int deleteDriveSchoolInfoByIds(Long[] ids); public int deleteDriveSchoolInfoByIds(Long[] ids);
/**
* 根据部门ID查询驾校信息
* @param deptId 部门ID
* @return 驾校信息
*/
DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId); DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId);
/**
* 根据驾校ID查询驾校信息
* @param jxId 驾校ID
* @return 驾校信息
*/
DriveSchoolInfoVO findInfoByJxId(Long jxId); DriveSchoolInfoVO findInfoByJxId(Long jxId);
} }

View File

@ -1,14 +1,8 @@
package cn.iocoder.yudao.module.jx.mapper; package cn.iocoder.yudao.module.jx.mapper;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolSeparate;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper; import cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolTeachingJournal;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import org.springframework.data.repository.query.Param;
import java.util.List; import java.util.List;
@ -35,8 +29,7 @@ public interface DriveSchoolSwiperMapper
* @param driveSchoolSwiper 驾校-轮播图 * @param driveSchoolSwiper 驾校-轮播图
* @return 驾校-轮播图集合 * @return 驾校-轮播图集合
*/ */
List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper); public List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper);
/** /**
* 新增驾校-轮播图 * 新增驾校-轮播图
@ -69,12 +62,4 @@ public interface DriveSchoolSwiperMapper
* @return 结果 * @return 结果
*/ */
public int deleteDriveSchoolSwiperByIds(Long[] ids); public int deleteDriveSchoolSwiperByIds(Long[] ids);
/**
* 分页查询驾校-轮播图
*
* @param
* @return 结果
*/
IPage<DriveSchoolSwiper> selectDriveSchoolSwiperPage(@Param("entity")DriveSchoolSwiper entity , Page<DriveSchoolSwiper> page);
} }

View File

@ -1,7 +1,6 @@
package cn.iocoder.yudao.module.jx.payment.api; package cn.iocoder.yudao.module.jx.payment.api;
import cn.iocoder.yudao.framework.common.pojo.CommonResult; import cn.iocoder.yudao.framework.common.pojo.CommonResult;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils; import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.module.jx.core.controller.BaseController; import cn.iocoder.yudao.module.jx.core.controller.BaseController;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach; import cn.iocoder.yudao.module.jx.domain.DriveSchoolCoach;
@ -13,19 +12,14 @@ import cn.iocoder.yudao.module.jx.service.IDriveSchoolInfoService;
import cn.iocoder.yudao.module.jx.vo.DriveSchoolInfoVO; import cn.iocoder.yudao.module.jx.vo.DriveSchoolInfoVO;
import cn.iocoder.yudao.module.system.api.user.AdminUserApi; import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO; import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
import cn.iocoder.yudao.module.system.dal.dataobject.user.AdminUserDO;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.user.AdminUserService;
import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.sun.javaws.IconUtil;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.List; import java.util.List;
import java.util.Set;
/** /**
* 订单Controller * 订单Controller
@ -44,10 +38,7 @@ public class DriveSchoolPayController extends BaseController
@Resource @Resource
private AdminUserApi userApi; private AdminUserApi userApi;
@Resource
private PermissionService permissionService;
@Resource
private AdminUserService userService;
@GetMapping("updatePayById") @GetMapping("updatePayById")
public void updatePayById(Integer id, String name, Integer jlId) { public void updatePayById(Integer id, String name, Integer jlId) {
@ -59,41 +50,28 @@ public class DriveSchoolPayController extends BaseController
* 查询订单列表 * 查询订单列表
*/ */
@GetMapping("/list") @GetMapping("/list")
public CommonResult<IPage<?>> list(DriveSchoolPay driveSchoolPay) { public CommonResult<IPage<?>> list(DriveSchoolPay driveSchoolPay)
{
// 获取当前用户信息 int number = 0;
LoginUser user = SecurityFrameworkUtils.getLoginUser(); int numbers = 0;
int allNumber = 0;
DriveSchoolInfoVO schoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId();
//获取驾校ID
Long userId = user.getId();
AdminUserDO sysUser = userService.getUser(userId);
Long deptId = sysUser.getDeptId();
// 记录部门ID
System.out.println("User ID: " + userId + " | Dept ID: " + deptId);
// 获取驾校信息
//schoolInfo为null
DriveSchoolInfoVO schoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId(deptId);
// 设置驾校ID
if (schoolInfo != null) { if (schoolInfo != null) {
System.out.println("啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊");
driveSchoolPay.setJxId(schoolInfo.getId()); driveSchoolPay.setJxId(schoolInfo.getId());
} }
// 创建分页对象
Page<DriveSchoolPay> page = new Page<>(driveSchoolPay.getPageNum(), driveSchoolPay.getPageSize()); Page<DriveSchoolPay> page = new Page<>(driveSchoolPay.getPageNum(), driveSchoolPay.getPageSize());
IPage<DriveSchoolPay> driveSchoolPayIPage = driveSchoolPayService.selectDriveSchoolPayList(driveSchoolPay, page); IPage<DriveSchoolPay> driveSchoolPayIPage = driveSchoolPayService.selectDriveSchoolPayList(driveSchoolPay, page);
// 处理记录格式化排序
List<DriveSchoolPay> list = driveSchoolPayIPage.getRecords(); List<DriveSchoolPay> list = driveSchoolPayIPage.getRecords();
int allNumber = (driveSchoolPay.getPageNum() - 1) * driveSchoolPay.getPageSize(); for (DriveSchoolPay row :list) {
for (int i = 0; i < list.size(); i++) { numbers += 1;
String formattedNumber = String.format("%05d", allNumber + i + 1); allNumber = (driveSchoolPay.getPageNum()-1) * driveSchoolPay.getPageSize();
list.get(i).setSorNumber(formattedNumber); number = allNumber + numbers;
String formattedNumber = String.format("%05d", number);
row.setSorNumber(formattedNumber);
} }
return CommonResult.success(driveSchoolPayIPage); return CommonResult.success(driveSchoolPayIPage);
} }

View File

@ -66,7 +66,7 @@ public interface IDriveSchoolInfoService
*/ */
public int deleteDriveSchoolInfoById(Long id); public int deleteDriveSchoolInfoById(Long id);
DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId); DriveSchoolInfoVO getSchoolInfoByDeptId();
List<PayVo> findSelfSchoolData(); List<PayVo> findSelfSchoolData();

View File

@ -1,9 +1,6 @@
package cn.iocoder.yudao.module.jx.service; package cn.iocoder.yudao.module.jx.service;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolSeparate;
import cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper; import cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List; import java.util.List;
@ -30,6 +27,7 @@ public interface IDriveSchoolSwiperService
* @return 驾校-轮播图集合 * @return 驾校-轮播图集合
*/ */
public List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper); public List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper);
public List<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper);
/** /**
* 新增驾校-轮播图 * 新增驾校-轮播图
@ -62,12 +60,4 @@ public interface IDriveSchoolSwiperService
* @return 结果 * @return 结果
*/ */
public int deleteDriveSchoolSwiperById(Long id); public int deleteDriveSchoolSwiperById(Long id);
/**
* 分页查询驾校-轮播图
*
* @param driveSchoolSwiper 驾校-轮播图
* @return 结果
*/
public IPage<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper, Page<DriveSchoolSwiper> page);
} }

View File

@ -23,13 +23,11 @@ import com.thoughtworks.xstream.core.SecurityUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.repository.query.Param;
import org.springframework.security.crypto.password.PasswordEncoder; import org.springframework.security.crypto.password.PasswordEncoder;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional; import org.springframework.transaction.annotation.Transactional;
import javax.annotation.Resource; import javax.annotation.Resource;
import java.util.Collections;
import java.util.List; import java.util.List;
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_STAFF; import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_STAFF;
@ -117,7 +115,6 @@ public class DriveSchoolCoachServiceImpl implements IDriveSchoolCoachService
// } // }
@Resource @Resource
private AdminUserService adminUserService; private AdminUserService adminUserService;
@ -249,16 +246,13 @@ public class DriveSchoolCoachServiceImpl implements IDriveSchoolCoachService
} }
@Override @Override
public List<DriveSchoolCoach> selectDriveSchoolCoachListAll(@Param("entity") DriveSchoolCoach driveSchoolCoach) { public List<DriveSchoolCoach> selectDriveSchoolCoachListAll(DriveSchoolCoach driveSchoolCoach) {
// 检查driveSchoolCoach是否为null driveSchoolCoach.setDeptId(12L);
if (driveSchoolCoach == null) { DriveSchoolInfo jxInfoData = driveSchoolInfoMapper.findInfoByJxId(driveSchoolCoach.getDeptId());
return Collections.emptyList(); // 返回空列表或者可以根据需求抛出异常 driveSchoolCoach.setDeptId(jxInfoData.getDeptId());
}
return driveSchoolCoachMapper.selectDriveSchoolCoachListAll(driveSchoolCoach); return driveSchoolCoachMapper.selectDriveSchoolCoachListAll(driveSchoolCoach);
} }
@Override @Override
public List<DriveSchoolCoach> findSelfJlListByJxId(Long jxId) { public List<DriveSchoolCoach> findSelfJlListByJxId(Long jxId) {
DriveSchoolInfo jxInfoData = driveSchoolInfoMapper.findInfoByJxId(jxId); DriveSchoolInfo jxInfoData = driveSchoolInfoMapper.findInfoByJxId(jxId);

View File

@ -87,30 +87,14 @@ public class DriveSchoolExamPassServiceImpl implements IDriveSchoolExamPassServi
*/ */
@Override @Override
public IPage<DriveSchoolExamPass> selectDriveSchoolExamPassList(DriveSchoolExamPass driveSchoolExamPass, Page<DriveSchoolExamPass> page) { public IPage<DriveSchoolExamPass> selectDriveSchoolExamPassList(DriveSchoolExamPass driveSchoolExamPass, Page<DriveSchoolExamPass> page) {
if (driveSchoolExamPass == null) {
throw new IllegalArgumentException("driveSchoolExamPass cannot be null");
}
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();
AdminUserRespDTO user = userApi.getUser(userId); AdminUserRespDTO user = userApi.getUser(userId);
Long deptId = user.getDeptId(); Long deptId = user.getDeptId();
// 空值检查
if (deptId == null || deptId <= 0) {
throw new IllegalArgumentException("无效的部门 ID");
}
// 获取驾校信息
DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.getSchoolInfoByDeptId(deptId); DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.getSchoolInfoByDeptId(deptId);
if (schoolInfoByDeptId == null) {
throw new RuntimeException("未找到指定部门的驾校信息");
}
driveSchoolExamPass.setJxId(schoolInfoByDeptId.getId()); driveSchoolExamPass.setJxId(schoolInfoByDeptId.getId());
return driveSchoolExamPassMapper.selectDriveSchoolExamPassList(driveSchoolExamPass, page); return driveSchoolExamPassMapper.selectDriveSchoolExamPassList(driveSchoolExamPass, page);
} }
@Autowired @Autowired
private DriveSchoolPayService driveSchoolPayService; private DriveSchoolPayService driveSchoolPayService;
@ -217,37 +201,22 @@ public class DriveSchoolExamPassServiceImpl implements IDriveSchoolExamPassServi
*/ */
@Override @Override
public IPage<DriveSchoolExamPass> getBalanceList(DriveSchoolExamPass driveSchoolExamPass, Page<DriveSchoolExamPass> page) { public IPage<DriveSchoolExamPass> getBalanceList(DriveSchoolExamPass driveSchoolExamPass, Page<DriveSchoolExamPass> page) {
// 检查 JX ID
if (ObjectUtils.isNotEmpty(driveSchoolExamPass.getJxId())) { if (ObjectUtils.isNotEmpty(driveSchoolExamPass.getJxId())) {
driveSchoolExamPass.setJxId(driveSchoolExamPass.getId()); driveSchoolExamPass.setJxId(driveSchoolExamPass.getId());
} else { } else {
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();
AdminUserRespDTO user = userApi.getUser(userId); AdminUserRespDTO user = userApi.getUser(userId);
Long deptId = user.getDeptId(); Long deptId = user.getDeptId();
// 获取驾校信息
DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.getSchoolInfoByDeptId(deptId); DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.getSchoolInfoByDeptId(deptId);
// 检查 schoolInfoByDeptId 是否为 null
if (schoolInfoByDeptId == null) {
throw new RuntimeException("未找到指定部门的驾校信息"); // 抛出合理的异常
}
driveSchoolExamPass.setJxId(schoolInfoByDeptId.getId()); driveSchoolExamPass.setJxId(schoolInfoByDeptId.getId());
} }
// 进一步的逻辑处理
// 否则进行时间格式化
SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd"); SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd");
if (ObjectUtils.isNotEmpty(driveSchoolExamPass.getPayStartTime()) && if (ObjectUtils.isNotEmpty(driveSchoolExamPass.getPayStartTime()) && ObjectUtils.isNotEmpty(driveSchoolExamPass.getPayEndTime())) {
ObjectUtils.isNotEmpty(driveSchoolExamPass.getPayEndTime())) {
driveSchoolExamPass.setPayStartTimes(simpleDateFormat.format(driveSchoolExamPass.getPayStartTime())); driveSchoolExamPass.setPayStartTimes(simpleDateFormat.format(driveSchoolExamPass.getPayStartTime()));
driveSchoolExamPass.setPayEndTimes(simpleDateFormat.format(driveSchoolExamPass.getPayEndTime())); driveSchoolExamPass.setPayEndTimes(simpleDateFormat.format(driveSchoolExamPass.getPayEndTime()));
} }
IPage<DriveSchoolExamPass> records = driveSchoolExamPassMapper.getBalanceList(driveSchoolExamPass, page); IPage<DriveSchoolExamPass> records = driveSchoolExamPassMapper.getBalanceList(driveSchoolExamPass, page);
// 处理余额逻辑
List<DriveSchoolExamPass> balanceList = records.getRecords(); List<DriveSchoolExamPass> balanceList = records.getRecords();
balanceList.forEach(s -> { balanceList.forEach(s -> {
DriveSchoolExamPass driveSchoolExamPass1 = new DriveSchoolExamPass(); DriveSchoolExamPass driveSchoolExamPass1 = new DriveSchoolExamPass();
@ -258,11 +227,9 @@ public class DriveSchoolExamPassServiceImpl implements IDriveSchoolExamPassServi
s.setDeducts(new BigDecimal(0)); s.setDeducts(new BigDecimal(0));
} }
}); });
return records; return records;
} }
@Override @Override
public int pay(DriveSchoolExamPass driveSchoolExamPass) { public int pay(DriveSchoolExamPass driveSchoolExamPass) {
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();

View File

@ -260,51 +260,27 @@ public class DriveSchoolInfoServiceImpl implements IDriveSchoolInfoService
return driveSchoolInfoMapper.deleteDriveSchoolInfoById(id); return driveSchoolInfoMapper.deleteDriveSchoolInfoById(id);
} }
/**
* 根据部门id获取驾校信息
*
* @return 驾校信息
*/
@Override @Override
public DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId) { public DriveSchoolInfoVO getSchoolInfoByDeptId() {
// 记录deptId
System.out.println("Dept ID: " + deptId);
// 获取教练id
Long jlId = 0L;
// 根据当前用户的手机号获取教练信息
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();
AdminUserRespDTO sysUser = userApi.getUser(userId); AdminUserRespDTO sysUser = userApi.getUser(userId);
String phonenumber = sysUser.getMobile(); Long deptId = sysUser.getDeptId();
System.out.println("当前用户手机号: " + phonenumber); //获取教练id
// Long userId = SecurityFrameworkUtils.getLoginUserId();
// 获取教练信息 // AdminUserRespDTO sysUser = userApi.getUser(userId);
//SysUser sysUser =sysUserMapper.selectUserById(userId);
String phonenumber=sysUser.getMobile();
Long jlId =0L;
DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber); DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber);
if (driveSchoolCoach != null) { if (ObjectUtils.isNotEmpty(driveSchoolCoach)){
jlId = driveSchoolCoach.getId(); jlId = driveSchoolCoach.getId();
System.out.println("教练ID: " + jlId);
} else {
System.err.println("未找到手机号为 " + phonenumber + " 的教练信息");
// 可以选择抛出异常或返回默认值
}
// 获取驾校信息
DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.getSchoolInfoByDeptId(deptId);
if (schoolInfoByDeptId != null) {
schoolInfoByDeptId.setJlId(jlId);
} else {
System.err.println("未找到部门 ID 为 " + deptId + " 的驾校信息");
throw new RuntimeException("未找到指定部门的驾校信息");
} }
DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.getSchoolInfoByDeptId(100L);
schoolInfoByDeptId.setJlId(jlId);
return schoolInfoByDeptId; return schoolInfoByDeptId;
} }
@Override @Override
public List<PayVo> findSelfSchoolData() { public List<PayVo> findSelfSchoolData() {

View File

@ -9,8 +9,6 @@ import cn.iocoder.yudao.module.jx.mapper.DriveSchoolInfoMapper;
import cn.iocoder.yudao.module.jx.mapper.DriveSchoolSwiperMapper; import cn.iocoder.yudao.module.jx.mapper.DriveSchoolSwiperMapper;
import cn.iocoder.yudao.module.jx.service.IDriveSchoolSwiperService; import cn.iocoder.yudao.module.jx.service.IDriveSchoolSwiperService;
import cn.iocoder.yudao.module.jx.vo.DriveSchoolInfoVO; import cn.iocoder.yudao.module.jx.vo.DriveSchoolInfoVO;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.thoughtworks.xstream.core.SecurityUtils; import com.thoughtworks.xstream.core.SecurityUtils;
import org.apache.commons.lang3.ObjectUtils; import org.apache.commons.lang3.ObjectUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
@ -62,28 +60,21 @@ public class DriveSchoolSwiperServiceImpl implements IDriveSchoolSwiperService
@Resource @Resource
private DriveSchoolInfoMapper driveSchoolInfoMapper; private DriveSchoolInfoMapper driveSchoolInfoMapper;
/**
* 分页查询驾校-轮播图
*
* @param driveSchoolSwiper 驾校-轮播图
* @return 结果
*/
@Override @Override
public IPage<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper, Page<DriveSchoolSwiper> page) { public List<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper)
{
Long deptId = 0L; Long deptId = 0L;
if (ObjectUtils.isNotEmpty(driveSchoolSwiper.getJxId())) { if (ObjectUtils.isNotEmpty(driveSchoolSwiper.getJxId())){
DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.findInfoByJxId(driveSchoolSwiper.getJxId()); DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.findInfoByJxId(driveSchoolSwiper.getJxId());
deptId = schoolInfoByDeptId.getDeptId(); deptId = schoolInfoByDeptId.getDeptId();
} else { }else {
Long userId = SecurityFrameworkUtils.getLoginUserId(); Long userId = SecurityFrameworkUtils.getLoginUserId();
AdminUserRespDTO user = userApi.getUser(userId); AdminUserRespDTO user = userApi.getUser(userId);
deptId = user.getDeptId(); deptId = user.getDeptId();
} }
driveSchoolSwiper.setDeptId(deptId); driveSchoolSwiper.setDeptId(deptId);
return driveSchoolSwiperMapper.selectDriveSchoolSwiperList(driveSchoolSwiper);
// 创建分页对象
// Page<DriveSchoolSwiper> page = new Page<>(driveSchoolSwiper.getPageNum(), driveSchoolSwiper.getPageSize());
return driveSchoolSwiperMapper.selectDriveSchoolSwiperPage(driveSchoolSwiper,page);
} }
/** /**

View File

@ -155,13 +155,10 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where deleted = 0 and dept_id = #{deptId} where deleted = 0 and dept_id = #{deptId}
</select> </select>
<select id="findInfoByJxId" parameterType="Long" resultMap="DriveSchoolInfoVOResult"> <select id="findInfoByJxId" parameterType="Long" resultMap="DriveSchoolInfoVOResult">
<include refid="selectDriveSchoolInfoVo"/> <include refid="selectDriveSchoolInfoVo"/>
where id = #{jxId}; where id = #{jxId};
</select> </select>
</mapper> </mapper>

View File

@ -21,31 +21,19 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
select id, swiper_name, dept_id,swiper_picture, jump_url, list_order, creator, create_time, updater, update_time from drive_school_swiper select id, swiper_name, dept_id,swiper_picture, jump_url, list_order, creator, create_time, updater, update_time from drive_school_swiper
</sql> </sql>
<select id="selectDriveSchoolSwiperList" resultMap="DriveSchoolSwiperResult"> <select id="selectDriveSchoolSwiperList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper" resultMap="DriveSchoolSwiperResult">
SELECT id, swiper_name, dept_id, swiper_picture, jump_url, list_order, creator, create_time, updater, update_time <include refid="selectDriveSchoolSwiperVo"/>
FROM drive_school_swiper
<where> <where>
deleted = 0 deleted = 0
<if test="swiperName != null and swiperName != ''"> <if test="swiperName != null and swiperName != ''"> and swiper_name like concat('%', #{swiperName}, '%')</if>
AND swiper_name LIKE CONCAT('%', #{swiperName}, '%') <if test="swiperPicture != null and swiperPicture != ''"> and swiper_picture = #{swiperPicture}</if>
</if> <if test="jumpUrl != null and jumpUrl != ''"> and jump_url = #{jumpUrl}</if>
<if test="swiperPicture != null and swiperPicture != ''"> <if test="deptId != null "> and dept_id = #{deptId}</if>
AND swiper_picture = #{swiperPicture} <if test="listOrder != null "> and list_order = #{listOrder}</if>
</if>
<if test="jumpUrl != null and jumpUrl != ''">
AND jump_url = #{jumpUrl}
</if>
<if test="deptId != null">
AND dept_id = #{deptId}
</if>
<if test="listOrder != null">
AND list_order = #{listOrder}
</if>
</where> </where>
ORDER BY list_order ASC order by list_order asc
</select> </select>
<select id="selectDriveSchoolSwiperById" parameterType="Long" resultMap="DriveSchoolSwiperResult"> <select id="selectDriveSchoolSwiperById" parameterType="Long" resultMap="DriveSchoolSwiperResult">
<include refid="selectDriveSchoolSwiperVo"/> <include refid="selectDriveSchoolSwiperVo"/>
where id = #{id} where id = #{id}
@ -105,33 +93,4 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
#{id} #{id}
</foreach> </foreach>
</delete> </delete>
<select id="selectDriveSchoolSwiperPage" resultMap="DriveSchoolSwiperResult">
SELECT id, swiper_name, dept_id, swiper_picture, jump_url, list_order, creator, create_time, updater, update_time
FROM drive_school_swiper
<where>
deleted = 0
<if test="driveSchoolSwiper != null">
<if test="driveSchoolSwiper.swiperName != null and driveSchoolSwiper.swiperName != ''">
AND swiper_name LIKE CONCAT('%', #{driveSchoolSwiper.swiperName}, '%')
</if>
<if test="driveSchoolSwiper.swiperPicture != null and driveSchoolSwiper.swiperPicture != ''">
AND swiper_picture = #{driveSchoolSwiper.swiperPicture}
</if>
<if test="driveSchoolSwiper.jumpUrl != null and driveSchoolSwiper.jumpUrl != ''">
AND jump_url = #{driveSchoolSwiper.jumpUrl}
</if>
<if test="driveSchoolSwiper.deptId != null">
AND dept_id = #{driveSchoolSwiper.deptId}
</if>
<if test="driveSchoolSwiper.listOrder != null">
AND list_order = #{driveSchoolSwiper.listOrder}
</if>
</if>
</where>
ORDER BY list_order ASC
</select>
</mapper> </mapper>