驾校系统bug修复
This commit is contained in:
parent
56de69b136
commit
552545e4c3
@ -46,6 +46,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<include refid="selectPartnerCustomerInfoVo"/>
|
||||
where id = #{id}
|
||||
</select>
|
||||
|
||||
<select id="pagePartnerCustomerInfoList"
|
||||
resultType="cn.iocoder.yudao.module.partner.entity.PartnerCustomerInfo">
|
||||
select pci.*,
|
||||
|
@ -1,10 +1,13 @@
|
||||
package cn.iocoder.yudao.module.jx.controller.admin;
|
||||
|
||||
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.domain.DriveSchoolInfo;
|
||||
import cn.iocoder.yudao.module.jx.payment.vo.PayVo;
|
||||
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.extension.plugins.pagination.Page;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -24,6 +27,8 @@ public class DriveSchoolInfoController extends BaseController
|
||||
{
|
||||
@Resource
|
||||
private IDriveSchoolInfoService driveSchoolInfoService;
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
/**
|
||||
* 查询自己的订单
|
||||
@ -81,7 +86,10 @@ public class DriveSchoolInfoController extends BaseController
|
||||
@GetMapping("/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));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -2,12 +2,16 @@ package cn.iocoder.yudao.module.jx.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
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.service.IDriveSchoolSwiperService;
|
||||
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.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.security.PermitAll;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
|
||||
@ -35,13 +39,21 @@ public class DriveSchoolSwiperController extends BaseController
|
||||
return CommonResult.success(list);
|
||||
}
|
||||
|
||||
/**
|
||||
* 分页查询驾校-轮播图列表
|
||||
*/
|
||||
@GetMapping("/pclist")
|
||||
public CommonResult pclist(DriveSchoolSwiper driveSchoolSwiper)
|
||||
{
|
||||
List<DriveSchoolSwiper> list = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper);
|
||||
return CommonResult.success(list);
|
||||
@PermitAll
|
||||
public CommonResult pclist(DriveSchoolSwiper driveSchoolSwiper) {
|
||||
Page<DriveSchoolSwiper> page = new Page<>(driveSchoolSwiper.getPageNum(), driveSchoolSwiper.getPageSize());
|
||||
IPage<DriveSchoolSwiper> driveSchoolSeparateIPage = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper, page);
|
||||
|
||||
// IPage<DriveSchoolSwiper> page = driveSchoolSwiperService.selectDriveSchoolSwiperPclist(driveSchoolSwiper, current, size);
|
||||
return CommonResult.success(driveSchoolSeparateIPage);
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 导出驾校-轮播图列表
|
||||
*/
|
||||
|
@ -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.mapper.DriveSchoolCoachMapper;
|
||||
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.dal.dataobject.user.AdminUserDO;
|
||||
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
|
||||
@ -44,25 +45,33 @@ public class JxAuthController {
|
||||
private DriveSchoolCoachMapper driveSchoolCoachMapper;
|
||||
@Resource
|
||||
private IDriveSchoolInfoService driveSchoolInfoService;
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取
|
||||
* 获取Jx用户信息
|
||||
*
|
||||
* @return 用户信息
|
||||
*/
|
||||
@GetMapping("/getJxInfo")
|
||||
public CommonResult getJxInfo()
|
||||
{
|
||||
// 获取当前用户信息
|
||||
// Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
// AdminUserRespDTO sysUser = userApi.getUser(userId);
|
||||
// Long deptId = sysUser.getDeptId();
|
||||
|
||||
LoginUser user = SecurityFrameworkUtils.getLoginUser();
|
||||
// 获取当前登录用户角色编码
|
||||
Set<String> roles = permissionService.getRolePermission(user.getId());
|
||||
//获取驾校的
|
||||
Long userId = user.getId();
|
||||
|
||||
AdminUserDO sysUser = userService.getUser(userId);
|
||||
Long deptId = sysUser.getDeptId();
|
||||
|
||||
String phonenumber = sysUser.getMobile();
|
||||
//根据手机号查询驾校教练
|
||||
DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber);
|
||||
@ -70,7 +79,7 @@ public class JxAuthController {
|
||||
if (ObjectUtils.isNotEmpty(driveSchoolCoach)){
|
||||
sysUser.setAvatar(driveSchoolCoach.getImage());
|
||||
}
|
||||
DriveSchoolInfo driveSchoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId();
|
||||
DriveSchoolInfo driveSchoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId(deptId);
|
||||
|
||||
Map<String,Object> result = new HashMap<>();
|
||||
result.put("user", sysUser);
|
||||
|
@ -67,8 +67,19 @@ public interface DriveSchoolInfoMapper
|
||||
*/
|
||||
public int deleteDriveSchoolInfoByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 根据部门ID查询驾校信息
|
||||
* @param deptId 部门ID
|
||||
* @return 驾校信息
|
||||
*/
|
||||
DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId);
|
||||
|
||||
|
||||
/**
|
||||
* 根据驾校ID查询驾校信息
|
||||
* @param jxId 驾校ID
|
||||
* @return 驾校信息
|
||||
*/
|
||||
DriveSchoolInfoVO findInfoByJxId(Long jxId);
|
||||
|
||||
}
|
||||
|
@ -1,8 +1,14 @@
|
||||
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.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.springframework.data.repository.query.Param;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@ -29,7 +35,8 @@ public interface DriveSchoolSwiperMapper
|
||||
* @param driveSchoolSwiper 驾校-轮播图
|
||||
* @return 驾校-轮播图集合
|
||||
*/
|
||||
public List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper);
|
||||
List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper);
|
||||
|
||||
|
||||
/**
|
||||
* 新增驾校-轮播图
|
||||
@ -62,4 +69,12 @@ public interface DriveSchoolSwiperMapper
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDriveSchoolSwiperByIds(Long[] ids);
|
||||
|
||||
/**
|
||||
* 分页查询驾校-轮播图
|
||||
*
|
||||
* @param
|
||||
* @return 结果
|
||||
*/
|
||||
IPage<DriveSchoolSwiper> selectDriveSchoolSwiperPage(@Param("entity")DriveSchoolSwiper entity , Page<DriveSchoolSwiper> page);
|
||||
}
|
||||
|
@ -1,6 +1,7 @@
|
||||
package cn.iocoder.yudao.module.jx.payment.api;
|
||||
|
||||
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.module.jx.core.controller.BaseController;
|
||||
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.system.api.user.AdminUserApi;
|
||||
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.extension.plugins.pagination.Page;
|
||||
import com.sun.javaws.IconUtil;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* 订单Controller
|
||||
@ -38,7 +44,10 @@ public class DriveSchoolPayController extends BaseController
|
||||
|
||||
@Resource
|
||||
private AdminUserApi userApi;
|
||||
|
||||
@Resource
|
||||
private PermissionService permissionService;
|
||||
@Resource
|
||||
private AdminUserService userService;
|
||||
|
||||
@GetMapping("updatePayById")
|
||||
public void updatePayById(Integer id, String name, Integer jlId) {
|
||||
@ -50,28 +59,41 @@ public class DriveSchoolPayController extends BaseController
|
||||
* 查询订单列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
public CommonResult<IPage<?>> list(DriveSchoolPay driveSchoolPay)
|
||||
{
|
||||
public CommonResult<IPage<?>> list(DriveSchoolPay driveSchoolPay) {
|
||||
|
||||
int number = 0;
|
||||
int numbers = 0;
|
||||
int allNumber = 0;
|
||||
DriveSchoolInfoVO schoolInfo = driveSchoolInfoService.getSchoolInfoByDeptId();
|
||||
// 获取当前用户信息
|
||||
LoginUser user = SecurityFrameworkUtils.getLoginUser();
|
||||
|
||||
//获取驾校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) {
|
||||
System.out.println("啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊啊");
|
||||
driveSchoolPay.setJxId(schoolInfo.getId());
|
||||
}
|
||||
|
||||
// 创建分页对象
|
||||
Page<DriveSchoolPay> page = new Page<>(driveSchoolPay.getPageNum(), driveSchoolPay.getPageSize());
|
||||
IPage<DriveSchoolPay> driveSchoolPayIPage = driveSchoolPayService.selectDriveSchoolPayList(driveSchoolPay, page);
|
||||
|
||||
// 处理记录格式化排序
|
||||
List<DriveSchoolPay> list = driveSchoolPayIPage.getRecords();
|
||||
for (DriveSchoolPay row :list) {
|
||||
numbers += 1;
|
||||
allNumber = (driveSchoolPay.getPageNum()-1) * driveSchoolPay.getPageSize();
|
||||
number = allNumber + numbers;
|
||||
String formattedNumber = String.format("%05d", number);
|
||||
row.setSorNumber(formattedNumber);
|
||||
int allNumber = (driveSchoolPay.getPageNum() - 1) * driveSchoolPay.getPageSize();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
String formattedNumber = String.format("%05d", allNumber + i + 1);
|
||||
list.get(i).setSorNumber(formattedNumber);
|
||||
}
|
||||
|
||||
return CommonResult.success(driveSchoolPayIPage);
|
||||
}
|
||||
|
||||
|
@ -66,7 +66,7 @@ public interface IDriveSchoolInfoService
|
||||
*/
|
||||
public int deleteDriveSchoolInfoById(Long id);
|
||||
|
||||
DriveSchoolInfoVO getSchoolInfoByDeptId();
|
||||
DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId);
|
||||
|
||||
List<PayVo> findSelfSchoolData();
|
||||
|
||||
|
@ -1,6 +1,9 @@
|
||||
package cn.iocoder.yudao.module.jx.service;
|
||||
|
||||
import cn.iocoder.yudao.module.jx.domain.DriveSchoolSeparate;
|
||||
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;
|
||||
|
||||
@ -27,7 +30,6 @@ public interface IDriveSchoolSwiperService
|
||||
* @return 驾校-轮播图集合
|
||||
*/
|
||||
public List<DriveSchoolSwiper> selectDriveSchoolSwiperList(DriveSchoolSwiper driveSchoolSwiper);
|
||||
public List<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper);
|
||||
|
||||
/**
|
||||
* 新增驾校-轮播图
|
||||
@ -60,4 +62,12 @@ public interface IDriveSchoolSwiperService
|
||||
* @return 结果
|
||||
*/
|
||||
public int deleteDriveSchoolSwiperById(Long id);
|
||||
|
||||
/**
|
||||
* 分页查询驾校-轮播图
|
||||
*
|
||||
* @param driveSchoolSwiper 驾校-轮播图
|
||||
* @return 结果
|
||||
*/
|
||||
public IPage<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper, Page<DriveSchoolSwiper> page);
|
||||
}
|
||||
|
@ -23,11 +23,13 @@ import com.thoughtworks.xstream.core.SecurityUtils;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.repository.query.Param;
|
||||
import org.springframework.security.crypto.password.PasswordEncoder;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.config.CommonStr.USER_TYPE_STAFF;
|
||||
@ -115,6 +117,7 @@ public class DriveSchoolCoachServiceImpl implements IDriveSchoolCoachService
|
||||
// }
|
||||
|
||||
|
||||
|
||||
@Resource
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
@ -246,13 +249,16 @@ public class DriveSchoolCoachServiceImpl implements IDriveSchoolCoachService
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DriveSchoolCoach> selectDriveSchoolCoachListAll(DriveSchoolCoach driveSchoolCoach) {
|
||||
driveSchoolCoach.setDeptId(12L);
|
||||
DriveSchoolInfo jxInfoData = driveSchoolInfoMapper.findInfoByJxId(driveSchoolCoach.getDeptId());
|
||||
driveSchoolCoach.setDeptId(jxInfoData.getDeptId());
|
||||
public List<DriveSchoolCoach> selectDriveSchoolCoachListAll(@Param("entity") DriveSchoolCoach driveSchoolCoach) {
|
||||
// 检查driveSchoolCoach是否为null
|
||||
if (driveSchoolCoach == null) {
|
||||
return Collections.emptyList(); // 返回空列表,或者可以根据需求抛出异常
|
||||
}
|
||||
|
||||
return driveSchoolCoachMapper.selectDriveSchoolCoachListAll(driveSchoolCoach);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<DriveSchoolCoach> findSelfJlListByJxId(Long jxId) {
|
||||
DriveSchoolInfo jxInfoData = driveSchoolInfoMapper.findInfoByJxId(jxId);
|
||||
|
@ -87,14 +87,30 @@ public class DriveSchoolExamPassServiceImpl implements IDriveSchoolExamPassServi
|
||||
*/
|
||||
@Override
|
||||
public IPage<DriveSchoolExamPass> selectDriveSchoolExamPassList(DriveSchoolExamPass driveSchoolExamPass, Page<DriveSchoolExamPass> page) {
|
||||
if (driveSchoolExamPass == null) {
|
||||
throw new IllegalArgumentException("driveSchoolExamPass cannot be null");
|
||||
}
|
||||
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserRespDTO user = userApi.getUser(userId);
|
||||
Long deptId = user.getDeptId();
|
||||
|
||||
// 空值检查
|
||||
if (deptId == null || deptId <= 0) {
|
||||
throw new IllegalArgumentException("无效的部门 ID");
|
||||
}
|
||||
|
||||
// 获取驾校信息
|
||||
DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.getSchoolInfoByDeptId(deptId);
|
||||
if (schoolInfoByDeptId == null) {
|
||||
throw new RuntimeException("未找到指定部门的驾校信息");
|
||||
}
|
||||
|
||||
driveSchoolExamPass.setJxId(schoolInfoByDeptId.getId());
|
||||
return driveSchoolExamPassMapper.selectDriveSchoolExamPassList(driveSchoolExamPass, page);
|
||||
}
|
||||
|
||||
|
||||
@Autowired
|
||||
private DriveSchoolPayService driveSchoolPayService;
|
||||
|
||||
@ -201,22 +217,37 @@ public class DriveSchoolExamPassServiceImpl implements IDriveSchoolExamPassServi
|
||||
*/
|
||||
@Override
|
||||
public IPage<DriveSchoolExamPass> getBalanceList(DriveSchoolExamPass driveSchoolExamPass, Page<DriveSchoolExamPass> page) {
|
||||
|
||||
// 检查 JX ID
|
||||
if (ObjectUtils.isNotEmpty(driveSchoolExamPass.getJxId())) {
|
||||
driveSchoolExamPass.setJxId(driveSchoolExamPass.getId());
|
||||
} else {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserRespDTO user = userApi.getUser(userId);
|
||||
Long deptId = user.getDeptId();
|
||||
|
||||
// 获取驾校信息
|
||||
DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.getSchoolInfoByDeptId(deptId);
|
||||
|
||||
// 检查 schoolInfoByDeptId 是否为 null
|
||||
if (schoolInfoByDeptId == null) {
|
||||
throw new RuntimeException("未找到指定部门的驾校信息"); // 抛出合理的异常
|
||||
}
|
||||
|
||||
driveSchoolExamPass.setJxId(schoolInfoByDeptId.getId());
|
||||
}
|
||||
|
||||
// 进一步的逻辑处理
|
||||
// 否则进行时间格式化
|
||||
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.setPayEndTimes(simpleDateFormat.format(driveSchoolExamPass.getPayEndTime()));
|
||||
}
|
||||
|
||||
IPage<DriveSchoolExamPass> records = driveSchoolExamPassMapper.getBalanceList(driveSchoolExamPass, page);
|
||||
|
||||
// 处理余额逻辑
|
||||
List<DriveSchoolExamPass> balanceList = records.getRecords();
|
||||
balanceList.forEach(s -> {
|
||||
DriveSchoolExamPass driveSchoolExamPass1 = new DriveSchoolExamPass();
|
||||
@ -227,9 +258,11 @@ public class DriveSchoolExamPassServiceImpl implements IDriveSchoolExamPassServi
|
||||
s.setDeducts(new BigDecimal(0));
|
||||
}
|
||||
});
|
||||
|
||||
return records;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public int pay(DriveSchoolExamPass driveSchoolExamPass) {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
|
@ -260,27 +260,51 @@ public class DriveSchoolInfoServiceImpl implements IDriveSchoolInfoService
|
||||
return driveSchoolInfoMapper.deleteDriveSchoolInfoById(id);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据部门id获取驾校信息
|
||||
*
|
||||
* @return 驾校信息
|
||||
*/
|
||||
@Override
|
||||
public DriveSchoolInfoVO getSchoolInfoByDeptId() {
|
||||
public DriveSchoolInfoVO getSchoolInfoByDeptId(Long deptId) {
|
||||
// 记录deptId
|
||||
System.out.println("Dept ID: " + deptId);
|
||||
|
||||
// 获取教练id
|
||||
Long jlId = 0L;
|
||||
|
||||
// 根据当前用户的手机号获取教练信息
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserRespDTO sysUser = userApi.getUser(userId);
|
||||
Long deptId = sysUser.getDeptId();
|
||||
//获取教练id
|
||||
// Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
// AdminUserRespDTO sysUser = userApi.getUser(userId);
|
||||
//SysUser sysUser =sysUserMapper.selectUserById(userId);
|
||||
String phonenumber=sysUser.getMobile();
|
||||
Long jlId =0L;
|
||||
String phonenumber = sysUser.getMobile();
|
||||
System.out.println("当前用户手机号: " + phonenumber);
|
||||
|
||||
// 获取教练信息
|
||||
DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber);
|
||||
if (ObjectUtils.isNotEmpty(driveSchoolCoach)){
|
||||
if (driveSchoolCoach != null) {
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<PayVo> findSelfSchoolData() {
|
||||
|
||||
|
@ -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.service.IDriveSchoolSwiperService;
|
||||
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 org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@ -60,21 +62,28 @@ public class DriveSchoolSwiperServiceImpl implements IDriveSchoolSwiperService
|
||||
@Resource
|
||||
private DriveSchoolInfoMapper driveSchoolInfoMapper;
|
||||
|
||||
/**
|
||||
* 分页查询驾校-轮播图
|
||||
*
|
||||
* @param driveSchoolSwiper 驾校-轮播图
|
||||
* @return 结果
|
||||
*/
|
||||
@Override
|
||||
public List<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper)
|
||||
{
|
||||
|
||||
public IPage<DriveSchoolSwiper> selectDriveSchoolSwiperPclist(DriveSchoolSwiper driveSchoolSwiper, Page<DriveSchoolSwiper> page) {
|
||||
Long deptId = 0L;
|
||||
if (ObjectUtils.isNotEmpty(driveSchoolSwiper.getJxId())){
|
||||
if (ObjectUtils.isNotEmpty(driveSchoolSwiper.getJxId())) {
|
||||
DriveSchoolInfoVO schoolInfoByDeptId = driveSchoolInfoMapper.findInfoByJxId(driveSchoolSwiper.getJxId());
|
||||
deptId = schoolInfoByDeptId.getDeptId();
|
||||
}else {
|
||||
} else {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
AdminUserRespDTO user = userApi.getUser(userId);
|
||||
deptId = user.getDeptId();
|
||||
}
|
||||
driveSchoolSwiper.setDeptId(deptId);
|
||||
return driveSchoolSwiperMapper.selectDriveSchoolSwiperList(driveSchoolSwiper);
|
||||
|
||||
// 创建分页对象
|
||||
// Page<DriveSchoolSwiper> page = new Page<>(driveSchoolSwiper.getPageNum(), driveSchoolSwiper.getPageSize());
|
||||
return driveSchoolSwiperMapper.selectDriveSchoolSwiperPage(driveSchoolSwiper,page);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -155,10 +155,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
where deleted = 0 and dept_id = #{deptId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
<select id="findInfoByJxId" parameterType="Long" resultMap="DriveSchoolInfoVOResult">
|
||||
<include refid="selectDriveSchoolInfoVo"/>
|
||||
where id = #{jxId};
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -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
|
||||
</sql>
|
||||
|
||||
<select id="selectDriveSchoolSwiperList" parameterType="cn.iocoder.yudao.module.jx.domain.DriveSchoolSwiper" resultMap="DriveSchoolSwiperResult">
|
||||
<include refid="selectDriveSchoolSwiperVo"/>
|
||||
<select id="selectDriveSchoolSwiperList" 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="swiperName != null and swiperName != ''"> and swiper_name like concat('%', #{swiperName}, '%')</if>
|
||||
<if test="swiperPicture != null and swiperPicture != ''"> 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>
|
||||
<if test="swiperName != null and swiperName != ''">
|
||||
AND swiper_name LIKE CONCAT('%', #{swiperName}, '%')
|
||||
</if>
|
||||
<if test="swiperPicture != null and swiperPicture != ''">
|
||||
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>
|
||||
order by list_order asc
|
||||
ORDER BY list_order ASC
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectDriveSchoolSwiperById" parameterType="Long" resultMap="DriveSchoolSwiperResult">
|
||||
<include refid="selectDriveSchoolSwiperVo"/>
|
||||
where id = #{id}
|
||||
@ -93,4 +105,33 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
#{id}
|
||||
</foreach>
|
||||
</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>
|
||||
|
Loading…
Reference in New Issue
Block a user