0731
This commit is contained in:
parent
ab23a15a0a
commit
1a16ec9015
@ -234,7 +234,7 @@ public class WorkReportServiceImpl extends ServiceImpl<WorkReportMapper, WorkRep
|
||||
WorkReportPageReqVO pageReqVO = new WorkReportPageReqVO();
|
||||
pageReqVO.setId(id);
|
||||
WorkReportRespVO workReport = reportMapper.selectByIdOne(pageReqVO);
|
||||
List<Long> userIds = Arrays.stream(workReport.getReportTo().split(",")).map(Long::parseLong) // 转换为 Long 类型
|
||||
List<Long> userIds = Arrays.stream(workReport.getReportTo().split(",")).map(Long::parseLong)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
List<AdminUserDO> userList = adminUserService.getUserList(userIds);
|
||||
|
@ -50,6 +50,11 @@ public class InspectionConstants {
|
||||
*/
|
||||
public static final String DRIVE_SCHOOL_STAFF_KEY = "coach";
|
||||
|
||||
/**
|
||||
* key的类型为员工
|
||||
*/
|
||||
public static final String JY_DRIVER_STAFF_KEY = "jystaff";
|
||||
|
||||
/**
|
||||
* key的类型为设备
|
||||
*/
|
||||
|
@ -116,6 +116,7 @@ public interface IInspectionFileService extends IService<InspectionFile> {
|
||||
*/
|
||||
Long addFolder(String folderName, String key);
|
||||
Long addFolderForJx(String folderName, String key);
|
||||
Long addFolderForJy(String folderName, String key);
|
||||
|
||||
/**
|
||||
* 查询文件夹树
|
||||
|
@ -559,6 +559,36 @@ public class InspectionFileServiceImpl extends ServiceImpl<InspectionFileMapper,
|
||||
return inspectionFile.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Long addFolderForJy(String folderName, String key) {
|
||||
//根据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("jiuyuan");
|
||||
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("jiuyuan");
|
||||
baseMapper.insert(inspectionFile);
|
||||
inspectionFile.setFileCode(inspectionFile.getId() + ",");
|
||||
baseMapper.updateById(inspectionFile);
|
||||
|
||||
return inspectionFile.getId();
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询文件夹树
|
||||
*
|
||||
|
@ -49,9 +49,9 @@ public class DriveSchoolCoachClockController {
|
||||
* 查询今天未离场的打卡记录
|
||||
*/
|
||||
@GetMapping("selectTodayClockRecord")
|
||||
public CommonResult<DriveSchoolCoachClock> selectTodayClockRecord() {
|
||||
public CommonResult<DriveSchoolCoachClock> selectTodayClockRecord(String carNo) {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
DriveSchoolCoachClock driveSchoolCoachClock = coachClockService.selectTodayClockRecord(userId);
|
||||
DriveSchoolCoachClock driveSchoolCoachClock = coachClockService.selectTodayClockRecord(userId,carNo);
|
||||
return success(driveSchoolCoachClock);
|
||||
}
|
||||
|
||||
@ -191,5 +191,22 @@ public class DriveSchoolCoachClockController {
|
||||
return success(coachClockService.getTodayCarTrainSituation(driveSchoolCoachClock));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据教练id查询当日打卡记录的车牌号列表
|
||||
*/
|
||||
@GetMapping("/getClockCarNoByUserId")
|
||||
public CommonResult<List<String>> getClockCarNoByUserId() {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
return success(coachClockService.getClockCarNoByUserId(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据教练id查询当日打卡记录的车牌号列表
|
||||
*/
|
||||
@GetMapping("/getClockCarInfoByUserId")
|
||||
public CommonResult<DriveSchoolCoachClock> getClockCarInfoByUserId(String carNo) {
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
return success(coachClockService.getClockCarInfoByUserId(userId, carNo));
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -240,9 +240,9 @@ public class TrainController {
|
||||
}
|
||||
|
||||
@GetMapping("noClockInRemindByUserId")
|
||||
public CommonResult<NoClockInRemindVO>noClockInRemindByUserId(){
|
||||
public CommonResult<NoClockInRemindVO>noClockInRemindByUserId(String carNo){
|
||||
Long userId = SecurityFrameworkUtils.getLoginUserId();
|
||||
return success(trainService.noClockInRemindByUserId(userId));
|
||||
return success(trainService.noClockInRemindByUserId(userId, carNo));
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -57,5 +57,11 @@ public interface DriveSchoolCoachClockMapper extends BaseMapper<DriveSchoolCoach
|
||||
*/
|
||||
List<DriveSchoolCoachClockVO> getTodayCarTrainSituation(@Param("entity") DriveSchoolCoachClock driveSchoolCoachClock);
|
||||
|
||||
/**
|
||||
* 根据教练id查询当日打卡记录的车牌号列表
|
||||
*/
|
||||
List<String> getClockCarNoByUserId(@Param("userId") Long userId);
|
||||
DriveSchoolCoachClock getClockCarInfoByUserId(@Param("userId") Long userId, @Param("carNo") String carNo);
|
||||
|
||||
|
||||
}
|
||||
|
@ -29,7 +29,7 @@ public interface TrainMapper extends BaseMapper<Train> {
|
||||
List<TrainVO> listJoinBatchByIds(@Param("trainIds") List<String> trainIds);
|
||||
|
||||
List<NoClockInRemindVO> noClockInRemind();
|
||||
NoClockInRemindVO noClockInRemindByUserId(Long userId);
|
||||
NoClockInRemindVO noClockInRemindByUserId(@Param("userId")Long userId, @Param("carNo")String carNo);
|
||||
|
||||
/**
|
||||
* 根据教练打卡id获取对应学员信息
|
||||
|
@ -30,7 +30,7 @@ public interface IDriveSchoolCoachClockService extends IService<DriveSchoolCoach
|
||||
/**
|
||||
* 查询今天未离场的打卡记录
|
||||
*/
|
||||
DriveSchoolCoachClock selectTodayClockRecord(Long userId);
|
||||
DriveSchoolCoachClock selectTodayClockRecord(Long userId,String carNo);
|
||||
|
||||
/**
|
||||
* 到场打卡
|
||||
@ -93,4 +93,10 @@ public interface IDriveSchoolCoachClockService extends IService<DriveSchoolCoach
|
||||
*/
|
||||
List<DriveSchoolCoachClockVO> getTodayCarTrainSituation(DriveSchoolCoachClock driveSchoolCoachClock);
|
||||
|
||||
/**
|
||||
* 根据教练id查询当日打卡记录的车牌号列表
|
||||
*/
|
||||
List<String> getClockCarNoByUserId(Long userId);
|
||||
DriveSchoolCoachClock getClockCarInfoByUserId(Long userId, String carNo);
|
||||
|
||||
}
|
||||
|
@ -95,7 +95,7 @@ public interface TrainService extends IService<Train> {
|
||||
*/
|
||||
void noClockInRemind();
|
||||
|
||||
NoClockInRemindVO noClockInRemindByUserId(Long userId);
|
||||
NoClockInRemindVO noClockInRemindByUserId(Long userId, String carNo);
|
||||
|
||||
/**
|
||||
* 根据教练打卡id,获取对应学员列表信息
|
||||
|
@ -88,13 +88,14 @@ public class DriveSchoolCoachClockServiceImpl extends ServiceImpl<DriveSchoolCoa
|
||||
* 查询今天未离场的打卡记录
|
||||
*/
|
||||
@Override
|
||||
public DriveSchoolCoachClock selectTodayClockRecord(Long userId) {
|
||||
public DriveSchoolCoachClock selectTodayClockRecord(Long userId,String carNo) {
|
||||
if (userId == null) {
|
||||
throw new IllegalArgumentException("用户ID不能为空");
|
||||
}
|
||||
List<DriveSchoolCoachClock> clockRecord = driveSchoolCoachClockMapper.selectList(
|
||||
new LambdaQueryWrapper<DriveSchoolCoachClock>()
|
||||
.eq(DriveSchoolCoachClock::getUserId, userId)
|
||||
.eq(DriveSchoolCoachClock::getCarNo,carNo)
|
||||
.eq(DriveSchoolCoachClock::getTrainDay, DateUtil.format(new Date(), "yyyy-MM-dd"))
|
||||
.isNull(DriveSchoolCoachClock::getEndTime)
|
||||
.eq(DriveSchoolCoachClock::getDeleted, 0)
|
||||
@ -452,5 +453,18 @@ public class DriveSchoolCoachClockServiceImpl extends ServiceImpl<DriveSchoolCoa
|
||||
return driveSchoolCoachClockMapper.getTodayCarTrainSituation(driveSchoolCoachClock);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据教练id查询当日打卡记录的车牌号列表
|
||||
*/
|
||||
@Override
|
||||
public List<String> getClockCarNoByUserId(Long userId) {
|
||||
return driveSchoolCoachClockMapper.getClockCarNoByUserId(userId);
|
||||
}
|
||||
|
||||
@Override
|
||||
public DriveSchoolCoachClock getClockCarInfoByUserId(Long userId, String carNo) {
|
||||
return driveSchoolCoachClockMapper.getClockCarInfoByUserId(userId, carNo);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
@ -189,8 +189,8 @@ public class TrainServiceImpl extends ServiceImpl<TrainMapper, Train> implements
|
||||
}
|
||||
|
||||
@Override
|
||||
public NoClockInRemindVO noClockInRemindByUserId(Long userId){
|
||||
return trainMapper.noClockInRemindByUserId(userId);
|
||||
public NoClockInRemindVO noClockInRemindByUserId(Long userId, String carNo){
|
||||
return trainMapper.noClockInRemindByUserId(userId, carNo);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -325,6 +325,23 @@
|
||||
dscc.id
|
||||
</select>
|
||||
|
||||
<select id="getClockCarNoByUserId" resultType="string">
|
||||
SELECT car_No
|
||||
FROM drive_school_coach_clock
|
||||
WHERE user_id = #{userId}
|
||||
AND train_day = CURDATE()
|
||||
AND end_time IS NULL
|
||||
</select>
|
||||
|
||||
<select id="getClockCarInfoByUserId" resultType="cn.iocoder.yudao.module.train.entity.DriveSchoolCoachClock">
|
||||
SELECT *
|
||||
FROM drive_school_coach_clock
|
||||
WHERE user_id = #{userId}
|
||||
AND car_no = #{carNo}
|
||||
AND train_day = CURDATE()
|
||||
AND end_time IS NULL
|
||||
</select>
|
||||
|
||||
<!--<select id="getTodayCarTrainSituation" resultType="cn.iocoder.yudao.module.train.entity.DriveSchoolCoachClock">
|
||||
SELECT *
|
||||
FROM drive_school_coach_clock
|
||||
|
@ -138,6 +138,7 @@
|
||||
FROM drive_school_train
|
||||
WHERE
|
||||
coach_id = #{userId}
|
||||
AND car_no = #{carNo}
|
||||
AND DATE(create_time) = CURDATE()
|
||||
AND DATE(start_time) = CURDATE()
|
||||
AND end_time IS NULL
|
||||
|
@ -43,6 +43,7 @@ import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.iocoder.yudao.framework.common.exception.util.ServiceExceptionUtil.exception0;
|
||||
import static cn.iocoder.yudao.framework.common.pojo.CommonResult.success;
|
||||
|
||||
|
||||
@RestController
|
||||
@ -225,6 +226,28 @@ public class RescueInfoSystem extends BaseController {
|
||||
return CommonResult.success("新增成功");
|
||||
}
|
||||
|
||||
@PostMapping("/addDriverApp")
|
||||
public CommonResult addDriverApp(@RequestBody DriverInfo driverInfo) {
|
||||
Long userId;
|
||||
try {
|
||||
userId = rescueInfoService.addDriverApp(driverInfo);
|
||||
} catch (Exception e) {
|
||||
return CommonResult.error(500, e.getMessage());
|
||||
}
|
||||
|
||||
return CommonResult.success(userId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增文件夹
|
||||
* @param userId 用户id
|
||||
* @return
|
||||
*/
|
||||
@PostMapping("/addFolder")
|
||||
public CommonResult<?> addFolder(@RequestBody Long userId) {
|
||||
return success(rescueInfoService.addFolder(userId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改信息司机
|
||||
*/
|
||||
@ -493,4 +516,13 @@ public class RescueInfoSystem extends BaseController {
|
||||
rescueInfoService.inBase(returnCarVO);
|
||||
return CommonResult.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 员工管理获取救援员工详情
|
||||
*/
|
||||
@GetMapping("/getOnInternal")
|
||||
public CommonResult<?> getOnInternal(Long id) {
|
||||
return success(rescueInfoService.getOnInternal(id));
|
||||
}
|
||||
}
|
||||
|
@ -95,6 +95,6 @@ public class DriverInfo extends TenantBaseDO
|
||||
private long jxNum;
|
||||
@TableField(exist = false)
|
||||
private long wcNum;
|
||||
|
||||
private Long folderId;
|
||||
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
|
||||
import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto;
|
||||
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
|
||||
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
|
||||
import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||
|
||||
@ -87,4 +88,6 @@ public interface RescueInfoMapper extends BaseMapper<RescueInfo>
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> selectRescueOrderByRoad(String dictType);
|
||||
|
||||
DriverStaffSaveVO getOnInternal(Long id);
|
||||
}
|
||||
|
@ -7,6 +7,7 @@ import cn.iocoder.yudao.module.rescue.domain.RescueInfo;
|
||||
import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto;
|
||||
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
|
||||
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
|
||||
import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO;
|
||||
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
|
||||
import cn.iocoder.yudao.module.rescue.vo.ReturnCarVO;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@ -88,6 +89,8 @@ public interface IRescueInfoService extends IService<RescueInfo>
|
||||
IPage<DriverInfo> driverList(DriverInfoDto user, Page<DriverInfo> page);
|
||||
DriverInfo getDriverById(Long driverId);
|
||||
void addDriver(DriverInfo driverInfo) throws Exception;
|
||||
Long addDriverApp(DriverInfo driverInfo) throws Exception;
|
||||
Long addFolder(Long userId);
|
||||
void updateDriver(DriverInfo user);
|
||||
void delDriver(Long[] ids);
|
||||
List<DriverInfo2Dto> driverListApp(DriverInfoDto driverInfoDto);
|
||||
@ -169,4 +172,7 @@ public interface IRescueInfoService extends IService<RescueInfo>
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> getRescueMessage(String startTime, String endTime);
|
||||
|
||||
|
||||
DriverStaffSaveVO getOnInternal(Long id);
|
||||
}
|
||||
|
@ -11,7 +11,10 @@ import cn.iocoder.yudao.framework.tenant.core.aop.TenantIgnore;
|
||||
import cn.iocoder.yudao.framework.tenant.core.db.TenantBaseDO;
|
||||
import cn.iocoder.yudao.module.appBase.domain.SysAnnouncement;
|
||||
import cn.iocoder.yudao.module.appBase.service.ISysAnnouncementService;
|
||||
import cn.iocoder.yudao.module.constant.InspectionConstants;
|
||||
import cn.iocoder.yudao.module.constant.UserConstants;
|
||||
import cn.iocoder.yudao.module.inspection.entity.InspectionFile;
|
||||
import cn.iocoder.yudao.module.inspection.service.IInspectionFileService;
|
||||
import cn.iocoder.yudao.module.rescue.domain.*;
|
||||
import cn.iocoder.yudao.module.rescue.dto.DriverInfo2Dto;
|
||||
import cn.iocoder.yudao.module.rescue.dto.DriverInfoDto;
|
||||
@ -23,6 +26,7 @@ import cn.iocoder.yudao.module.rescue.utils.RedisUtil;
|
||||
import cn.iocoder.yudao.module.rescue.utils.RedissonDelayQueue;
|
||||
import cn.iocoder.yudao.module.rescue.utils.StringUtils;
|
||||
import cn.iocoder.yudao.module.rescue.vo.BuckleVO;
|
||||
import cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO;
|
||||
import cn.iocoder.yudao.module.rescue.vo.MoneyManagement;
|
||||
import cn.iocoder.yudao.module.rescue.vo.ReturnCarVO;
|
||||
import cn.iocoder.yudao.module.staff.service.CompanyStaffService;
|
||||
@ -35,6 +39,10 @@ import cn.iocoder.yudao.module.system.api.permission.dto.RoleReqDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.AdminUserApi;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.AdminUserRespDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserDTO;
|
||||
import cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO;
|
||||
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.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONArray;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
@ -43,9 +51,11 @@ import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import org.apache.commons.lang3.ObjectUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
@ -115,6 +125,15 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
|
||||
@Lazy
|
||||
private IRescueInfoDetailService rescueInfoDetailService;
|
||||
|
||||
@Autowired
|
||||
private PermissionService permissionService;
|
||||
|
||||
@Autowired
|
||||
private IInspectionFileService inspectionFileService;
|
||||
|
||||
@Autowired
|
||||
private AdminUserService adminUserService;
|
||||
|
||||
|
||||
/**
|
||||
* 查询【请填写功能名称】
|
||||
@ -531,6 +550,77 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
|
||||
@Override
|
||||
@Transactional
|
||||
public void addDriver(DriverInfo driverInfoDto) throws Exception {
|
||||
LambdaQueryWrapper<DriverInfo> queryWrapperD = new LambdaQueryWrapper<>();
|
||||
queryWrapperD.eq(DriverInfo::getPhonenumber, driverInfoDto.getPhonenumber());
|
||||
List<DriverInfo> list = driverInfoService.list(queryWrapperD);
|
||||
if (!CollectionUtil.isEmpty(list)) {
|
||||
throw new Exception("该手机号已绑定司机,请不要重复添加");
|
||||
}
|
||||
AdminUserRespDTO sysUser = userService.getUserByMobile(driverInfoDto.getPhonenumber());
|
||||
driverInfoDto.setAuthStatus("2");
|
||||
if (!ObjectUtils.isEmpty(sysUser)) {
|
||||
DriverInfo driverInfoQuery = new DriverInfo();
|
||||
driverInfoQuery.setUserId(sysUser.getId());
|
||||
List<DriverInfo> driverInfos = driverInfoService.selectDriverInfoList(driverInfoQuery);
|
||||
if (CollectionUtil.isEmpty(driverInfos)) {
|
||||
UserDTO newUser = new UserDTO();
|
||||
newUser.setNickname(driverInfoDto.getRealName());
|
||||
newUser.setSex(driverInfoDto.getSex());
|
||||
newUser.setAvatar(driverInfoDto.getAvatar());
|
||||
newUser.setDeptId(driverInfoDto.getDeptId());
|
||||
userService.createUser(newUser);
|
||||
//代表为救援司机角色 需要添加到司机表中
|
||||
driverInfoDto.setUserId(newUser.getId());
|
||||
driverInfoDto.setDriverStatus("4");
|
||||
driverInfoService.save(driverInfoDto);
|
||||
this.addFolder(newUser.getId());
|
||||
}
|
||||
} else {
|
||||
// 新增用户信息
|
||||
CompanyStaffRespVO staffRespVO = new CompanyStaffRespVO();
|
||||
staffRespVO.setLoginAccount(driverInfoDto.getPhonenumber());
|
||||
staffRespVO.setPassword("123456");
|
||||
RoleReqDTO roleReqDTO = roleApi.getRoleInfo("jysj");
|
||||
List<Long> roleIds = new ArrayList<>();
|
||||
roleIds.add((roleReqDTO.getId()));
|
||||
staffRespVO.setRoleIds(roleIds);
|
||||
staffRespVO.setName(driverInfoDto.getRealName());
|
||||
staffRespVO.setSex(driverInfoDto.getSex());
|
||||
staffRespVO.setTel(driverInfoDto.getPhonenumber());
|
||||
Long userId = staffService.saveStaff(staffRespVO);
|
||||
//代表为救援司机角色 需要添加到司机表中
|
||||
driverInfoDto.setUserId(userId);
|
||||
driverInfoDto.setDriverStatus("4");
|
||||
driverInfoService.save(driverInfoDto);
|
||||
addFolder(userId);
|
||||
}
|
||||
//处理车辆信息
|
||||
if (!CollectionUtil.isEmpty(driverInfoDto.getCarInfoList())) {
|
||||
for (RescueCarInfo rescueCarInfo : driverInfoDto.getCarInfoList()) {
|
||||
String rescueCarNum = rescueCarInfo.getRescueCarNum();
|
||||
LambdaQueryWrapper<RescueCarInfo> queryWrapper = new LambdaQueryWrapper<>();
|
||||
queryWrapper.eq(RescueCarInfo::getRescueCarNum, rescueCarNum);
|
||||
RescueCarInfo one = carInfoService.getOne(queryWrapper);
|
||||
if (ObjectUtils.isNotEmpty(one)) {
|
||||
rescueCarInfo.setCarOwn("1");
|
||||
rescueCarInfo.setPossessorId(driverInfoDto.getId());
|
||||
rescueCarInfo.setId(one.getId());
|
||||
carInfoService.updateById(rescueCarInfo);
|
||||
} else {
|
||||
rescueCarInfo.setCarOwn("1");
|
||||
rescueCarInfo.setPossessorId(driverInfoDto.getId());
|
||||
carInfoService.save(rescueCarInfo);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional
|
||||
public Long addDriverApp(DriverInfo driverInfoDto) throws Exception {
|
||||
LambdaQueryWrapper<DriverInfo> queryWrapperD = new LambdaQueryWrapper<>();
|
||||
queryWrapperD.eq(DriverInfo::getPhonenumber, driverInfoDto.getPhonenumber());
|
||||
List<DriverInfo> list = driverInfoService.list(queryWrapperD);
|
||||
@ -594,7 +684,33 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
|
||||
|
||||
}
|
||||
|
||||
return driverInfoDto.getUserId();
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public Long addFolder(Long userId) {
|
||||
AdminUserDO user = adminUserService.getUser(userId);
|
||||
if (ObjectUtil.isNotEmpty(user)) {
|
||||
Long folderId = inspectionFileService.addFolderForJy(user.getNickname(), InspectionConstants.JY_DRIVER_STAFF_KEY);
|
||||
|
||||
//查询员工子表是否存在数据
|
||||
DriverInfo staff = driverInfoService.getOne(Wrappers.<DriverInfo>lambdaQuery().eq(DriverInfo::getUserId, userId));
|
||||
if (ObjectUtil.isNull(staff)) {
|
||||
staff = new DriverInfo();
|
||||
staff.setUserId(userId);
|
||||
staff.setFolderId(folderId);
|
||||
//新增
|
||||
driverInfoService.save(staff);
|
||||
} else {
|
||||
//修改文件夹id
|
||||
driverInfoService.update(Wrappers.<DriverInfo>lambdaUpdate().eq(DriverInfo::getUserId, userId).set(DriverInfo::getFolderId, folderId));
|
||||
}
|
||||
return folderId;
|
||||
} else {
|
||||
log.error("用户不存在");
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -1410,6 +1526,26 @@ public class RescueInfoServiceImpl extends ServiceImpl<RescueInfoMapper, RescueI
|
||||
return resp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DriverStaffSaveVO getOnInternal(Long id) {
|
||||
DriverStaffSaveVO driverStaffSaveVo = baseMapper.getOnInternal(id);
|
||||
// 查询用户角色集合
|
||||
List<UserRoleDTO> userRoleDTOS = permissionService.userRoleDTOList(Collections.singletonList(id));
|
||||
driverStaffSaveVo.setRoleIds(userRoleDTOS.stream()
|
||||
.filter(role -> "jiuyuan".equals(role.getServicePackageId()))
|
||||
.map(UserRoleDTO::getRoleId)
|
||||
.collect(Collectors.toList()));
|
||||
|
||||
// 查询文件表文件夹id是否存在
|
||||
if (ObjectUtil.isNotEmpty(driverStaffSaveVo.getFolderId())) {
|
||||
InspectionFile folder = inspectionFileService.getOne(Wrappers.<InspectionFile>lambdaQuery().eq(InspectionFile::getId, driverStaffSaveVo.getFolderId()));
|
||||
if (ObjectUtil.isNull(folder)) {
|
||||
driverStaffSaveVo.setFolderId(null);
|
||||
}
|
||||
}
|
||||
return driverStaffSaveVo;
|
||||
}
|
||||
|
||||
public List<RescueInfo> filterRescueInfoByDate(List<RescueInfo> rescueInfos, Date startTime, Date endTime) {
|
||||
return rescueInfos.stream()
|
||||
.filter(info -> info.getRescueTime() != null &&
|
||||
|
@ -0,0 +1,104 @@
|
||||
package cn.iocoder.yudao.module.rescue.vo;
|
||||
|
||||
import cn.iocoder.yudao.module.infra.dal.dataobject.file.FileDO;
|
||||
import cn.iocoder.yudao.module.rescue.domain.DriverInfo;
|
||||
import com.alibaba.excel.annotation.ExcelIgnore;
|
||||
import com.alibaba.excel.annotation.ExcelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class DriverStaffSaveVO extends DriverInfo {
|
||||
/**
|
||||
* 员工id
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private Long driverId;
|
||||
/**
|
||||
* 用户账号
|
||||
*/
|
||||
@ExcelProperty("员工账号")
|
||||
private String username;
|
||||
/**
|
||||
* 用户昵称
|
||||
*/
|
||||
@ExcelProperty("员工名称")
|
||||
private String nickname;
|
||||
/**
|
||||
* 用户类型
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private String userType;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private String remark;
|
||||
|
||||
/**
|
||||
* 部门编号
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private Long deptId;
|
||||
/**
|
||||
* 用户手机号码
|
||||
*/
|
||||
@ExcelProperty("手机号")
|
||||
private String mobile;
|
||||
/**
|
||||
* 用户密码
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private String password;
|
||||
/**
|
||||
* 用户头像
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private String avatar;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
**/
|
||||
@ExcelIgnore
|
||||
private String sex;
|
||||
|
||||
/**
|
||||
* 用户性别
|
||||
*/
|
||||
@ExcelProperty(value = "用户性别")
|
||||
private String sexStr;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*/
|
||||
@ExcelIgnore
|
||||
private Integer status;
|
||||
|
||||
/**
|
||||
* 用户状态
|
||||
*/
|
||||
@ExcelProperty("状态")
|
||||
private String statusStr;
|
||||
|
||||
/**
|
||||
* 用户邮箱
|
||||
*/
|
||||
@ExcelProperty("邮箱")
|
||||
private String email;
|
||||
|
||||
/**
|
||||
* 驾驶证类型集合
|
||||
*/
|
||||
private List<String> driverLicenseTypeArr;
|
||||
|
||||
/**
|
||||
* 文件集合
|
||||
*/
|
||||
private List<FileDO> fileList;
|
||||
|
||||
/**
|
||||
* 角色集合
|
||||
*/
|
||||
private List<Long> roleIds;
|
||||
}
|
@ -494,4 +494,31 @@
|
||||
</select>
|
||||
|
||||
|
||||
<select id="getOnInternal" resultType="cn.iocoder.yudao.module.rescue.vo.DriverStaffSaveVO">
|
||||
SELECT DISTINCT
|
||||
su.id AS userId,
|
||||
su.nickname,
|
||||
su.username,
|
||||
su.user_type,
|
||||
su.remark,
|
||||
su.dept_id,
|
||||
su.mobile,
|
||||
su.password,
|
||||
su.avatar,
|
||||
su.sex,
|
||||
su.status,
|
||||
di.id AS driverId,
|
||||
di.age,
|
||||
di.folder_id
|
||||
FROM driver_info di
|
||||
INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = 0
|
||||
LEFT JOIN system_user_role sur ON su.id = sur.user_id AND sur.deleted = 0
|
||||
LEFT JOIN system_role sr ON sur.role_id = sr.id AND sr.service_package_id = 'jiuyuan' AND sr.deleted = 0
|
||||
<where>
|
||||
di.deleted = 0
|
||||
and su.id = #{id}
|
||||
</where>
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
@ -127,6 +127,15 @@ public class RoleController {
|
||||
return success(roleService.selectListByRoleIdJX(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色id查询角色
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/selectListByRoleIdJY")
|
||||
public CommonResult selectListByRoleIdJY(RolePageReqVO role){
|
||||
return success(roleService.selectListByRoleIdJY(role));
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过角色code查询用户
|
||||
* @param code
|
||||
|
@ -43,6 +43,7 @@ public interface UserRoleMapper extends BaseMapperX<UserRoleDO> {
|
||||
|
||||
IPage<UserDTO> selectListByRoleId(@Param("page") Page<UserDTO> page,@Param("role") RolePageReqVO role);
|
||||
IPage<UserDTO> selectListByRoleIdJX(@Param("page") Page<UserDTO> page,@Param("role") RolePageReqVO role);
|
||||
IPage<UserDTO> selectListByRoleIdJY(@Param("page") Page<UserDTO> page,@Param("role") RolePageReqVO role);
|
||||
|
||||
List<UserDTO> selectByRoleId(Integer roleId);
|
||||
|
||||
|
@ -173,6 +173,7 @@ public interface RoleService {
|
||||
|
||||
IPage<UserDTO> selectListByRoleId(RolePageReqVO role);
|
||||
IPage<UserDTO> selectListByRoleIdJX(RolePageReqVO role);
|
||||
IPage<UserDTO> selectListByRoleIdJY(RolePageReqVO role);
|
||||
|
||||
/**
|
||||
* 根据用户id查询角色
|
||||
|
@ -369,6 +369,12 @@ public class RoleServiceImpl implements RoleService {
|
||||
return userRoleMapper.selectListByRoleIdJX(page,role);
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<UserDTO> selectListByRoleIdJY(RolePageReqVO role) {
|
||||
Page<UserDTO> page = new Page<>(role.getPageNo(), role.getPageSize());
|
||||
return userRoleMapper.selectListByRoleIdJY(page,role);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据用户id查询角色
|
||||
*
|
||||
|
@ -77,6 +77,43 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
order by su.nickname
|
||||
</select>
|
||||
|
||||
|
||||
<select id="selectListByRoleIdJY" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserDTO"
|
||||
parameterType="cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RolePageReqVO">
|
||||
SELECT
|
||||
su.id,
|
||||
su.username,
|
||||
su.nickname,
|
||||
su.user_type,
|
||||
su.remark,
|
||||
su.dept_id,
|
||||
su.mobile,
|
||||
su.password,
|
||||
su.sex,
|
||||
su.open_id,
|
||||
su.tenant_id,
|
||||
su.status,
|
||||
su.avatar,
|
||||
GROUP_CONCAT(DISTINCT sr2.name SEPARATOR ',') AS roleNames
|
||||
FROM driver_info di
|
||||
INNER JOIN system_users su ON di.user_id = su.id AND su.deleted = 0
|
||||
LEFT JOIN system_user_role sr ON su.id = sr.user_id AND sr.deleted = 0
|
||||
LEFT JOIN system_role sr2 ON sr.role_id = sr2.id AND sr2.service_package_id = 'jiuyuan'
|
||||
<where>
|
||||
<if test="role.nickname != null">
|
||||
AND (su.nickname like CONCAT('%',#{role.nickname},'%') OR su.username like CONCAT('%',#{role.nickname},'%'))
|
||||
</if>
|
||||
</where>
|
||||
GROUP BY
|
||||
su.id, su.username, su.nickname, su.user_type, su.remark,
|
||||
su.dept_id, su.mobile, su.password, su.sex, su.open_id,
|
||||
su.tenant_id, su.status, su.avatar
|
||||
<if test="role.roleId != null">
|
||||
HAVING SUM(sr.role_id = #{role.roleId}) > 0
|
||||
</if>
|
||||
ORDER BY su.nickname
|
||||
</select>
|
||||
|
||||
<select id="userCodes" resultType="cn.iocoder.yudao.module.system.api.user.dto.UserRoleDTO">
|
||||
SELECT
|
||||
su.id AS userId,sr.code AS roleCode,sr.id AS roleId, sr.service_package_id
|
||||
|
Loading…
Reference in New Issue
Block a user