fix&patch: 补丁info-edit,对代码规整修改
All checks were successful
JslGroup/JslDeveloper/JSL_OrganizeInternalOA/pipeline/head This commit looks good

This commit is contained in:
筱锋xiao_lfeng 2024-01-31 13:14:33 +08:00
parent 3702dc4935
commit de99fe1dc5
No known key found for this signature in database
GPG Key ID: F693AA12AABBFA87
5 changed files with 21 additions and 7 deletions

View File

@ -29,3 +29,14 @@ include:
- name: JavaLangImport - name: JavaLangImport
- name: UNUSED_IMPORT - name: UNUSED_IMPORT
- name: SamePackageImport - name: SamePackageImport
- name: CheckDependencyLicenses
- name: ArgNamesErrorsInspection
- name: ArgNamesWarningsInspection
- name: AssertMessageNotString
- name: EqualsCalledOnEnumConstant
- name: ListIndexOfReplaceableByContains
- name: ObjectsEqualsCanBeSimplified
- name: SizeReplaceableByIsEmpty
- name: ArrayCreationWithoutNewKeyword
exclude:
- name: VulnerableLibrariesLocal

View File

@ -37,18 +37,18 @@ public class InfoController {
} }
@PutMapping("/info/header-image/edit") @PutMapping("/info/header-image/edit")
public BaseResponse infoEditHeaderImage(@RequestBody @Validated CarouselVO carouselVO, @RequestParam Integer id, HttpServletRequest request, @NotNull BindingResult bindingResult) { public BaseResponse infoEditHeaderImage(@RequestBody @Validated CarouselVO carouselVO, HttpServletRequest request, @NotNull BindingResult bindingResult) {
log.info("请求接口[PUT]: /info/header-image/edit"); log.info("请求接口[PUT]: /info/header-image/edit");
// 参数校验 // 参数校验
if (bindingResult.hasErrors()) { if (bindingResult.hasErrors()) {
log.warn("参数校验失败: {}", Processing.getValidatedErrorList(bindingResult)); log.warn("参数校验失败: {}", Processing.getValidatedErrorList(bindingResult));
return ResultUtil.error(ErrorCode.PARAMETER_ERROR, Processing.getValidatedErrorList(bindingResult)); return ResultUtil.error(ErrorCode.PARAMETER_ERROR, Processing.getValidatedErrorList(bindingResult));
} }
if (id == null) { if (carouselVO.getId() == null) {
log.warn("参数校验失败: {}", "id不能为空"); log.warn("参数校验失败: {}", "id不能为空");
return ResultUtil.error(ErrorCode.PARAMETER_ERROR, "id不能为空"); return ResultUtil.error(ErrorCode.PARAMETER_ERROR, "id不能为空");
} }
return infoService.editHeaderImage(request, carouselVO, id); return infoService.editHeaderImage(request, carouselVO);
} }
@DeleteMapping("/info/header-image/del") @DeleteMapping("/info/header-image/del")

View File

@ -1,5 +1,6 @@
package com.jsl.oa.model.voData.business.info; package com.jsl.oa.model.voData.business.info;
import com.fasterxml.jackson.annotation.JsonInclude;
import lombok.Data; import lombok.Data;
/** /**
@ -12,7 +13,9 @@ import lombok.Data;
* @author 筱锋xiao_lfeng * @author 筱锋xiao_lfeng
*/ */
@Data @Data
@JsonInclude(JsonInclude.Include.NON_NULL)
public class CarouselVO { public class CarouselVO {
private Integer id;
private Integer displayOrder; private Integer displayOrder;
private String image; private String image;
private String title; private String title;

View File

@ -36,7 +36,7 @@ public interface InfoService {
* @param id 轮播图ID * @param id 轮播图ID
* @return {@link BaseResponse} * @return {@link BaseResponse}
*/ */
BaseResponse editHeaderImage(HttpServletRequest request, CarouselVO carouselVO, Integer id); BaseResponse editHeaderImage(HttpServletRequest request, CarouselVO carouselVO);
/** /**
* <h2>获取轮播图</h2> * <h2>获取轮播图</h2>

View File

@ -69,7 +69,7 @@ public class InfoServiceImpl implements InfoService {
@Override @Override
@CheckUserHasPermission("info.image.edit") @CheckUserHasPermission("info.image.edit")
public BaseResponse editHeaderImage(HttpServletRequest request, CarouselVO carouselVO, Integer id) { public BaseResponse editHeaderImage(HttpServletRequest request, @NotNull CarouselVO carouselVO) {
log.info("\t> 执行 Service 层 InfoService.editHeaderImage 方法"); log.info("\t> 执行 Service 层 InfoService.editHeaderImage 方法");
// 获取用户 // 获取用户
Long userId = Processing.getAuthHeaderToUserId(request); Long userId = Processing.getAuthHeaderToUserId(request);
@ -77,10 +77,10 @@ public class InfoServiceImpl implements InfoService {
// 获取轮播图信息 // 获取轮播图信息
CarouselDO carouselDO = infoDAO.getCarousel(); CarouselDO carouselDO = infoDAO.getCarousel();
// 获取指定轮播图 // 获取指定轮播图
if (id > carouselDO.getData().size()) { if (carouselVO.getId() > carouselDO.getData().size()) {
return ResultUtil.error(ErrorCode.ID_NOT_EXIST); return ResultUtil.error(ErrorCode.ID_NOT_EXIST);
} }
CarouselDO.DataDO carousel = carouselDO.getData().get(id - 1); CarouselDO.DataDO carousel = carouselDO.getData().get(carouselVO.getId() - 1);
carousel.setDisplayOrder(carouselVO.getDisplayOrder()) carousel.setDisplayOrder(carouselVO.getDisplayOrder())
.setImage(carouselVO.getImage()) .setImage(carouselVO.getImage())
.setDescription(carouselVO.getDescription()) .setDescription(carouselVO.getDescription())