Merge remote-tracking branch 'origin/dev' into dev

This commit is contained in:
许允枞 2024-10-21 13:10:05 +08:00
commit 1624cc2e5f
15 changed files with 259 additions and 55 deletions

View File

@ -46,6 +46,7 @@ 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,10 +1,13 @@
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.*;
@ -24,6 +27,8 @@ public class DriveSchoolInfoController extends BaseController
{ {
@Resource @Resource
private IDriveSchoolInfoService driveSchoolInfoService; private IDriveSchoolInfoService driveSchoolInfoService;
@Resource
private AdminUserApi userApi;
/** /**
* 查询自己的订单 * 查询自己的订单
@ -81,7 +86,10 @@ public class DriveSchoolInfoController extends BaseController
@GetMapping("/getSchoolInfoByDeptId") @GetMapping("/getSchoolInfoByDeptId")
public CommonResult getSchoolInfoByDeptId() public CommonResult getSchoolInfoByDeptId()
{ {
return CommonResult.success(driveSchoolInfoService.getSchoolInfoByDeptId()); Long userId = SecurityFrameworkUtils.getLoginUserId();
AdminUserRespDTO sysUser = userApi.getUser(userId);
Long deptId = sysUser.getDeptId();
return success(driveSchoolInfoService.getSchoolInfoByDeptId(deptId));
} }
/** /**

View File

@ -2,12 +2,16 @@ 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;
@ -35,13 +39,21 @@ public class DriveSchoolSwiperController extends BaseController
return CommonResult.success(list); return CommonResult.success(list);
} }
/**
* 分页查询驾校-轮播图列表
*/
@GetMapping("/pclist") @GetMapping("/pclist")
public CommonResult pclist(DriveSchoolSwiper driveSchoolSwiper) @PermitAll
{ public CommonResult pclist(DriveSchoolSwiper driveSchoolSwiper) {
List<DriveSchoolSwiper> list = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper); Page<DriveSchoolSwiper> page = new Page<>(driveSchoolSwiper.getPageNum(), driveSchoolSwiper.getPageSize());
return CommonResult.success(list); IPage<DriveSchoolSwiper> driveSchoolSeparateIPage = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper, page);
// IPage<DriveSchoolSwiper> page = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper, current, size);
return CommonResult.success(driveSchoolSeparateIPage);
} }
/** /**
* 导出驾校-轮播图列表 * 导出驾校-轮播图列表
*/ */

View File

@ -8,6 +8,7 @@ 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;
@ -44,25 +45,33 @@ 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); AdminUserDO sysUser = userService.getUser(userId);
Long deptId = sysUser.getDeptId();
String phonenumber = sysUser.getMobile(); String phonenumber = sysUser.getMobile();
//根据手机号查询驾校教练 //根据手机号查询驾校教练
DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber); DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber);
@ -70,7 +79,7 @@ public class JxAuthController {
if (ObjectUtils.isNotEmpty(driveSchoolCoach)){ if (ObjectUtils.isNotEmpty(driveSchoolCoach)){
sysUser.setAvatar(driveSchoolCoach.getImage()); sysUser.setAvatar(driveSchoolCoach.getImage());
} }
DriveSchoolInfo driveSchoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId(); DriveSchoolInfo driveSchoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId(deptId);
Map<String,Object> result = new HashMap<>(); Map<String,Object> result = new HashMap<>();
result.put("user", sysUser); result.put("user", sysUser);

View File

@ -67,8 +67,19 @@ 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,8 +1,14 @@
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;
@ -29,7 +35,8 @@ public interface DriveSchoolSwiperMapper
* @param driveSchoolSwiper 驾校-轮播图 * @param driveSchoolSwiper 驾校-轮播图
* @return 驾校-轮播图集合 * @return 驾校-轮播图集合
*/ */
public List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper); List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper);
/** /**
* 新增驾校-轮播图 * 新增驾校-轮播图
@ -62,4 +69,12 @@ 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,6 +1,7 @@
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;
@ -12,14 +13,19 @@ 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
@ -38,7 +44,10 @@ 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) {
@ -50,28 +59,41 @@ public class DriveSchoolPayController extends BaseController
* 查询订单列表 * 查询订单列表
*/ */
@GetMapping("/list") @GetMapping("/list")
public CommonResult<IPage<?>> list(DriveSchoolPay driveSchoolPay) public CommonResult<IPage<?>> list(DriveSchoolPay driveSchoolPay) {
{
int number = 0; // 获取当前用户信息
int numbers = 0; LoginUser user = SecurityFrameworkUtils.getLoginUser();
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();
for (DriveSchoolPay row :list) { int allNumber = (driveSchoolPay.getPageNum() - 1) * driveSchoolPay.getPageSize();
numbers += 1; for (int i = 0; i < list.size(); i++) {
allNumber = (driveSchoolPay.getPageNum()-1) * driveSchoolPay.getPageSize(); String formattedNumber = String.format("%05d", allNumber + i + 1);
number = allNumber + numbers; list.get(i).setSorNumber(formattedNumber);
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(); DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId);
List<PayVo> findSelfSchoolData(); List<PayVo> findSelfSchoolData();

View File

@ -1,6 +1,9 @@
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;
@ -27,7 +30,6 @@ public interface IDriveSchoolSwiperService
* @return 驾校-轮播图集合 * @return 驾校-轮播图集合
*/ */
public List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper); public List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper);
public List<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper);
/** /**
* 新增驾校-轮播图 * 新增驾校-轮播图
@ -60,4 +62,12 @@ 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,11 +23,13 @@ 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;
@ -115,6 +117,7 @@ public class DriveSchoolCoachServiceImpl implements IDriveSchoolCoachService
// } // }
@Resource @Resource
private AdminUserService adminUserService; private AdminUserService adminUserService;
@ -246,13 +249,16 @@ public class DriveSchoolCoachServiceImpl implements IDriveSchoolCoachService
} }
@Override @Override
public List<DriveSchoolCoach> selectDriveSchoolCoachListAll(DriveSchoolCoach driveSchoolCoach) { public List<DriveSchoolCoach> selectDriveSchoolCoachListAll(@Param("entity") DriveSchoolCoach driveSchoolCoach) {
driveSchoolCoach.setDeptId(12L); // 检查driveSchoolCoach是否为null
DriveSchoolInfo jxInfoData = driveSchoolInfoMapper.findInfoByJxId(driveSchoolCoach.getDeptId()); if (driveSchoolCoach == null) {
driveSchoolCoach.setDeptId(jxInfoData.getDeptId()); return Collections.emptyList(); // 返回空列表或者可以根据需求抛出异常
}
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,14 +87,30 @@ 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;
@ -201,22 +217,37 @@ 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()) && ObjectUtils.isNotEmpty(driveSchoolExamPass.getPayEndTime())) { if (ObjectUtils.isNotEmpty(driveSchoolExamPass.getPayStartTime()) &&
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();
@ -227,9 +258,11 @@ 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,27 +260,51 @@ public class DriveSchoolInfoServiceImpl implements IDriveSchoolInfoService
return driveSchoolInfoMapper.deleteDriveSchoolInfoById(id); return driveSchoolInfoMapper.deleteDriveSchoolInfoById(id);
} }
/**
* 根据部门id获取驾校信息
*
* @return 驾校信息
*/
@Override @Override
public DriveSchoolInfoVO getSchoolInfoByDeptId() { public DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId) {
// 记录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);
Long deptId = sysUser.getDeptId(); String phonenumber = sysUser.getMobile();
//获取教练id System.out.println("当前用户手机号: " + phonenumber);
// 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 (ObjectUtils.isNotEmpty(driveSchoolCoach)){ if (driveSchoolCoach != null) {
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,6 +9,8 @@ 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;
@ -60,21 +62,28 @@ public class DriveSchoolSwiperServiceImpl implements IDriveSchoolSwiperService
@Resource @Resource
private DriveSchoolInfoMapper driveSchoolInfoMapper; private DriveSchoolInfoMapper driveSchoolInfoMapper;
/**
* 分页查询驾校-轮播图
*
* @param driveSchoolSwiper 驾校-轮播图
* @return 结果
*/
@Override @Override
public List<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper) public IPage<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper, Page<DriveSchoolSwiper> page) {
{
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,10 +155,13 @@ 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,19 +21,31 @@ 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" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper" resultMap="DriveSchoolSwiperResult"> <select id="selectDriveSchoolSwiperList" resultMap="DriveSchoolSwiperResult">
<include refid="selectDriveSchoolSwiperVo"/> SELECT id, swiper_name, dept_id, swiper_picture, jump_url, list_order, creator, create_time, updater, update_time
FROM drive_school_swiper
<where> <where>
deleted = 0 deleted = 0
<if test="swiperName != null and swiperName != ''"> and swiper_name like concat('%', #{swiperName}, '%')</if> <if test="swiperName != null and swiperName != ''">
<if test="swiperPicture != null and swiperPicture != ''"> and swiper_picture = #{swiperPicture}</if> AND swiper_name LIKE CONCAT('%', #{swiperName}, '%')
<if test="jumpUrl != null and jumpUrl != ''"> and jump_url = #{jumpUrl}</if> </if>
<if test="deptId != null "> and dept_id = #{deptId}</if> <if test="swiperPicture != null and swiperPicture != ''">
<if test="listOrder != null "> and list_order = #{listOrder}</if> AND swiper_picture = #{swiperPicture}
</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}
@ -93,4 +105,33 @@ 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>