Commit 06c721fd6f5409f2369c9909a3cd2b0dffc799bd
1 parent
ad88168c
字典api新增接口获取单个字典值
Showing
11 changed files
with
72 additions
and
5 deletions
urbanops-framework/urbanops-common/src/main/java/com/zteits/urbanops/framework/common/biz/system/dict/DictDataCommonApi.java
| @@ -19,6 +19,15 @@ public interface DictDataCommonApi { | @@ -19,6 +19,15 @@ public interface DictDataCommonApi { | ||
| 19 | */ | 19 | */ |
| 20 | List<DictDataRespDTO> getDictDataList(String dictType); | 20 | List<DictDataRespDTO> getDictDataList(String dictType); |
| 21 | 21 | ||
| 22 | + /** | ||
| 23 | + * 获得指定字典类型的字典数据列表 | ||
| 24 | + * | ||
| 25 | + * @param dictType 字典类型 | ||
| 26 | + * @param value 字典值 | ||
| 27 | + * @return 字典数据列表 | ||
| 28 | + */ | ||
| 29 | + DictDataRespDTO getDictData(String dictType, String value ); | ||
| 30 | + | ||
| 22 | 31 | ||
| 23 | 32 | ||
| 24 | } | 33 | } |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/PlanRateDetailController.java
| @@ -80,8 +80,7 @@ public class PlanRateDetailController { | @@ -80,8 +80,7 @@ public class PlanRateDetailController { | ||
| 80 | public CommonResult<PlanRateDetailRespVO> getPlanRateValue(@RequestParam("busi_Line") @NotBlank String busiLine, | 80 | public CommonResult<PlanRateDetailRespVO> getPlanRateValue(@RequestParam("busi_Line") @NotBlank String busiLine, |
| 81 | @RequestParam("plan_type_id") @NotNull Integer planTypeId, | 81 | @RequestParam("plan_type_id") @NotNull Integer planTypeId, |
| 82 | @RequestParam("level_id") @NotNull Integer levelId) { | 82 | @RequestParam("level_id") @NotNull Integer levelId) { |
| 83 | - PlanRateDetailDO detail = planRateDetailService.getPlanRateValue(busiLine, planTypeId, levelId ); | ||
| 84 | - return success(BeanUtils.toBean(detail, PlanRateDetailRespVO.class)); | 83 | + return success(planRateDetailService.getPlanRateValue(busiLine, planTypeId, levelId )); |
| 85 | } | 84 | } |
| 86 | 85 | ||
| 87 | @GetMapping("/page") | 86 | @GetMapping("/page") |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/planrate/vo/PlanRateDetailRespVO.java
| @@ -43,6 +43,10 @@ public class PlanRateDetailRespVO { | @@ -43,6 +43,10 @@ public class PlanRateDetailRespVO { | ||
| 43 | @ExcelProperty("周期ID: 1:日/次;2:周/次;3:月/次;4:年/次") | 43 | @ExcelProperty("周期ID: 1:日/次;2:周/次;3:月/次;4:年/次") |
| 44 | private Integer cycleId; | 44 | private Integer cycleId; |
| 45 | 45 | ||
| 46 | + @Schema(description = "周期名称: 1:日/次;2:周/次;3:月/次;4:年/次", requiredMode = Schema.RequiredMode.REQUIRED, example = "11235") | ||
| 47 | + @ExcelProperty("周期名称: 1:日/次;2:周/次;3:月/次;4:年/次") | ||
| 48 | + private String cycleName; | ||
| 49 | + | ||
| 46 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) | 50 | @Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
| 47 | @ExcelProperty("创建时间") | 51 | @ExcelProperty("创建时间") |
| 48 | private LocalDateTime createTime; | 52 | private LocalDateTime createTime; |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/enums/PlanConstants.java
| @@ -4,4 +4,7 @@ public class PlanConstants { | @@ -4,4 +4,7 @@ public class PlanConstants { | ||
| 4 | 4 | ||
| 5 | /*计划属性-字典key*/ | 5 | /*计划属性-字典key*/ |
| 6 | public static final String GARDEN_PLAN_ATTR_REDIS_KEY = "garden_plan_attr"; | 6 | public static final String GARDEN_PLAN_ATTR_REDIS_KEY = "garden_plan_attr"; |
| 7 | + | ||
| 8 | + /*周期-cycle_id_type-字典key*/ | ||
| 9 | + public static final String CYCLE_ID_TYPE = "cycle_id_type"; | ||
| 7 | } | 10 | } |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/planrate/PlanRateDetailService.java
| @@ -65,6 +65,6 @@ public interface PlanRateDetailService { | @@ -65,6 +65,6 @@ public interface PlanRateDetailService { | ||
| 65 | * @param levelId 道路等级 | 65 | * @param levelId 道路等级 |
| 66 | * @return 对象 | 66 | * @return 对象 |
| 67 | */ | 67 | */ |
| 68 | - PlanRateDetailDO getPlanRateValue(String busiLine,Integer planTypeId,Integer levelId); | 68 | + PlanRateDetailRespVO getPlanRateValue(String busiLine,Integer planTypeId,Integer levelId); |
| 69 | 69 | ||
| 70 | } | 70 | } |
| 71 | \ No newline at end of file | 71 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/planrate/PlanRateDetailServiceImpl.java
| 1 | package com.zteits.urbanops.module.garden.service.planrate; | 1 | package com.zteits.urbanops.module.garden.service.planrate; |
| 2 | 2 | ||
| 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 3 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 4 | +import com.zteits.urbanops.framework.common.biz.system.dict.dto.DictDataRespDTO; | ||
| 4 | import com.zteits.urbanops.module.garden.dal.dataobject.planrate.PlanRateDO; | 5 | import com.zteits.urbanops.module.garden.dal.dataobject.planrate.PlanRateDO; |
| 5 | import com.zteits.urbanops.module.garden.dal.mysql.planrate.PlanRateMapper; | 6 | import com.zteits.urbanops.module.garden.dal.mysql.planrate.PlanRateMapper; |
| 7 | +import com.zteits.urbanops.module.system.api.dict.DictDataApi; | ||
| 6 | import org.springframework.stereotype.Service; | 8 | import org.springframework.stereotype.Service; |
| 7 | import jakarta.annotation.Resource; | 9 | import jakarta.annotation.Resource; |
| 8 | import org.springframework.validation.annotation.Validated; | 10 | import org.springframework.validation.annotation.Validated; |
| @@ -16,7 +18,9 @@ import com.zteits.urbanops.framework.common.util.object.BeanUtils; | @@ -16,7 +18,9 @@ import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 16 | import com.zteits.urbanops.module.garden.dal.mysql.planrate.PlanRateDetailMapper; | 18 | import com.zteits.urbanops.module.garden.dal.mysql.planrate.PlanRateDetailMapper; |
| 17 | 19 | ||
| 18 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | 20 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 21 | +import static com.zteits.urbanops.framework.common.util.object.BeanUtils.copyProperties; | ||
| 19 | import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RATE_NOT_EXISTS; | 22 | import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.PLAN_RATE_NOT_EXISTS; |
| 23 | +import static com.zteits.urbanops.module.garden.enums.PlanConstants.CYCLE_ID_TYPE; | ||
| 20 | 24 | ||
| 21 | /** | 25 | /** |
| 22 | * 计划频次明细 Service 实现类 | 26 | * 计划频次明细 Service 实现类 |
| @@ -33,6 +37,9 @@ public class PlanRateDetailServiceImpl implements PlanRateDetailService { | @@ -33,6 +37,9 @@ public class PlanRateDetailServiceImpl implements PlanRateDetailService { | ||
| 33 | @Resource | 37 | @Resource |
| 34 | private PlanRateDetailMapper planRateDetailMapper; | 38 | private PlanRateDetailMapper planRateDetailMapper; |
| 35 | 39 | ||
| 40 | + @Resource | ||
| 41 | + private DictDataApi dictDataApi; | ||
| 42 | + | ||
| 36 | @Override | 43 | @Override |
| 37 | public Long createPlanRateDetail(PlanRateDetailSaveReqVO createReqVO) { | 44 | public Long createPlanRateDetail(PlanRateDetailSaveReqVO createReqVO) { |
| 38 | // 插入 | 45 | // 插入 |
| @@ -85,14 +92,20 @@ public class PlanRateDetailServiceImpl implements PlanRateDetailService { | @@ -85,14 +92,20 @@ public class PlanRateDetailServiceImpl implements PlanRateDetailService { | ||
| 85 | 92 | ||
| 86 | 93 | ||
| 87 | @Override | 94 | @Override |
| 88 | - public PlanRateDetailDO getPlanRateValue(String busiLine, Integer planTypeId, Integer levelId) { | 95 | + public PlanRateDetailRespVO getPlanRateValue(String busiLine, Integer planTypeId, Integer levelId) { |
| 89 | QueryWrapper<PlanRateDetailDO> sql = new QueryWrapper<>(); | 96 | QueryWrapper<PlanRateDetailDO> sql = new QueryWrapper<>(); |
| 90 | sql.lambda().eq(PlanRateDetailDO::getBusiLine, busiLine).eq(PlanRateDetailDO::getPlanTypeId, planTypeId).eq(PlanRateDetailDO::getLevelId, levelId); | 97 | sql.lambda().eq(PlanRateDetailDO::getBusiLine, busiLine).eq(PlanRateDetailDO::getPlanTypeId, planTypeId).eq(PlanRateDetailDO::getLevelId, levelId); |
| 91 | PlanRateDetailDO planRateDetailDO = planRateDetailMapper.selectOne(sql); | 98 | PlanRateDetailDO planRateDetailDO = planRateDetailMapper.selectOne(sql); |
| 92 | if (planRateDetailDO == null) { | 99 | if (planRateDetailDO == null) { |
| 93 | throw exception(PLAN_RATE_NOT_EXISTS); | 100 | throw exception(PLAN_RATE_NOT_EXISTS); |
| 94 | } | 101 | } |
| 95 | - return planRateDetailDO; | 102 | + PlanRateDetailRespVO respVO = new PlanRateDetailRespVO(); |
| 103 | + BeanUtils.copyProperties(planRateDetailDO, respVO); | ||
| 104 | + DictDataRespDTO dictData = dictDataApi.getDictData(CYCLE_ID_TYPE, planRateDetailDO.getCycleId() + ""); | ||
| 105 | + if (dictData != null) { | ||
| 106 | + respVO.setCycleName(dictData.getLabel()); | ||
| 107 | + } | ||
| 108 | + return respVO; | ||
| 96 | } | 109 | } |
| 97 | 110 | ||
| 98 | } | 111 | } |
| 99 | \ No newline at end of file | 112 | \ No newline at end of file |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/api/dict/DictDataApiImpl.java
| @@ -32,4 +32,12 @@ public class DictDataApiImpl implements DictDataApi { | @@ -32,4 +32,12 @@ public class DictDataApiImpl implements DictDataApi { | ||
| 32 | return BeanUtils.toBean(list, DictDataRespDTO.class); | 32 | return BeanUtils.toBean(list, DictDataRespDTO.class); |
| 33 | } | 33 | } |
| 34 | 34 | ||
| 35 | + @Override | ||
| 36 | + public DictDataRespDTO getDictData(String dictType, String value) { | ||
| 37 | + DictDataRespDTO dto = new DictDataRespDTO(); | ||
| 38 | + DictDataDO dictData = dictDataService.getDictData(dictType, value); | ||
| 39 | + BeanUtils.copyProperties(dictData, dto); | ||
| 40 | + return dto; | ||
| 41 | + } | ||
| 42 | + | ||
| 35 | } | 43 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/controller/admin/permission/RoleController.java
| @@ -18,6 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; | @@ -18,6 +18,7 @@ import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 18 | import jakarta.annotation.Resource; | 18 | import jakarta.annotation.Resource; |
| 19 | import jakarta.servlet.http.HttpServletResponse; | 19 | import jakarta.servlet.http.HttpServletResponse; |
| 20 | import jakarta.validation.Valid; | 20 | import jakarta.validation.Valid; |
| 21 | +import jakarta.validation.constraints.NotBlank; | ||
| 21 | import org.springframework.security.access.prepost.PreAuthorize; | 22 | import org.springframework.security.access.prepost.PreAuthorize; |
| 22 | import org.springframework.validation.annotation.Validated; | 23 | import org.springframework.validation.annotation.Validated; |
| 23 | import org.springframework.web.bind.annotation.*; | 24 | import org.springframework.web.bind.annotation.*; |
| @@ -80,6 +81,14 @@ public class RoleController { | @@ -80,6 +81,14 @@ public class RoleController { | ||
| 80 | return success(BeanUtils.toBean(role, RoleRespVO.class)); | 81 | return success(BeanUtils.toBean(role, RoleRespVO.class)); |
| 81 | } | 82 | } |
| 82 | 83 | ||
| 84 | + @GetMapping("/get/busi-line") | ||
| 85 | + @Operation(summary = "通过业务线查询角色列表") | ||
| 86 | + @Parameter(name = "busi_line", description = "业务线", required = true) | ||
| 87 | + @PreAuthorize("@ss.hasPermission('system:role:query')") | ||
| 88 | + public CommonResult<List<RoleRespVO>> getRoleListByBusiLine(@RequestParam("busi_line") @NotBlank String busiLine) { | ||
| 89 | + return success(roleService.getRoleListByBusiLine(busiLine)); | ||
| 90 | + } | ||
| 91 | + | ||
| 83 | @GetMapping("/page") | 92 | @GetMapping("/page") |
| 84 | @Operation(summary = "获得角色分页") | 93 | @Operation(summary = "获得角色分页") |
| 85 | @PreAuthorize("@ss.hasPermission('system:role:query')") | 94 | @PreAuthorize("@ss.hasPermission('system:role:query')") |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/dal/dataobject/permission/RoleDO.java
| @@ -75,4 +75,9 @@ public class RoleDO extends TenantBaseDO { | @@ -75,4 +75,9 @@ public class RoleDO extends TenantBaseDO { | ||
| 75 | @TableField(typeHandler = JacksonTypeHandler.class) | 75 | @TableField(typeHandler = JacksonTypeHandler.class) |
| 76 | private Set<Long> dataScopeDeptIds; | 76 | private Set<Long> dataScopeDeptIds; |
| 77 | 77 | ||
| 78 | + /** | ||
| 79 | + * 业务线: yl-园林;wy-物业:sz-市政;例如:yl,wy' | ||
| 80 | + */ | ||
| 81 | + private String busiLine; | ||
| 82 | + | ||
| 78 | } | 83 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/permission/RoleService.java
| @@ -2,6 +2,7 @@ package com.zteits.urbanops.module.system.service.permission; | @@ -2,6 +2,7 @@ package com.zteits.urbanops.module.system.service.permission; | ||
| 2 | 2 | ||
| 3 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 3 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 4 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RolePageReqVO; | 4 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RolePageReqVO; |
| 5 | +import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO; | ||
| 5 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; | 6 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; |
| 6 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; | 7 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; |
| 7 | import jakarta.validation.Valid; | 8 | import jakarta.validation.Valid; |
| @@ -128,4 +129,10 @@ public interface RoleService { | @@ -128,4 +129,10 @@ public interface RoleService { | ||
| 128 | */ | 129 | */ |
| 129 | void validateRoleList(Collection<Long> ids); | 130 | void validateRoleList(Collection<Long> ids); |
| 130 | 131 | ||
| 132 | + /** | ||
| 133 | + * 通过业务线查询角色列表 | ||
| 134 | + * @param busiLine 业务线 | ||
| 135 | + * @return | ||
| 136 | + */ | ||
| 137 | + List<RoleRespVO> getRoleListByBusiLine(String busiLine); | ||
| 131 | } | 138 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/permission/RoleServiceImpl.java
| @@ -5,11 +5,13 @@ import cn.hutool.core.collection.CollectionUtil; | @@ -5,11 +5,13 @@ import cn.hutool.core.collection.CollectionUtil; | ||
| 5 | import cn.hutool.core.util.ObjUtil; | 5 | import cn.hutool.core.util.ObjUtil; |
| 6 | import cn.hutool.core.util.ObjectUtil; | 6 | import cn.hutool.core.util.ObjectUtil; |
| 7 | import cn.hutool.extra.spring.SpringUtil; | 7 | import cn.hutool.extra.spring.SpringUtil; |
| 8 | +import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | ||
| 8 | import com.zteits.urbanops.framework.common.enums.CommonStatusEnum; | 9 | import com.zteits.urbanops.framework.common.enums.CommonStatusEnum; |
| 9 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 10 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 10 | import com.zteits.urbanops.framework.common.util.collection.CollectionUtils; | 11 | import com.zteits.urbanops.framework.common.util.collection.CollectionUtils; |
| 11 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; | 12 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 12 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RolePageReqVO; | 13 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RolePageReqVO; |
| 14 | +import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO; | ||
| 13 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; | 15 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; |
| 14 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; | 16 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; |
| 15 | import com.zteits.urbanops.module.system.dal.mysql.permission.RoleMapper; | 17 | import com.zteits.urbanops.module.system.dal.mysql.permission.RoleMapper; |
| @@ -262,6 +264,14 @@ public class RoleServiceImpl implements RoleService { | @@ -262,6 +264,14 @@ public class RoleServiceImpl implements RoleService { | ||
| 262 | }); | 264 | }); |
| 263 | } | 265 | } |
| 264 | 266 | ||
| 267 | + @Override | ||
| 268 | + public List<RoleRespVO> getRoleListByBusiLine(String busiLine) { | ||
| 269 | + QueryWrapper<RoleDO> sql = new QueryWrapper<>(); | ||
| 270 | + sql.lambda().eq(RoleDO::getBusiLine, busiLine); | ||
| 271 | + List<RoleDO> roleDOS = roleMapper.selectList(sql); | ||
| 272 | + return BeanUtils.toBean(roleDOS, RoleRespVO.class); | ||
| 273 | + } | ||
| 274 | + | ||
| 265 | /** | 275 | /** |
| 266 | * 获得自身的代理对象,解决 AOP 生效问题 | 276 | * 获得自身的代理对象,解决 AOP 生效问题 |
| 267 | * | 277 | * |