Browse Source

修改接口

master
刘力 3 years ago
parent
commit
61cc60a0f6
  1. 9
      archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesDisplayController.java
  2. 13
      archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesTypeController.java
  3. 20
      archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesDictionaryRepository.java
  4. 17
      archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesNoSettingRepository.java
  5. 19
      archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesDictionaryService.java
  6. 16
      archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesNoSettingService.java
  7. 18
      archives/src/main/java/com/storeroom/modules/dictionary/service/dto/ArchivesDicStateDTO.java
  8. 2
      archives/src/main/java/com/storeroom/modules/dictionary/service/dto/ArchivesDictionarySmallDTO.java
  9. 27
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesDictionaryImpl.java
  10. 22
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesNoSettingImpl.java
  11. 31
      archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java

9
archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesDisplayController.java

@ -1,6 +1,7 @@
package com.storeroom.modules.dictionary.controller; package com.storeroom.modules.dictionary.controller;
import com.storeroom.annotaion.rest.AnonymousGetMapping;
import com.storeroom.annotaion.rest.AnonymousPostMapping; import com.storeroom.annotaion.rest.AnonymousPostMapping;
import com.storeroom.annotaion.rest.AnonymousPutMapping; import com.storeroom.annotaion.rest.AnonymousPutMapping;
import com.storeroom.exception.BaseException; import com.storeroom.exception.BaseException;
@ -16,6 +17,7 @@ import lombok.RequiredArgsConstructor;
import org.springframework.validation.annotation.Validated; import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
import java.util.List; import java.util.List;
@ -37,7 +39,6 @@ public class ArchivesDisplayController {
return ApiResponse.success(ResponseStatus.SUCCESS); return ApiResponse.success(ResponseStatus.SUCCESS);
} }
throw new BaseException("数据异常"); throw new BaseException("数据异常");
} }
@ApiOperation("修改界面浏览设置状态") @ApiOperation("修改界面浏览设置状态")
@ -47,4 +48,10 @@ public class ArchivesDisplayController {
return ApiResponse.success(ResponseStatus.SUCCESS); return ApiResponse.success(ResponseStatus.SUCCESS);
} }
// @ApiOperation("著录界面预览")
// @AnonymousGetMapping("field-name")
// public ApiResponse<Object> displayFieldName(@RequestParam Integer isDataType) {
// return ApiResponse.success(archivesDictionaryService.getDisplayFieldName(isDataType));
// }
} }

13
archives/src/main/java/com/storeroom/modules/dictionary/controller/ArchivesTypeController.java

@ -11,9 +11,7 @@ import com.storeroom.modules.common.ArchivesTypeEnum;
import com.storeroom.modules.dictionary.service.ArchivesDictionaryService; import com.storeroom.modules.dictionary.service.ArchivesDictionaryService;
import com.storeroom.modules.dictionary.service.ArchivesTypeService; import com.storeroom.modules.dictionary.service.ArchivesTypeService;
import com.storeroom.modules.dictionary.service.DictionaryService; import com.storeroom.modules.dictionary.service.DictionaryService;
import com.storeroom.modules.dictionary.service.dto.ArcTypeSmallDTO;
import com.storeroom.modules.dictionary.service.dto.ArchivesDictionaryDTO;
import com.storeroom.modules.dictionary.service.dto.ArchivesTypeDTO;
import com.storeroom.modules.dictionary.service.dto.*;
import com.storeroom.utils.ApiResponse; import com.storeroom.utils.ApiResponse;
import com.storeroom.utils.StringUtils; import com.storeroom.utils.StringUtils;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
@ -100,12 +98,9 @@ public class ArchivesTypeController {
@ApiOperation("门类字段管理") @ApiOperation("门类字段管理")
@AnonymousGetMapping("manage")
public ApiResponse<Object> getFieldName(String categoryId) {
if (!StringUtils.isEmpty(categoryId)) {
return ApiResponse.success(archivesDictionaryService.getAll(categoryId));
}
throw new BaseException("id异常");
@AnonymousPostMapping("manage")
public ApiResponse<Object> getFieldName(@RequestBody ArchivesDicStateDTO dto) {
return ApiResponse.success(archivesDictionaryService.getAll(dto));
} }
@ApiOperation("通过id查询门类字典") @ApiOperation("通过id查询门类字典")

20
archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesDictionaryRepository.java

@ -31,6 +31,15 @@ public interface ArchivesDictionaryRepository extends JpaRepository<ArchivesDict
*/ */
List<ArchivesDictionary> findByCategoryId(String categoryId); List<ArchivesDictionary> findByCategoryId(String categoryId);
/**
* 通过门类id 和字典数据类型查询
*
* @param categoryId
* @param isDateType
* @return
*/
List<ArchivesDictionary> findByCategoryIdAndIsDataType(String categoryId, Integer isDateType);
/** /**
* 通过名称查询 * 通过名称查询
* *
@ -40,7 +49,16 @@ public interface ArchivesDictionaryRepository extends JpaRepository<ArchivesDict
*/ */
@Query(value = "select * from archives_dictionary where field_name = ?1 or field_cn_name = ?2 ", nativeQuery = true) @Query(value = "select * from archives_dictionary where field_name = ?1 or field_cn_name = ?2 ", nativeQuery = true)
List<ArchivesDictionary> querybyName(String fName,String fcName);
List<ArchivesDictionary> querybyName(String fName, String fcName);
/**
* 通过数据类型查询
*
* @param type
* @return
*/
List<ArchivesDictionary> findByIsDataType(Integer type);
} }

17
archives/src/main/java/com/storeroom/modules/dictionary/repository/ArchivesNoSettingRepository.java

@ -0,0 +1,17 @@
package com.storeroom.modules.dictionary.repository;
import com.storeroom.modules.dictionary.domain.ArchivesNoSetting;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
public interface ArchivesNoSettingRepository extends JpaRepository<ArchivesNoSetting, String>, JpaSpecificationExecutor<ArchivesNoSetting> {
/**
* 根据字典id查询
*
* @param id 字典id
* @return
*/
ArchivesNoSetting findByDictionaryId(String id);
}

19
archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesDictionaryService.java

@ -1,7 +1,7 @@
package com.storeroom.modules.dictionary.service; package com.storeroom.modules.dictionary.service;
import com.storeroom.modules.dictionary.domain.ArchivesDictionary;
import com.storeroom.modules.dictionary.service.dto.ArchivesDicStateDTO;
import com.storeroom.modules.dictionary.service.dto.ArchivesDictionaryDTO; import com.storeroom.modules.dictionary.service.dto.ArchivesDictionaryDTO;
import com.storeroom.modules.dictionary.service.dto.ArchivesDictionarySmallDTO; import com.storeroom.modules.dictionary.service.dto.ArchivesDictionarySmallDTO;
import com.storeroom.modules.dictionary.service.dto.ArchivesDisplaySmallDTO; import com.storeroom.modules.dictionary.service.dto.ArchivesDisplaySmallDTO;
@ -20,10 +20,10 @@ public interface ArchivesDictionaryService {
/** /**
* 获取所有门类字典字段
* 获取所有门类常用字段
* @return * @return
*/ */
List<ArchivesDictionaryDTO> getAll(String categoryId);
List<ArchivesDictionaryDTO> getAll(ArchivesDicStateDTO archivesDicStateDTO);
/** /**
@ -69,6 +69,19 @@ public interface ArchivesDictionaryService {
*/ */
void ChangeDisplayState(Set<ArchivesDisplaySmallDTO> archivesDictionarySmallDTOS); void ChangeDisplayState(Set<ArchivesDisplaySmallDTO> archivesDictionarySmallDTOS);
// /**
// * 著录界面预览字段显示
// * @return
// */
// List<ArchivesDictionaryDTO> getDisplayFieldName(Integer isDataType);
/**
* 判断自动生成
* @return
*/
Boolean isAutomatic(String id);

16
archives/src/main/java/com/storeroom/modules/dictionary/service/ArchivesNoSettingService.java

@ -0,0 +1,16 @@
package com.storeroom.modules.dictionary.service;
/**
* 档案配置规则服务
*/
public interface ArchivesNoSettingService {
/**
* 判断自动生成数据状态
* @param dicId
* @return
*/
Boolean IsDataState(String dicId);
}

18
archives/src/main/java/com/storeroom/modules/dictionary/service/dto/ArchivesDicStateDTO.java

@ -0,0 +1,18 @@
package com.storeroom.modules.dictionary.service.dto;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@Data
public class ArchivesDicStateDTO implements Serializable {
@NotNull
private String categoryId;
@NotNull
private Integer isDataType;
}

2
archives/src/main/java/com/storeroom/modules/dictionary/service/dto/ArchivesDictionarySmallDTO.java

@ -14,6 +14,6 @@ public class ArchivesDictionarySmallDTO implements Serializable {
@NotNull @NotNull
private String id; private String id;
@NotNull
private Integer sort; private Integer sort;
} }

27
archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesDictionaryImpl.java

@ -4,7 +4,9 @@ package com.storeroom.modules.dictionary.service.impl;
import com.storeroom.exception.BaseException; import com.storeroom.exception.BaseException;
import com.storeroom.modules.dictionary.domain.ArchivesDictionary; import com.storeroom.modules.dictionary.domain.ArchivesDictionary;
import com.storeroom.modules.dictionary.repository.ArchivesDictionaryRepository; import com.storeroom.modules.dictionary.repository.ArchivesDictionaryRepository;
import com.storeroom.modules.dictionary.repository.ArchivesNoSettingRepository;
import com.storeroom.modules.dictionary.service.ArchivesDictionaryService; import com.storeroom.modules.dictionary.service.ArchivesDictionaryService;
import com.storeroom.modules.dictionary.service.dto.ArchivesDicStateDTO;
import com.storeroom.modules.dictionary.service.dto.ArchivesDictionaryDTO; import com.storeroom.modules.dictionary.service.dto.ArchivesDictionaryDTO;
import com.storeroom.modules.dictionary.service.dto.ArchivesDictionarySmallDTO; import com.storeroom.modules.dictionary.service.dto.ArchivesDictionarySmallDTO;
import com.storeroom.modules.dictionary.service.dto.ArchivesDisplaySmallDTO; import com.storeroom.modules.dictionary.service.dto.ArchivesDisplaySmallDTO;
@ -41,8 +43,14 @@ public class ArchivesDictionaryImpl implements ArchivesDictionaryService {
} }
@Override @Override
public List<ArchivesDictionaryDTO> getAll(String categoryId) {
return archivesDictionaryMapper.toDto(archivesDictionaryRepository.findByCategoryId(categoryId));
public List<ArchivesDictionaryDTO> getAll(ArchivesDicStateDTO archivesDicStateDTO) {
List<ArchivesDictionary> list= archivesDictionaryRepository.findByCategoryIdAndIsDataType(archivesDicStateDTO.getCategoryId(),archivesDicStateDTO.getIsDataType());
List<ArchivesDictionaryDTO> dtoList=new ArrayList<>();
list.forEach(item-> {
ArchivesDictionaryDTO dto=archivesDictionaryMapper.toDto(item);
dtoList.add(dto);
});
return dtoList;
} }
@Override @Override
@ -139,7 +147,22 @@ public class ArchivesDictionaryImpl implements ArchivesDictionaryService {
archivesDictionaryRepository.saveAll(list); archivesDictionaryRepository.saveAll(list);
} }
// @Override
// public List<ArchivesDictionaryDTO> getDisplayFieldName(Integer isDataType) {
// List<ArchivesDictionaryDTO> listDto = new ArrayList<>();
// List<ArchivesDictionary> list = archivesDictionaryRepository.findByIsDataType(isDataType);
// list.forEach(item -> {
// ArchivesDictionaryDTO ad = archivesDictionaryMapper.toDto(item);
// listDto.add(ad);
// });
// return listDto;
// }
@Override
public Boolean isAutomatic(String id) {
return null;
}
} }

22
archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesNoSettingImpl.java

@ -0,0 +1,22 @@
package com.storeroom.modules.dictionary.service.impl;
import com.storeroom.modules.dictionary.repository.ArchivesNoSettingRepository;
import com.storeroom.modules.dictionary.service.ArchivesNoSettingService;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;
@Service
@RequiredArgsConstructor
public class ArchivesNoSettingImpl implements ArchivesNoSettingService {
private final ArchivesNoSettingRepository ansRepostiory;
@Override
public Boolean IsDataState(String dicId) {
ansRepostiory.findByDictionaryId(dicId);
return null;
}
}

31
archives/src/main/java/com/storeroom/modules/dictionary/service/impl/ArchivesTypeServiceImpl.java

@ -55,37 +55,6 @@ public class ArchivesTypeServiceImpl implements ArchivesTypeService {
} }
} }
// @Override
// public List<ArchivesTypeDTO> buildTree() {
// List<ArchivesType> arcList = archivesTypeRepository.findAll();
// List<ArchivesTypeDTO> archivesTypeDTOS = archivesTypeMapper.toDto(arcList);
// List<ArchivesTypeDTO> trees = new ArrayList<>();
// Set<String> ids = new HashSet<>();
// for (ArchivesTypeDTO archivesTypeDTO : archivesTypeDTOS) {
// //如果父节点id为空就是一级菜单
// if (archivesTypeDTO.getPid() == null) {
// //直接加入树列表
// trees.add(archivesTypeDTO);
// }
// for (ArchivesTypeDTO at : archivesTypeDTOS) {
// if (archivesTypeDTO.getId().equals(at.getPid())) {
// if (archivesTypeDTO.getChildren() == null) {
// archivesTypeDTO.setChildren(new ArrayList<>());
// }
// archivesTypeDTO.getChildren().add(at);
// ids.add(at.getId());
// }
// }
// if (archivesTypeDTO.getChildren() != null && archivesTypeDTO.getCategorySeq() != null) {
// archivesTypeDTO.getChildren().sort(Comparator.reverseOrder());
// }
// }
// if (trees.size() == 0) {
// trees = archivesTypeDTOS.stream().filter(s -> !ids.contains(s.getId())).collect(Collectors.toList());
// }
// trees.sort(Comparator.reverseOrder());
// return trees;
// }
@Override @Override
public List<ArchivesType> buildTree() { public List<ArchivesType> buildTree() {

Loading…
Cancel
Save