0805
This commit is contained in:
parent
a643e50a5a
commit
f0a5d5ad47
@ -14,6 +14,8 @@ public enum InspectionFileEnum {
|
||||
FILE("equipment", "设备文件夹"),
|
||||
COACH("coach", "驾校员工文件夹"),
|
||||
student("student","驾校学员文件夹"),
|
||||
WX_EQUIPMENT("wx_equipment","维修设备文件夹"),
|
||||
JY_EQUIPMENT("jy_equipment","救援设备文件夹"),
|
||||
INSPECTION_CUSTOMER("small_inspection_member_folder", "检测客户资料夹"),
|
||||
;
|
||||
|
||||
|
@ -174,6 +174,11 @@ public class InspectionEquInfoController extends BaseController {
|
||||
return success(inspectionEquInfoService.addFolder(id));
|
||||
}
|
||||
|
||||
@PostMapping("/addDeviceFolder")
|
||||
public CommonResult<?> addDeviceFolder(@RequestParam Long id, @RequestParam String servicePackageId, @RequestParam String defaultKey) {
|
||||
return success(inspectionEquInfoService.addDeviceFolder(id, servicePackageId, defaultKey));
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询设备数量根据分类
|
||||
*
|
||||
@ -184,4 +189,9 @@ public class InspectionEquInfoController extends BaseController {
|
||||
return success(inspectionEquInfoService.queryEquipmentCountByCategory());
|
||||
}
|
||||
|
||||
@GetMapping("/queryEquipmentCountByPackageId")
|
||||
public CommonResult<?> queryEquipmentCountByPackageId(@RequestParam String servicePackageId, @RequestParam String dictType) {
|
||||
return success(inspectionEquInfoService.queryEquipmentCountByPackageId(servicePackageId, dictType));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -96,4 +96,7 @@ public class InspectionEquInfo extends TenantBaseDO
|
||||
@TableField(exist = false)
|
||||
private List<FileDO> fileList;
|
||||
|
||||
/** 服务套餐id */
|
||||
private String servicePackageId;
|
||||
|
||||
}
|
||||
|
@ -36,4 +36,5 @@ public interface InspectionEquInfoMapper extends BaseMapper<InspectionEquInfo>
|
||||
public IPage<InspectionEquInfo> selectInspectionEquInfoList(Page page, @Param("inspectionEquInfo") InspectionEquInfo inspectionEquInfo);
|
||||
|
||||
List<EquipmentCountVo> queryEquipmentCountByCategory();
|
||||
List<EquipmentCountVo> queryEquipmentCountByPackageId(@Param("servicePackageId") String servicePackageId, @Param("dictType") String dictType);
|
||||
}
|
||||
|
@ -80,6 +80,7 @@ public interface IInspectionEquInfoService extends IService<InspectionEquInfo> {
|
||||
* @return 文件夹id
|
||||
*/
|
||||
Long addFolder(Long id);
|
||||
Long addDeviceFolder(Long id, String servicePackageId, String defaultKey);
|
||||
|
||||
/**
|
||||
* 查询设备统计信息
|
||||
@ -87,4 +88,5 @@ public interface IInspectionEquInfoService extends IService<InspectionEquInfo> {
|
||||
* @return
|
||||
*/
|
||||
List<EquipmentCountVo> queryEquipmentCountByCategory();
|
||||
List<EquipmentCountVo> queryEquipmentCountByPackageId(String servicePackageId, String dictType);
|
||||
}
|
||||
|
@ -115,6 +115,7 @@ public interface IInspectionFileService extends IService<InspectionFile> {
|
||||
* @return 文件夹id
|
||||
*/
|
||||
Long addFolder(String folderName, String key);
|
||||
Long addFolderForDevice(String folderName, String key, String servicePackageId);
|
||||
Long addFolderForJx(String folderName, String key);
|
||||
Long addFolderForJy(String folderName, String key);
|
||||
|
||||
|
@ -210,6 +210,18 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long addDeviceFolder(Long id, String servicePackageId, String defaultKey) {
|
||||
InspectionEquInfo inspectionEquInfo = this.getById(id);
|
||||
if (ObjectUtil.isNotEmpty(inspectionEquInfo)) {
|
||||
Long folderId = inspectionFileService.addFolderForDevice(inspectionEquInfo.getEquName(), defaultKey, servicePackageId);
|
||||
//修改文件夹id
|
||||
this.update(Wrappers.<InspectionEquInfo>lambdaUpdate().eq(InspectionEquInfo::getId, id).set(InspectionEquInfo::getFolderId, folderId));
|
||||
return folderId;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加设备文件夹
|
||||
*
|
||||
@ -238,6 +250,11 @@ public class InspectionEquInfoServiceImpl extends ServiceImpl<InspectionEquInfoM
|
||||
return baseMapper.queryEquipmentCountByCategory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<EquipmentCountVo> queryEquipmentCountByPackageId(String servicePackageId, String dictType) {
|
||||
return baseMapper.queryEquipmentCountByPackageId(servicePackageId, dictType);
|
||||
}
|
||||
|
||||
/**
|
||||
* 保存导入的设备信息
|
||||
*
|
||||
|
@ -498,6 +498,36 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
|
||||
return resultFiles;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long addFolderForDevice(String folderName, String key, String servicePackageId) {
|
||||
//根据key找到对应的文件夹id
|
||||
InspectionFile fatherFolder = baseMapper.selectOne(new LambdaQueryWrapper<InspectionFile>().eq(InspectionFile::getDefaultKey, key));
|
||||
|
||||
//如果默认文件夹为空就新建
|
||||
if (fatherFolder == null) {
|
||||
fatherFolder = new InspectionFile();
|
||||
fatherFolder.setFileName(InspectionFileEnum.getDescByType(key));
|
||||
fatherFolder.setType(InspectionConstants.INSPECTION_FOLDER);
|
||||
fatherFolder.setDefaultKey(key);
|
||||
fatherFolder.setServicePackageId(servicePackageId);
|
||||
baseMapper.insert(fatherFolder);
|
||||
fatherFolder.setFileCode(fatherFolder.getId() + ",");
|
||||
baseMapper.updateById(fatherFolder);
|
||||
}
|
||||
|
||||
InspectionFile inspectionFile = new InspectionFile();
|
||||
inspectionFile.setFatherId(fatherFolder.getId());
|
||||
inspectionFile.setFileName(folderName + InspectionConstants.INSPECTION_FOLDER_SUFFIX);
|
||||
inspectionFile.setType(InspectionConstants.INSPECTION_FOLDER);
|
||||
inspectionFile.setIsStaffFile(InspectionConstants.INSPECTION_IS_STAFF_FILE);
|
||||
inspectionFile.setServicePackageId(servicePackageId);
|
||||
baseMapper.insert(inspectionFile);
|
||||
inspectionFile.setFileCode(inspectionFile.getId() + ",");
|
||||
baseMapper.updateById(inspectionFile);
|
||||
|
||||
return inspectionFile.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件夹
|
||||
*
|
||||
|
@ -27,6 +27,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
<if test="inspectionEquInfo.type != null and inspectionEquInfo.type != ''">
|
||||
and `type` = #{inspectionEquInfo.type}
|
||||
</if>
|
||||
<if test="inspectionEquInfo.servicePackageId != null and inspectionEquInfo.servicePackageId != ''">
|
||||
and service_package_id = #{inspectionEquInfo.servicePackageId}
|
||||
</if>
|
||||
</where>
|
||||
</select>
|
||||
|
||||
@ -48,4 +51,17 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
GROUP BY sd.value, sd.label;
|
||||
</select>
|
||||
|
||||
<select id="queryEquipmentCountByPackageId" resultType="cn.iocoder.yudao.module.inspection.vo.EquipmentCountVo">
|
||||
SELECT
|
||||
sd.value AS categoryId,
|
||||
COUNT(iei.id) AS count,
|
||||
sd.label AS categoryName
|
||||
FROM system_dict_data sd
|
||||
LEFT JOIN inspection_equ_info iei
|
||||
ON iei.type = sd.value AND iei.deleted = 0 AND iei.service_package_id = #{servicePackageId}
|
||||
WHERE sd.dict_type = #{dictType}
|
||||
AND sd.deleted = 0
|
||||
GROUP BY sd.value, sd.label;
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
@ -112,8 +112,8 @@ public class TrainController {
|
||||
@RequestParam(value = "sort",required = false) String sort,
|
||||
@RequestParam(value = "startTime",required = false) String startTime,
|
||||
@RequestParam(value = "endTime",required = false) String endTime,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize) {
|
||||
//默认查全部数据
|
||||
String startTimeStr = "";
|
||||
String endTimeStr = "";
|
||||
@ -304,7 +304,7 @@ public class TrainController {
|
||||
* 当日正在训练学员统计
|
||||
*/
|
||||
@GetMapping("getTodayTrainSituation")
|
||||
public CommonResult<CloakAndTrainCountVO> getTodayTrainSituation(Train train){
|
||||
public CommonResult<CloakAndTrainCountVO> getTodayTrainSituation(TodayTrainVO train){
|
||||
return success(trainService.getTodayTrainSituation(train));
|
||||
}
|
||||
|
||||
@ -312,10 +312,10 @@ public class TrainController {
|
||||
* 获取当前正在训练的学员列表
|
||||
*/
|
||||
@GetMapping("getTodayStudentTrainSituation")
|
||||
public CommonResult<IPage<Train>> getTodayStudentTrainSituation(Train train,
|
||||
@RequestParam(name = "pageNo", defaultValue = "1") Integer pageNo,
|
||||
public CommonResult<IPage<TodayTrainVO>> getTodayStudentTrainSituation(TodayTrainVO train,
|
||||
@RequestParam(name = "pageNum", defaultValue = "1") Integer pageNum,
|
||||
@RequestParam(name = "pageSize", defaultValue = "10") Integer pageSize){
|
||||
Page<Train> page = new Page<>(pageNo, pageSize);
|
||||
Page<TodayTrainVO> page = new Page<>(pageNum, pageSize);
|
||||
return success(trainService.getTodayStudentTrainSituation(train,page));
|
||||
}
|
||||
}
|
||||
|
@ -44,10 +44,10 @@ public interface TrainMapper extends BaseMapper<Train> {
|
||||
/**
|
||||
* 获取当日实时训练情况
|
||||
*/
|
||||
CloakAndTrainCountVO getTodayTrainSituation(@Param("entity") Train train);
|
||||
CloakAndTrainCountVO getTodayTrainSituation(@Param("entity") TodayTrainVO train);
|
||||
/**
|
||||
* 获取正在训练的学员信息
|
||||
*/
|
||||
IPage<Train> getTodayStudentTrainSituation(@Param("entity") Train train, Page<Train> page);
|
||||
IPage<TodayTrainVO> getTodayStudentTrainSituation(@Param("entity") TodayTrainVO train, Page<TodayTrainVO> page);
|
||||
|
||||
}
|
||||
|
@ -2,10 +2,7 @@ package cn.iocoder.yudao.module.train.service;
|
||||
|
||||
import cn.iocoder.yudao.module.course.vo.CommissionExportVO;
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.vo.CloakAndTrainCountVO;
|
||||
import cn.iocoder.yudao.module.train.vo.NoClockInRemindVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainExportVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import cn.iocoder.yudao.module.train.vo.*;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
@ -118,10 +115,10 @@ public interface TrainService extends IService<Train> {
|
||||
/**
|
||||
* 当日正在训练学员统计
|
||||
*/
|
||||
CloakAndTrainCountVO getTodayTrainSituation(Train train);
|
||||
CloakAndTrainCountVO getTodayTrainSituation(TodayTrainVO train);
|
||||
|
||||
/**
|
||||
* 获取当前正在训练的学员信息列表
|
||||
*/
|
||||
IPage<Train> getTodayStudentTrainSituation(Train train, Page<Train> page);
|
||||
IPage<TodayTrainVO> getTodayStudentTrainSituation(TodayTrainVO train, Page<TodayTrainVO> page);
|
||||
}
|
||||
|
@ -11,10 +11,7 @@ import cn.iocoder.yudao.module.course.vo.CommissionExportVO;
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import cn.iocoder.yudao.module.train.mapper.TrainMapper;
|
||||
import cn.iocoder.yudao.module.train.service.TrainService;
|
||||
import cn.iocoder.yudao.module.train.vo.CloakAndTrainCountVO;
|
||||
import cn.iocoder.yudao.module.train.vo.NoClockInRemindVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainExportVO;
|
||||
import cn.iocoder.yudao.module.train.vo.TrainVO;
|
||||
import cn.iocoder.yudao.module.train.vo.*;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
@ -258,7 +255,7 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
||||
* 当日正在训练学员统计
|
||||
*/
|
||||
@Override
|
||||
public CloakAndTrainCountVO getTodayTrainSituation(Train train) {
|
||||
public CloakAndTrainCountVO getTodayTrainSituation(TodayTrainVO train) {
|
||||
return trainMapper.getTodayTrainSituation(train);
|
||||
}
|
||||
|
||||
@ -266,7 +263,7 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
||||
* 获取当前正在训练的学员信息列表
|
||||
*/
|
||||
@Override
|
||||
public IPage<Train> getTodayStudentTrainSituation(Train train, Page<Train> page) {
|
||||
public IPage<TodayTrainVO> getTodayStudentTrainSituation(TodayTrainVO train, Page<TodayTrainVO> page) {
|
||||
return trainMapper.getTodayStudentTrainSituation(train, page);
|
||||
}
|
||||
|
||||
|
@ -0,0 +1,11 @@
|
||||
package cn.iocoder.yudao.module.train.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.train.entity.Train;
|
||||
import lombok.Data;
|
||||
|
||||
@Data
|
||||
public class TodayTrainVO extends Train {
|
||||
|
||||
// 课程类型
|
||||
private String courseType;
|
||||
}
|
@ -213,38 +213,46 @@
|
||||
<select id="getTodayTrainSituation" resultType="cn.iocoder.yudao.module.train.vo.CloakAndTrainCountVO">
|
||||
SELECT
|
||||
COALESCE ( COUNT(*), 0 ) AS totalStudentCount,
|
||||
COALESCE ( SUM( CASE WHEN SUBJECT = 2 THEN 1 ELSE 0 END ), 0 ) AS subject2StudentCount,
|
||||
COALESCE ( SUM( CASE WHEN SUBJECT = 3 THEN 1 ELSE 0 END ), 0 ) AS subject3StudentCount
|
||||
COALESCE ( SUM( CASE WHEN dst.subject = 2 THEN 1 ELSE 0 END ), 0 ) AS subject2StudentCount,
|
||||
COALESCE ( SUM( CASE WHEN dst.subject = 3 THEN 1 ELSE 0 END ), 0 ) AS subject3StudentCount
|
||||
FROM
|
||||
drive_school_train
|
||||
drive_school_train dst
|
||||
LEFT JOIN drive_school_course dsc ON dst.course_id = dsc.id AND dsc.deleted = 0
|
||||
WHERE
|
||||
DATE ( create_time ) = CURDATE()
|
||||
AND DATE ( start_time ) = CURDATE()
|
||||
AND end_time IS NULL
|
||||
AND user_id IS NOT NULL
|
||||
AND deleted = 0
|
||||
DATE ( dst.create_time ) = CURDATE()
|
||||
AND DATE ( dst.start_time ) = CURDATE()
|
||||
AND dst.end_time IS NULL
|
||||
AND dst.user_id IS NOT NULL
|
||||
AND dst.deleted = 0
|
||||
<if test="entity.userName != null and entity.userName != '' ">
|
||||
AND user_name like concat('%',#{entity.userName},'%')
|
||||
AND dst.user_name like concat('%',#{entity.userName},'%')
|
||||
</if>
|
||||
<if test="entity.subject != null">
|
||||
AND subject = #{entity.subject}
|
||||
AND dst.subject = #{entity.subject}
|
||||
</if>
|
||||
<if test="entity.courseType != null and entity.courseType != ''">
|
||||
AND dsc.type = #{entity.courseType}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getTodayStudentTrainSituation" resultType="cn.iocoder.yudao.module.train.entity.Train">
|
||||
SELECT *
|
||||
FROM drive_school_train
|
||||
<select id="getTodayStudentTrainSituation" resultType="cn.iocoder.yudao.module.train.vo.TodayTrainVO">
|
||||
SELECT dst.*
|
||||
FROM drive_school_train dst
|
||||
LEFT JOIN drive_school_course dsc ON dst.course_id = dsc.id AND dsc.deleted = 0
|
||||
WHERE
|
||||
DATE (create_time) = CURDATE()
|
||||
AND DATE (start_time) = CURDATE()
|
||||
AND end_time IS NULL
|
||||
AND user_id IS NOT NULL
|
||||
AND deleted = 0
|
||||
DATE (dst.create_time) = CURDATE()
|
||||
AND DATE (dst.start_time) = CURDATE()
|
||||
AND dst.end_time IS NULL
|
||||
AND dst.user_id IS NOT NULL
|
||||
AND dst.deleted = 0
|
||||
<if test="entity.userName != null and entity.userName != ''">
|
||||
AND user_name like concat('%',#{entity.userName},'%')
|
||||
AND dst.user_name like concat('%',#{entity.userName},'%')
|
||||
</if>
|
||||
<if test="entity.subject != null">
|
||||
AND subject = #{entity.subject}
|
||||
AND dst.subject = #{entity.subject}
|
||||
</if>
|
||||
<if test="entity.courseType != null and entity.courseType != ''">
|
||||
AND dsc.type = #{entity.courseType}
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
Loading…
Reference in New Issue
Block a user