首页业务处理

This commit is contained in:
13405411873 2024-10-23 15:24:09 +08:00
parent d5beed0206
commit 771a4eeadf
12 changed files with 52 additions and 49 deletions

View File

@ -267,44 +267,13 @@ public class DriveSchoolInfoServiceImpl implements IDriveSchoolInfoService
*/
@Override
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);
String phonenumber = sysUser.getMobile();
System.out.println("当前用户手机号: " + phonenumber);
// 获取教练信息
DriveSchoolCoach driveSchoolCoach = driveSchoolCoachMapper.selectByPhonenumber(phonenumber);
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("未找到指定部门的驾校信息");
}
return schoolInfoByDeptId;
}
@Override
public List<PayVo> findSelfSchoolData() {
@ -319,15 +288,6 @@ public class DriveSchoolInfoServiceImpl implements IDriveSchoolInfoService
return payVoList;
}
/*@Override
public DriveSchoolInfo selectDriveSchoolInfoAppletById(Long id) {
DriveSchoolInfo driveSchoolInfo = driveSchoolInfoMapper.selectDriveSchoolInfoById(id);
double lat = driveSchoolInfo1.getLat().doubleValue();
double lgt = driveSchoolInfo1.getLgt().doubleValue();
double distance = calculateDistance(driveSchoolInfo.getLat().doubleValue(), driveSchoolInfo.getLgt().doubleValue(), lat, lgt);
driveSchoolInfo1.setDistance(distance/1000);
return null;
}*/
/**
* 计算两个经纬度之间的距离

View File

@ -152,7 +152,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
<select id="getSchoolInfoByDeptId" parameterType="Long" resultMap="DriveSchoolInfoVOResult">
<include refid="selectDriveSchoolInfoVo"/>
where deleted = 0 and dept_id = #{deptId}
where deleted = 0
</select>

View File

@ -128,6 +128,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
AND list_order = #{driveSchoolSwiper.listOrder}
</if>
</if>
</where>
ORDER BY list_order ASC
</select>

3
sql/增量DB.sql Normal file
View File

@ -0,0 +1,3 @@
--
ALTER TABLE `system_service_package`
ADD COLUMN `cover_img` varchar(255) NULL COMMENT '服务icon' AFTER `menu_ids`;

View File

@ -88,5 +88,9 @@ public class ServicePackageController {
List<ServicePackageDO> list = servicePackageService.getServicePackageListByStatus(CommonStatusEnum.ENABLE.getStatus());
return success(BeanUtils.toBean(list, ServicePackageSimpleRespVO.class));
}
}
@GetMapping({"/getPackageListByTenantId"})
public CommonResult<List<ServicePackageDO>> getPackageListByTenantId() {
List<ServicePackageDO> list = servicePackageService.getPackageListByTenantId();
return success(list);
}
}

View File

@ -19,6 +19,7 @@ public class ServicePackageRespVO {
@Schema(description = "套餐名", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@ExcelProperty("套餐名")
private String name;
private String coverImg;
@Schema(description = "套餐状态0正常 1停用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@ExcelProperty("租户状态0正常 1停用")
@ -36,4 +37,4 @@ public class ServicePackageRespVO {
@ExcelProperty("创建时间")
private LocalDateTime createTime;
}
}

View File

@ -15,6 +15,7 @@ public class ServicePackageSaveReqVO {
@Schema(description = "套餐名", requiredMode = Schema.RequiredMode.REQUIRED, example = "赵六")
@NotEmpty(message = "套餐名不能为空")
private String name;
private String coverImg;
@Schema(description = "套餐状态0正常 1停用", requiredMode = Schema.RequiredMode.REQUIRED, example = "2")
@NotNull(message = "套餐状态0正常 1停用不能为空")
@ -27,4 +28,4 @@ public class ServicePackageSaveReqVO {
@NotEmpty(message = "关联的菜单编号不能为空")
private Set<Long> menuIds;
}
}

View File

@ -17,4 +17,5 @@ public class ServicePackageSimpleRespVO {
@NotNull(message = "套餐名不能为空")
private String name;
}

View File

@ -40,10 +40,11 @@ public class ServicePackageDO extends BaseDO {
* 备注
*/
private String remark;
private String coverImg;
/**
* 关联的菜单编号
*/
@TableField(typeHandler = JacksonTypeHandler.class)
private Set<Long> menuIds;
}
}

View File

@ -29,4 +29,7 @@ public interface ServicePackageMapper extends BaseMapperX<ServicePackageDO> {
default List<ServicePackageDO> selectListByStatus(Integer status) {
return selectList(ServicePackageDO::getStatus, status);
}
}
List<ServicePackageDO> getPackageListByTenantId();
}

View File

@ -78,4 +78,14 @@ public interface ServicePackageService {
* @param ids ids
**/
List<ServicePackageDO> getServicePackageByIds(List<String> ids);
}
/**
* 查租户服务
*
* @author zcy
* @date 10:37 2024/9/24
**/
List<ServicePackageDO> getPackageListByTenantId();
}

View File

@ -4,6 +4,8 @@ import cn.iocoder.yudao.framework.common.config.CommonStr;
import cn.iocoder.yudao.framework.common.enums.CommonStatusEnum;
import cn.iocoder.yudao.framework.datapermission.core.rule.DataPermissionRule;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.security.core.LoginUser;
import cn.iocoder.yudao.framework.security.core.util.SecurityFrameworkUtils;
import cn.iocoder.yudao.framework.tenant.core.util.TenantUtils;
import cn.iocoder.yudao.module.system.api.service.dto.ServicePackageDto;
import cn.iocoder.yudao.module.system.controller.admin.permission.vo.role.RoleSaveReqVO;
@ -14,6 +16,7 @@ import cn.iocoder.yudao.module.system.enums.permission.RoleTypeEnum;
import cn.iocoder.yudao.module.system.service.permission.PermissionService;
import cn.iocoder.yudao.module.system.service.permission.RoleService;
import cn.iocoder.yudao.module.system.service.tenant.TenantService;
import com.alibaba.fastjson.JSONArray;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import org.springframework.validation.annotation.Validated;
@ -155,4 +158,19 @@ public class ServicePackageServiceImpl implements ServicePackageService {
public List<ServicePackageDO> getServicePackageByIds(List<String> ids){
return servicePackageMapper.selectList(new LambdaQueryWrapperX<ServicePackageDO>().in(ServicePackageDO::getId, ids));
}
}
@Override
public List<ServicePackageDO> getPackageListByTenantId() {
//获取当前登录用户
LoginUser loginUser = SecurityFrameworkUtils.getLoginUser();
Long tenantId = loginUser.getTenantId();
TenantDO tenant = tenantService.getTenant(tenantId);
Set<String> packageId = tenant.getPackageId();
List<String> ids =new ArrayList<>();
for (String s : packageId) {
ids.add(s);
}
return this.getServicePackageByIds(ids);
}
}