Merge branch 'dev' of http://122.51.230.86:3000/dianliang/lanan-system into dev
This commit is contained in:
commit
744279c2e3
@ -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>
|
||||
|
@ -0,0 +1,139 @@
|
||||
package cn.iocoder.yudao.module.base.controller.admin;
|
||||
|
||||
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
||||
import cn.iocoder.yudao.module.base.service.RepairStatisticsService;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@Tag(name = "维修数据统计")
|
||||
@RestController
|
||||
@RequestMapping("/repair/statistics")
|
||||
@Validated
|
||||
public class RepairStatisticsController {
|
||||
@Resource
|
||||
private RepairStatisticsService statisticsService;
|
||||
|
||||
/**
|
||||
* 客户来源分析饼图
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/customerSource")
|
||||
@Operation(summary = "客户来源分析饼图")
|
||||
public CommonResult<?> customerSource() {
|
||||
return CommonResult.success(statisticsService.customerSource());
|
||||
}
|
||||
|
||||
/**
|
||||
* 月工单金额走势折线图
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/ticketMainAmount")
|
||||
@Operation(summary = "月工单金额走势")
|
||||
public CommonResult<?> ticketMainAmount() {
|
||||
return CommonResult.success(statisticsService.ticketMain("amount"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 月工单数量走势折线图
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/ticketMainCount")
|
||||
@Operation(summary = "月工单数量走势")
|
||||
public CommonResult<?> ticketMainCount() {
|
||||
return CommonResult.success(statisticsService.ticketMain("count"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付渠道统计柱状图
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/ticketMainPayWay")
|
||||
@Operation(summary = "支付渠道统计")
|
||||
public CommonResult<?> ticketMainPayWay() {
|
||||
return CommonResult.success(statisticsService.ticketMain("payWay"));
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修类型相关统计分析饼图
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/ticketMainPayWay")
|
||||
@Operation(summary = "维修类型相关统计分析饼图")
|
||||
public CommonResult<?> repairTypeStatistics() {
|
||||
return CommonResult.success(statisticsService.repairTypeStatistics());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单总数、今日工单、工单总金额、今日工单金额
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/ticketStatistics")
|
||||
@Operation(summary = "工单总数、今日工单、工单总金额、今日工单金额")
|
||||
public CommonResult<?> ticketStatistics() {
|
||||
return CommonResult.success(statisticsService.ticketStatistics());
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单状态数量统计
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/ticketStatusCount")
|
||||
@Operation(summary = "工单状态数量统计")
|
||||
public CommonResult<?> ticketStatusCount() {
|
||||
return CommonResult.success(statisticsService.ticketStatusCount());
|
||||
}
|
||||
|
||||
/**
|
||||
* 今日工单
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/listTicketToday")
|
||||
@Operation(summary = "今日工单")
|
||||
public CommonResult<?> listTicketToday() {
|
||||
return CommonResult.success(statisticsService.listTicketToday());
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工人排行
|
||||
*
|
||||
* @return cn.iocoder.yudao.framework.common.pojo.CommonResult<?>
|
||||
* @author PQZ
|
||||
* @date 16:15 2024/10/21
|
||||
**/
|
||||
@GetMapping("/listWorks")
|
||||
@Operation(summary = "维修工人排行")
|
||||
public CommonResult<?> listWorks() {
|
||||
return CommonResult.success(statisticsService.listWorks());
|
||||
}
|
||||
|
||||
}
|
@ -0,0 +1,99 @@
|
||||
package cn.iocoder.yudao.module.base.mapper;
|
||||
|
||||
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 维修数据统计
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Mapper
|
||||
public interface RepairStatisticsMapper {
|
||||
|
||||
/**
|
||||
* 客户来源统计
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
* @author PQZ
|
||||
* @date 13:57 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> customerSource();
|
||||
|
||||
/**
|
||||
* 月工单数量走势
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
* @author PQZ
|
||||
* @date 14:25 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> ticketCountTrend();
|
||||
|
||||
/**
|
||||
* 月工单金额走势
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
* @author PQZ
|
||||
* @date 14:31 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> ticketAmountTrend();
|
||||
|
||||
/**
|
||||
* 按照支付方式统计
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
* @author PQZ
|
||||
* @date 14:41 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> paymentWay();
|
||||
|
||||
/**
|
||||
* 维修方式统计饼图
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
* @author PQZ
|
||||
* @date 14:52 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> repairTypeStatistics();
|
||||
|
||||
/**
|
||||
* 工单总数、今日工单、工单总金额、今日工单金额
|
||||
*
|
||||
* @return cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO
|
||||
* @author PQZ
|
||||
* @date 15:31 2024/10/21
|
||||
**/
|
||||
RepairTicketStatisticsVO ticketStatistics();
|
||||
|
||||
/**
|
||||
* 工单状态数量统计
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
* @author PQZ
|
||||
* @date 15:44 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> ticketStatusCount();
|
||||
|
||||
/**
|
||||
* 今日工单
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO>
|
||||
* @author PQZ
|
||||
* @date 15:50 2024/10/21
|
||||
**/
|
||||
List<DlRepairTicketsRespVO> listTicketToday();
|
||||
|
||||
|
||||
/**
|
||||
* 维修工人排行
|
||||
* @author PQZ
|
||||
* @date 16:13 2024/10/21
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
**/
|
||||
List<RepairStatisticsVO> listWorks();
|
||||
|
||||
}
|
@ -0,0 +1,85 @@
|
||||
package cn.iocoder.yudao.module.base.service;
|
||||
|
||||
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 维修数据统计
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
public interface RepairStatisticsService {
|
||||
|
||||
/**
|
||||
* 客户来源分析饼图
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
* @author PQZ
|
||||
* @date 14:01 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> customerSource();
|
||||
|
||||
/**
|
||||
* 月工单数量、金额走势、支付渠道统计
|
||||
* @author PQZ
|
||||
* @date 14:32 2024/10/21
|
||||
* @param type 'amount:金额,count:数量',payWay:支付渠道
|
||||
* @return java.util.Map<java.lang.String,java.lang.Object>
|
||||
**/
|
||||
Map<String, Object> ticketMain(String type);
|
||||
|
||||
/**
|
||||
* 维修类型相关统计分析饼图
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @author PQZ
|
||||
* @date 13:25 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> repairTypeStatistics();
|
||||
|
||||
|
||||
/**
|
||||
* 工单总数、今日工单、工单总金额、今日工单金额
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @author PQZ
|
||||
* @date 13:23 2024/10/21
|
||||
**/
|
||||
RepairTicketStatisticsVO ticketStatistics();
|
||||
|
||||
/**
|
||||
* 工单状态数量统计
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @author PQZ
|
||||
* @date 13:28 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> ticketStatusCount();
|
||||
|
||||
|
||||
/**
|
||||
* 今日工单
|
||||
*
|
||||
* @return java.util.List<com.alibaba.fastjson.JSONObject>
|
||||
* @author PQZ
|
||||
* @date 13:25 2024/10/21
|
||||
**/
|
||||
List<DlRepairTicketsRespVO> listTicketToday();
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 维修工人排行
|
||||
*
|
||||
* @return java.util.List<com.alibaba.fastjson.JSONObject>
|
||||
* @author PQZ
|
||||
* @date 13:26 2024/10/21
|
||||
**/
|
||||
List<RepairStatisticsVO> listWorks();
|
||||
|
||||
|
||||
}
|
@ -0,0 +1,131 @@
|
||||
package cn.iocoder.yudao.module.base.service.impl;
|
||||
|
||||
import cn.iocoder.yudao.module.base.mapper.RepairStatisticsMapper;
|
||||
import cn.iocoder.yudao.module.base.service.RepairStatisticsService;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairStatisticsVO;
|
||||
import cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 维修数据统计
|
||||
*
|
||||
* @author pqz
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class RepairStatisticsServiceImpl implements RepairStatisticsService {
|
||||
|
||||
@Resource
|
||||
private RepairStatisticsMapper statisticsMapper;
|
||||
|
||||
/**
|
||||
* 客户来源分析饼图
|
||||
*
|
||||
* @return java.util.List<cn.iocoder.yudao.module.base.vo.RepairStatisticsVO>
|
||||
* @author PQZ
|
||||
* @date 14:01 2024/10/21
|
||||
**/
|
||||
@Override
|
||||
public List<RepairStatisticsVO> customerSource() {
|
||||
return statisticsMapper.customerSource();
|
||||
}
|
||||
|
||||
/**
|
||||
* 月工单数量、金额走势、支付渠道统计
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.Object>
|
||||
* @author PQZ
|
||||
* @date 13:20 2024/10/21
|
||||
**/
|
||||
@Override
|
||||
public Map<String, Object> ticketMain(String type) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
List<RepairStatisticsVO> tickets;
|
||||
if ("count".equals(type)) {
|
||||
//月工单数量走势折线图
|
||||
tickets = statisticsMapper.ticketCountTrend();
|
||||
} else if ("amount".equals(type)) {
|
||||
//月工单金额走势折线图
|
||||
tickets = statisticsMapper.ticketAmountTrend();
|
||||
} else {
|
||||
//支付渠道柱状图
|
||||
tickets = statisticsMapper.paymentWay();
|
||||
}
|
||||
//取出数值
|
||||
List<Integer> data = tickets.stream().map(RepairStatisticsVO::getValue).collect(Collectors.toList());
|
||||
//x轴值
|
||||
List<String> xData = tickets.stream().map(RepairStatisticsVO::getName).collect(Collectors.toList());
|
||||
result.put("data", data);
|
||||
result.put("xData", xData);
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修类型相关统计分析饼图
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @author PQZ
|
||||
* @date 13:25 2024/10/21
|
||||
**/
|
||||
@Override
|
||||
public List<RepairStatisticsVO> repairTypeStatistics() {
|
||||
return statisticsMapper.repairTypeStatistics();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 工单总数、今日工单、工单总金额、今日工单金额
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @author PQZ
|
||||
* @date 13:23 2024/10/21
|
||||
**/
|
||||
@Override
|
||||
public RepairTicketStatisticsVO ticketStatistics() {
|
||||
return statisticsMapper.ticketStatistics();
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单状态数量统计
|
||||
*
|
||||
* @return java.util.Map<java.lang.String, java.lang.String>
|
||||
* @author PQZ
|
||||
* @date 13:28 2024/10/21
|
||||
**/
|
||||
@Override
|
||||
public List<RepairStatisticsVO> ticketStatusCount() {
|
||||
return statisticsMapper.ticketStatusCount();
|
||||
}
|
||||
|
||||
/**
|
||||
* 今日工单
|
||||
*
|
||||
* @return java.util.List<com.alibaba.fastjson.JSONObject>
|
||||
* @author PQZ
|
||||
* @date 13:25 2024/10/21
|
||||
**/
|
||||
@Override
|
||||
public List<DlRepairTicketsRespVO> listTicketToday() {
|
||||
return statisticsMapper.listTicketToday();
|
||||
}
|
||||
|
||||
/**
|
||||
* 维修工人排行
|
||||
*
|
||||
* @return java.util.List<com.alibaba.fastjson.JSONObject>
|
||||
* @author PQZ
|
||||
* @date 13:26 2024/10/21
|
||||
**/
|
||||
@Override
|
||||
public List<RepairStatisticsVO> listWorks() {
|
||||
return statisticsMapper.listWorks();
|
||||
}
|
||||
}
|
@ -0,0 +1,13 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "数据统计VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class RepairStatisticsVO {
|
||||
String name;
|
||||
Integer value;
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package cn.iocoder.yudao.module.base.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.Data;
|
||||
import lombok.ToString;
|
||||
|
||||
@Schema(description = "数据统计VO")
|
||||
@Data
|
||||
@ToString(callSuper = true)
|
||||
public class RepairTicketStatisticsVO {
|
||||
/**工单总数量*/
|
||||
Integer totalCount;
|
||||
/**工单总金额*/
|
||||
Double totalAmount;
|
||||
/**工单今日数量*/
|
||||
Integer todayCount;
|
||||
/**工单今日金额*/
|
||||
Double todayAmount;
|
||||
|
||||
}
|
@ -19,7 +19,9 @@ import org.springframework.validation.annotation.Validated;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
@ -86,7 +88,7 @@ public class RepairProjectServiceImpl extends ServiceImpl<RepairProjectMapper, R
|
||||
**/
|
||||
@Override
|
||||
public IPage<RepairProjectRespVO> queryListPage(RepairProjectPageReqVO pageReqVO, Page<RepairProjectRespVO> page) {
|
||||
return repairProjectMapper.selectListPage(pageReqVO,page);
|
||||
return repairProjectMapper.selectListPage(pageReqVO, page);
|
||||
}
|
||||
|
||||
/**
|
||||
@ -97,28 +99,29 @@ public class RepairProjectServiceImpl extends ServiceImpl<RepairProjectMapper, R
|
||||
@Override
|
||||
public List<RepairProjectAppvo> getRepairProjectAndCateGory() {
|
||||
List<RepairProjectAppvo> repairProjectAppvos = repairProjectMapper.selectProjectAndCateGory();
|
||||
// 提取并去重 typeId
|
||||
List<String> uniqueTypeIds = repairProjectAppvos.stream()
|
||||
.map(RepairProjectAppvo::getTypeId)
|
||||
.distinct()
|
||||
.collect(Collectors.toList());
|
||||
List<RepairProjectAppvo> list = new ArrayList<>();
|
||||
for (String uniqueTypeId : uniqueTypeIds) {
|
||||
RepairProjectAppvo repairProjectAppvo = new RepairProjectAppvo();
|
||||
repairProjectAppvo.setTypeId(uniqueTypeId);
|
||||
if (ObjectUtil.isNotEmpty(uniqueTypeId)) {
|
||||
List<RepairProjectAppvo> filteredList = repairProjectAppvos.stream()
|
||||
.filter(appvo -> uniqueTypeId.equals(appvo.getTypeId()))
|
||||
.collect(Collectors.toList());
|
||||
if (CollectionUtil.isNotEmpty(filteredList)) {
|
||||
repairProjectAppvo.setTypeName(filteredList.get(0).getTypeName());
|
||||
repairProjectAppvo.setGroupList(BeanUtil.copyToList(filteredList, RepairProject.class));
|
||||
}
|
||||
|
||||
// 使用 LinkedHashMap 按 typeId 分组,排除 typeId 为 null 的条目
|
||||
Map<String, List<RepairProjectAppvo>> groupedByTypeId = new LinkedHashMap<>();
|
||||
for (RepairProjectAppvo appvo : repairProjectAppvos) {
|
||||
if (ObjectUtil.isNotEmpty(appvo.getTypeId())) {
|
||||
groupedByTypeId.computeIfAbsent(appvo.getTypeId(), k -> new ArrayList<>()).add(appvo);
|
||||
}
|
||||
list.add(repairProjectAppvo);
|
||||
}
|
||||
return list;
|
||||
|
||||
// 创建结果列表
|
||||
List<RepairProjectAppvo> resultList = new ArrayList<>();
|
||||
for (Map.Entry<String, List<RepairProjectAppvo>> entry : groupedByTypeId.entrySet()) {
|
||||
RepairProjectAppvo repairProjectAppvo = new RepairProjectAppvo();
|
||||
repairProjectAppvo.setTypeId(entry.getKey());
|
||||
List<RepairProjectAppvo> filteredList = entry.getValue();
|
||||
repairProjectAppvo.setTypeName(filteredList.get(0).getTypeName());
|
||||
|
||||
// 只在最后一次调用 copyToList
|
||||
repairProjectAppvo.setGroupList(BeanUtil.copyToList(filteredList, RepairProject.class));
|
||||
resultList.add(repairProjectAppvo);
|
||||
}
|
||||
|
||||
return resultList;
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
@ -45,8 +45,7 @@ public class DlRepairTicketsController {
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "维修工单表 新增")
|
||||
public CommonResult<?> createTicket(@RequestBody DlRepairTicketsRespVO ticketsRespVO) {
|
||||
dlRepairTicketsService.createTickets(ticketsRespVO);
|
||||
return CommonResult.ok();
|
||||
return CommonResult.success(dlRepairTicketsService.createTickets(ticketsRespVO));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -7,10 +7,7 @@ import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemReqVO;
|
||||
import cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
@ -23,7 +20,7 @@ import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
* @date 18:21 2024/9/13
|
||||
**/
|
||||
@RestController
|
||||
@RequestMapping("/repair/titem")
|
||||
@RequestMapping("/repair/titem")
|
||||
public class DlRepairTitemController {
|
||||
/**
|
||||
* 服务对象
|
||||
@ -61,5 +58,16 @@ public class DlRepairTitemController {
|
||||
public CommonResult<?> getProjectList(@RequestParam("ticketId") String ticketId){
|
||||
return success(dlRepairTitemService.getProjectList(ticketId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改维修工单子表的维修人员和销售人员信息(app)
|
||||
* @param dlRepairTitemReqVO
|
||||
* @return
|
||||
*/
|
||||
@PutMapping("/updateRepairAndSale")
|
||||
@Operation(summary = "修改维修工单子表的维修人员和销售人员信息")
|
||||
public CommonResult<?> updateRepairAndSale(@RequestBody DlRepairTitemReqVO dlRepairTitemReqVO){
|
||||
return success(dlRepairTitemService.updateRepairAndSale(dlRepairTitemReqVO));
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -25,6 +25,12 @@ public interface DlRepairTitemMapper extends BaseMapper<DlRepairTitem> {
|
||||
* @param repairTitemRespVO 查询对象
|
||||
**/
|
||||
IPage<DlRepairTitemRespVO> getTItemPage(@Param("map") DlRepairTitemRespVO repairTitemRespVO, Page<DlRepairTitemRespVO> page);
|
||||
|
||||
/**
|
||||
* 更新工单子表中维修人员、销售人员信息(app)
|
||||
* @param dlRepairTitem
|
||||
*/
|
||||
void updateRepairAndSale(DlRepairTitem dlRepairTitem);
|
||||
}
|
||||
|
||||
|
||||
|
@ -25,7 +25,7 @@ public interface DlRepairTicketsService extends IService<DlRepairTickets> {
|
||||
* @author 小李
|
||||
* @date 11:33 2024/9/20
|
||||
**/
|
||||
void createTickets(DlRepairTicketsRespVO ticketsRespVO);
|
||||
DlRepairTicketsRespVO createTickets(DlRepairTicketsRespVO ticketsRespVO);
|
||||
|
||||
/**
|
||||
* 维修工单表 分页
|
||||
|
@ -34,4 +34,11 @@ public interface DlRepairTitemService extends IService<DlRepairTitem> {
|
||||
**/
|
||||
List<DlRepairTitem> getProjectList(String ticketId);
|
||||
|
||||
/**
|
||||
* 更新工单子表中维修人员、销售人员信息(app)
|
||||
* @param dlRepairTitem
|
||||
* @return
|
||||
*/
|
||||
DlRepairTitem updateRepairAndSale(DlRepairTitem dlRepairTitem);
|
||||
|
||||
}
|
||||
|
@ -155,7 +155,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
**/
|
||||
@Override
|
||||
@DSTransactional
|
||||
public void createTickets(DlRepairTicketsRespVO ticketsRespVO) {
|
||||
public DlRepairTicketsRespVO createTickets(DlRepairTicketsRespVO ticketsRespVO) {
|
||||
|
||||
// 门店信息
|
||||
Long deptId = SecurityFrameworkUtils.getLoginUserDeptId();
|
||||
@ -232,6 +232,7 @@ public class DlRepairTicketsServiceImpl extends ServiceImpl<DlRepairTicketsMappe
|
||||
repairOrderInfoService.saveOrderInfo(repairOrderInfo);
|
||||
//最后记录操作日志--创建工单
|
||||
repairRecordsService.saveRepairRecord(ticketsRespVO.getId(),null, RecordTypeEnum.CJGD.getCode(),"创建工单",null);
|
||||
return ticketsRespVO;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -48,6 +48,18 @@ public class DlRepairTitemServiceImpl extends ServiceImpl<DlRepairTitemMapper, D
|
||||
.eq(DlRepairTitem::getTicketId, ticketId);
|
||||
}));
|
||||
}
|
||||
|
||||
/**
|
||||
* 更新工单子表中维修人员、销售人员信息(app)
|
||||
*
|
||||
* @param dlRepairTitem
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public DlRepairTitem updateRepairAndSale(DlRepairTitem dlRepairTitem) {
|
||||
baseMapper.updateRepairAndSale(dlRepairTitem);
|
||||
return dlRepairTitem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@ -0,0 +1,126 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.base.mapper.RepairStatisticsMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
<select id="customerSource" resultType="cn.iocoder.yudao.module.base.vo.RepairStatisticsVO">
|
||||
SELECT
|
||||
COALESCE(sdd.label, '未知') AS name,
|
||||
COUNT(bcm.id) AS vale
|
||||
FROM
|
||||
base_customer_main bcm
|
||||
LEFT JOIN system_dict_data sdd ON bcm.data_from = sdd.value AND sdd.dict_type = 'cus_data_from' AND sdd.deleted = 0
|
||||
WHERE
|
||||
bcm.deleted = 0
|
||||
GROUP BY
|
||||
bcm.data_from
|
||||
ORDER BY
|
||||
bcm.create_time
|
||||
</select>
|
||||
<select id="ticketCountTrend" resultType="cn.iocoder.yudao.module.base.vo.RepairStatisticsVO">
|
||||
SELECT
|
||||
DATE_FORMAT(create_time, '%Y-%m') AS name,
|
||||
COUNT(*) AS value
|
||||
FROM
|
||||
dl_repair_tickets
|
||||
WHERE
|
||||
create_time >= DATE_SUB(CURDATE(), INTERVAL 12 MONTH)
|
||||
GROUP BY
|
||||
name
|
||||
ORDER BY
|
||||
name
|
||||
</select>
|
||||
<select id="ticketAmountTrend" resultType="cn.iocoder.yudao.module.base.vo.RepairStatisticsVO">
|
||||
SELECT
|
||||
DATE_FORMAT(create_time, '%Y-%m') AS name,
|
||||
SUM(total_price) AS value
|
||||
FROM
|
||||
dl_repair_tickets
|
||||
WHERE
|
||||
create_time >= DATE_SUB(CURDATE(), INTERVAL 12 MONTH)
|
||||
GROUP BY
|
||||
name
|
||||
ORDER BY
|
||||
name
|
||||
</select>
|
||||
<select id="paymentWay" resultType="cn.iocoder.yudao.module.base.vo.RepairStatisticsVO">
|
||||
SELECT
|
||||
COALESCE(sdd.label, '未知') AS name,
|
||||
COUNT(roi.id)
|
||||
FROM
|
||||
repair_order_info roi
|
||||
LEFT JOIN system_dict_data sdd ON roi.pay_type = sdd.value AND sdd.dict_type = 'repair_pay_type' AND sdd.deleted = 0
|
||||
WHERE
|
||||
roi.deleted = 0
|
||||
GROUP BY roi.pay_type
|
||||
ORDER BY roi.create_time
|
||||
</select>
|
||||
<select id="repairTypeStatistics" resultType="cn.iocoder.yudao.module.base.vo.RepairStatisticsVO">
|
||||
SELECT
|
||||
COALESCE(sdd.label, '未知') AS `name`,
|
||||
COUNT( drt.id ) AS `value`
|
||||
FROM
|
||||
dl_repair_tickets drt
|
||||
LEFT JOIN system_dict_data sdd ON drt.repair_type = sdd.value AND sdd.dict_type = 'repair_type' AND sdd.deleted = 0
|
||||
WHERE
|
||||
drt.deleted = 0
|
||||
GROUP BY
|
||||
drt.repair_type
|
||||
ORDER BY
|
||||
drt.create_time
|
||||
</select>
|
||||
<select id="ticketStatistics" resultType="cn.iocoder.yudao.module.base.vo.RepairTicketStatisticsVO">
|
||||
SELECT
|
||||
COUNT( drt.id ) AS totalCount,
|
||||
SUM( drt.total_price ) AS totalAmount,
|
||||
COUNT( CASE WHEN DATE ( drt.create_time ) = CURDATE() THEN 1 END ) AS todayCount,
|
||||
SUM( CASE WHEN DATE ( drt.create_time ) = CURDATE() THEN drt.total_price ELSE 0 END ) AS todayAmount
|
||||
FROM
|
||||
dl_repair_tickets drt
|
||||
WHERE
|
||||
drt.deleted = 0
|
||||
</select>
|
||||
<select id="ticketStatusCount" resultType="cn.iocoder.yudao.module.base.vo.RepairStatisticsVO">
|
||||
SELECT
|
||||
sdd.label AS `name`,
|
||||
COUNT(drt.id) AS `value`
|
||||
FROM
|
||||
system_dict_data sdd
|
||||
LEFT JOIN
|
||||
dl_repair_tickets drt ON drt.tickets_status = sdd.`value`
|
||||
WHERE
|
||||
sdd.dict_type = 'repair_tickets_status'
|
||||
AND sdd.deleted = 0
|
||||
GROUP BY
|
||||
sdd.value
|
||||
ORDER BY
|
||||
sdd.value
|
||||
</select>
|
||||
<select id="listTicketToday" resultType="cn.iocoder.yudao.module.tickets.vo.DlRepairTicketsRespVO">
|
||||
SELECT
|
||||
drt.*
|
||||
FROM
|
||||
dl_repair_tickets drt
|
||||
WHERE
|
||||
drt.deleted = 0
|
||||
AND DATE ( drt.create_time ) = CURDATE()
|
||||
ORDER BY
|
||||
drt.create_time DESC
|
||||
</select>
|
||||
<select id="listWorks" resultType="cn.iocoder.yudao.module.base.vo.RepairStatisticsVO">
|
||||
SELECT
|
||||
drw.user_name AS `name`,
|
||||
COUNT(drr.id) AS `value`
|
||||
FROM
|
||||
dl_repair_worker drw
|
||||
LEFT JOIN dl_repair_records drr ON drw.user_id = drr.deal_user_id AND drr.deleted = 0
|
||||
WHERE drr.type = 'sgwczj'
|
||||
GROUP BY drw.user_id,drr.ticket_id
|
||||
ORDER BY value DESC
|
||||
</select>
|
||||
</mapper>
|
@ -3,7 +3,27 @@
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.iocoder.yudao.module.tickets.mapper.DlRepairTitemMapper">
|
||||
<select id="getTItemPage" resultType="cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO">
|
||||
<update id="updateRepairAndSale" parameterType="cn.iocoder.yudao.module.tickets.entity.DlRepairTitem">
|
||||
UPDATE dl_repair_titem
|
||||
<set>
|
||||
<if test="repairIds != null">
|
||||
repair_ids = #{repairIds},
|
||||
</if>
|
||||
<if test="repairNames != null">
|
||||
repair_names = #{repairNames},
|
||||
</if>
|
||||
<if test="saleId != null">
|
||||
sale_id = #{saleId},
|
||||
</if>
|
||||
<if test="saleName != null">
|
||||
sale_name = #{saleName},
|
||||
</if>
|
||||
</set>
|
||||
WHERE ticket_id = #{ticketId}
|
||||
</update>
|
||||
|
||||
|
||||
<select id="getTItemPage" resultType="cn.iocoder.yudao.module.tickets.vo.DlRepairTitemRespVO">
|
||||
SELECT drti.id,
|
||||
drti.ticket_id,
|
||||
drti.item_name,
|
||||
|
Loading…
Reference in New Issue
Block a user