Browse Source

优化功能

master
xia 3 years ago
parent
commit
a0da1aae0b
  1. 4
      archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesSummary.java
  2. 28
      archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java

4
archives/src/main/java/com/storeroom/modules/archives/domain/ArchivesSummary.java

@ -53,6 +53,10 @@ public class ArchivesSummary extends BaseEntity implements Serializable {
@ApiModelProperty(value = "保管期限")
private String retention;
@Column(name = "created_date")
@ApiModelProperty(value = "文件生成时间")
private String createdDate;
@Column(name = "archive_year")
@ApiModelProperty(value = "归档年度")
private Integer archiveYear;

28
archives/src/main/java/com/storeroom/modules/archives/service/impl/ArchivesServiceImpl.java

@ -71,6 +71,7 @@ public class ArchivesServiceImpl implements ArchivesService {
public Object initArchivesView(String categoryId,String parentsId,Integer queryType, String queryTitle,String itemNo,String archiveNo,String archiveCtgNo,
String responsibleby,Integer archivesState,String archiveYear,String department,String retention,String securityClass,
String organizationMatter,boolean isdel,Pageable page) {
queryType = queryType == null?0:queryType;
Optional<ArchivesType> optional = archivesTypeRepository.findById(categoryId);
if(!optional.isPresent())
return "未查询到到门类信息!";
@ -119,6 +120,21 @@ public class ArchivesServiceImpl implements ArchivesService {
String queryparentsId = StringUtils.isEmpty(parentsId) ? " " : " and parent_id = '"+parentsId+"' ";
String queryTypeadd = " where 1=1 ";
if(queryType==1){
queryTypeadd = queryTypeadd + " and case_no is null ";
}else if(queryType == 2){
queryTypeadd = queryTypeadd + " and (is_storage is null or is_storage = 0) ";
}else if(queryType == 3){
queryTypeadd = queryTypeadd + " and is_storage = 1 ";
}else if(queryType == 4){
queryTypeadd = queryTypeadd + " and is_storage = 2 and (is_borrow is null or is_borrow = 4)";
}else if(queryType == 5){
queryTypeadd = queryTypeadd + " and (is_borrow = 1 or is_borrow = 2) ";
}else if(queryType == 6){
queryTypeadd = queryTypeadd + " and is_borrow = 3 ";
}
additional = StringUtils.isEmpty(archiveYear) ? additional : additional + " and archive_year = '"+archiveYear+"'";
additional = StringUtils.isEmpty(department) ? additional : additional + " and department = '"+department+"'";
additional = StringUtils.isEmpty(retention) ? additional : additional + " and retention = '"+retention+"'";
@ -133,10 +149,10 @@ public class ArchivesServiceImpl implements ArchivesService {
if(objects.length > 0)
quertOrder = " order by " + quertOrder.substring(0,quertOrder.length()-1);
List<Object[]> countList = entityManager.createNativeQuery("select count(1) from "+queryTable+additional+queryparentsId).getResultList();
List<Object[]> countList = entityManager.createNativeQuery("select count(1) from (select "+queryField+appendQuery+isStorageQuery+isBorrowQuery+" from "+queryTable+additional+queryparentsId+") t "+queryTypeadd).getResultList();
Object count = countList.get(0);
List<Object[]> list = entityManager.createNativeQuery("select "+queryField+appendQuery+isStorageQuery+isBorrowQuery+" from "+queryTable+additional+queryparentsId+quertOrder
+" limit "+page.getPageNumber()*page.getPageSize()+","+page.getPageSize()).getResultList();
List<Object[]> list = entityManager.createNativeQuery("select * from (select "+queryField+appendQuery+isStorageQuery+isBorrowQuery+" from "+queryTable+additional+queryparentsId+quertOrder
+") t "+queryTypeadd+" limit "+page.getPageNumber()*page.getPageSize()+","+page.getPageSize()).getResultList();
List<Map> returnlist = new ArrayList<>();
for(Object[] objs:list){
Map map = new HashMap();
@ -386,7 +402,7 @@ public class ArchivesServiceImpl implements ArchivesService {
//判断是否为空
if(null != json.get(archivesDictionary.getFieldName()) && !"".equals(json.get(archivesDictionary.getFieldName())) && !"null".equals(json.get(archivesDictionary.getFieldName()))){
String thissql = "select id,"+archivesDictionary.getFieldName()+" from "+archivesType.getEnName()+" where "+
archivesDictionary.getFieldName() +" = '"+json.get(archivesDictionary.getFieldName())+"'";
archivesDictionary.getFieldName() +" = '"+json.get(archivesDictionary.getFieldName())+"' and is_delete_time is null ";
List<Object[]> list = entityManager.createNativeQuery(thissql).getResultList();
if(list.size()!=0){
for(Object[] objs:list){
@ -487,7 +503,9 @@ public class ArchivesServiceImpl implements ArchivesService {
//条形码
if(filedNameList.contains("barcode"))
archivesSummary.setBarcode(json.get("barcode")==null?null:json.get("barcode")+"");
//文件生成时间
if(filedNameList.contains("created_date"))
archivesSummary.setCreatedDate(json.get("created_date")==null?null:json.get("created_date")+"");
archivesSummary.setCategoryId(archivesType.getId());//门类id
archivesSummary.setCategoryName(archivesType.getCnName());//门类名称

Loading…
Cancel
Save