@ -973,7 +973,7 @@ public class ArchivesServiceImpl implements ArchivesService {
public JSONObject externalGet ( ArchivesExternalGetDTO dto ) {
JSONObject json = new JSONObject ( ) ;
PageRequest page = PageRequest . of ( dto . getPn ( ) - 1 , dto . getPs ( ) ) ;
String quCol = dto . getQuNo ( ) + "-" + dto . getColNo ( ) + "%" ;
String quCol = dto . getQuNo ( ) + "-" + dto . getColNo ( ) + "- %" ;
String data = dto . getData ( ) ;
if ( dto . getDatatype ( ) = = 0 ) {
data = StringUtils . isEmpty ( data ) ? "%%" : "%" + data + "%" ;
@ -1031,4 +1031,191 @@ public class ArchivesServiceImpl implements ArchivesService {
json . put ( "errorinfo" , null ) ;
return json ;
}
@Override
public JSONObject externalGetArchivesCount ( ArchivesExternalGetDTO dto ) {
String quNo = dto . getQuNo ( ) + "-%" ;
List < String > inStoreId = archivesSummaryRepository . getInStore ( dto . getStoreCode ( ) , quNo ) ;
List < String > isBorrowId = archivesSummaryRepository . getIsBorrow ( dto . getStoreCode ( ) , quNo ) ;
JSONObject json = new JSONObject ( ) ;
JSONObject data = new JSONObject ( ) ;
data . put ( "in" , inStoreId . size ( ) - isBorrowId . size ( ) ) ;
data . put ( "out" , isBorrowId . size ( ) ) ;
json . put ( "data" , data ) ;
json . put ( "msg" , "success" ) ;
json . put ( "ret" , true ) ;
return json ;
}
@Override
public JSONObject externalGetColumnInfo ( ArchivesExternalGetDTO dto ) {
JSONObject json = new JSONObject ( ) ;
String quColZy = dto . getQuNo ( ) + "-" + dto . getColNo ( ) + "-" + "%-%" ;
if ( dto . getZyNo ( ) ! = 0 ) {
quColZy = quColZy + "-" + dto . getZyNo ( ) ;
}
List < Map < String , Object > > resultList = archivesSummaryRepository . externalGetColumnInfoResult ( dto . getStoreCode ( ) , quColZy ) ;
List result = new ArrayList ( ) ;
JSONObject jsonResult = new JSONObject ( ) ;
Integer leNos = 0 ;
List < Map < String , Object > > divList = new ArrayList < > ( ) ;
for ( int i = 0 ; i < resultList . size ( ) ; i + + ) {
Map < String , Object > map = resultList . get ( i ) ;
Map < String , Object > thisDiv = new HashMap < > ( ) ;
Integer thisLeNos = Integer . parseInt ( map . get ( "leNo" ) + "" ) ;
Integer thisDisNo = Integer . parseInt ( map . get ( "divNo" ) + "" ) ;
Integer archivesStorageNum = Integer . parseInt ( map . get ( "archivesStorageNum" ) + "" ) ;
Integer archivesBorrowNum = Integer . parseInt ( map . get ( "archivesBorrowNum" ) + "" ) ;
/ / 新列
if ( leNos ! = thisLeNos ) {
if ( divList . size ( ) ! = 0 ) {
jsonResult . put ( "divList" , divList ) ;
jsonResult . put ( "leNo" , leNos ) ;
result . add ( jsonResult ) ;
jsonResult = new JSONObject ( ) ;
}
divList = new ArrayList < > ( ) ;
leNos = thisLeNos ;
}
thisDiv . put ( "archivesBorrowNum" , archivesBorrowNum ) ;
thisDiv . put ( "archivesStorageNum" , archivesStorageNum ) ;
thisDiv . put ( "divNo" , thisDisNo ) ;
divList . add ( thisDiv ) ;
/ / 如果是最后一次循环
if ( i = = resultList . size ( ) - 1 ) {
jsonResult . put ( "divList" , divList ) ;
jsonResult . put ( "leNo" , leNos ) ;
result . add ( jsonResult ) ;
}
}
json . put ( "code" , 0 ) ;
json . put ( "errorinfo" , "" ) ;
json . put ( "protocal" , 1005 ) ;
json . put ( "result" , result ) ;
return json ;
}
@Override
public JSONObject externalGetArchivesByZy ( ArchivesExternalGetDTO dto ) {
JSONObject json = new JSONObject ( ) ;
PageRequest page = PageRequest . of ( dto . getPn ( ) - 1 , dto . getPs ( ) ) ;
String quCol = dto . getQuNo ( ) + "-" + dto . getColNo ( ) + "-" + dto . getLeNo ( ) + "-" + dto . getDivNo ( ) + "-" + dto . getZyNo ( ) ;
/ / 分页查询
Page < Map < String , Object > > pageMap = archivesSummaryRepository . externalGet ( dto . getStoreCode ( ) , quCol , 0 , "%%" , page ) ;
json . put ( "protocal" , 1001 ) ;
json . put ( "code" , 0 ) ;
JSONArray jsonArray = new JSONArray ( ) ;
List < Map < String , Object > > resultMap = pageMap . getContent ( ) ;
for ( Map < String , Object > map : resultMap ) {
JSONObject resultJson = new JSONObject ( ) ;
resultJson . put ( "filename" , map . get ( "filename" ) ) ;
resultJson . put ( "fileno" , map . get ( "fileno" ) ) ;
resultJson . put ( "makedate" , map . get ( "makedate" ) ) ;
resultJson . put ( "filetype" , map . get ( "filetype" ) ) ;
resultJson . put ( "filecode" , map . get ( "filecode" ) ) ;
resultJson . put ( "keepday" , map . get ( "keepday" ) ) ;
resultJson . put ( "position" , map . get ( "position" ) . toString ( ) . replaceAll ( "-" , " " ) ) ;
resultJson . put ( "storeCode" , map . get ( "storeCode" ) ) ;
resultJson . put ( "editdate" , map . get ( "editdate" ) ) ;
resultJson . put ( "enclosure" , map . get ( "enclosure" ) ) ;
Integer filestatus = map . get ( "filestatus" ) = = null ? 0 : Integer . parseInt ( map . get ( "filestatus" ) . toString ( ) ) ;
Integer inputFilestatus = 8 ;
if ( filestatus = = 1 ) {
inputFilestatus = 2 ;
} else if ( filestatus = = 2 ) {
inputFilestatus = 4 ;
} else if ( filestatus = = 3 ) {
inputFilestatus = 6 ;
}
resultJson . put ( "filestatus" , inputFilestatus ) ;
String [ ] splitPostion = map . get ( "location" ) . toString ( ) . split ( "-" ) ;
resultJson . put ( "quNo" , splitPostion [ 0 ] ) ;
resultJson . put ( "colNo" , splitPostion [ 1 ] ) ;
resultJson . put ( "leNo" , splitPostion [ 2 ] ) ;
resultJson . put ( "divNo" , splitPostion [ 3 ] ) ;
resultJson . put ( "zyNo" , splitPostion [ 4 ] ) ;
JSONObject positionKeyJson = new JSONObject ( ) ;
positionKeyJson . put ( "quNo" , splitPostion [ 0 ] ) ;
positionKeyJson . put ( "colNo" , splitPostion [ 1 ] ) ;
positionKeyJson . put ( "leNo" , splitPostion [ 2 ] ) ;
positionKeyJson . put ( "divNo" , splitPostion [ 3 ] ) ;
positionKeyJson . put ( "zyNo" , splitPostion [ 4 ] ) ;
positionKeyJson . put ( "storeCode" , map . get ( "storeCode" ) ) ;
resultJson . put ( "positionKey" , positionKeyJson ) ;
jsonArray . add ( resultJson ) ;
}
JSONObject jsonContext = new JSONObject ( ) ;
jsonContext . put ( "list" , jsonArray ) ;
jsonContext . put ( "count" , jsonArray . size ( ) ) ;
json . put ( "result" , jsonContext ) ;
json . put ( "errorinfo" , null ) ;
return json ;
}
@Override
public JSONObject externalMoveColumnGetFiles ( ArchivesExternalGetDTO dto ) {
JSONObject json = new JSONObject ( ) ;
PageRequest page = PageRequest . of ( dto . getPn ( ) - 1 , dto . getPs ( ) ) ;
String quCol = "%-%-%-%-%" ;
String data = StringUtils . isEmpty ( dto . getData ( ) ) ? "%%" : "%" + dto . getData ( ) + "%" ; ;
/ / 分页查询
Page < Map < String , Object > > pageMap = archivesSummaryRepository . externalGet ( dto . getStoreCode ( ) , quCol , 0 , data , page ) ;
json . put ( "protocal" , 1001 ) ;
json . put ( "code" , 0 ) ;
JSONArray jsonArray = new JSONArray ( ) ;
List < Map < String , Object > > resultMap = pageMap . getContent ( ) ;
for ( Map < String , Object > map : resultMap ) {
JSONObject resultJson = new JSONObject ( ) ;
resultJson . put ( "filename" , map . get ( "filename" ) ) ;
resultJson . put ( "fileno" , map . get ( "fileno" ) ) ;
resultJson . put ( "makedate" , map . get ( "makedate" ) ) ;
resultJson . put ( "filetype" , map . get ( "filetype" ) ) ;
resultJson . put ( "filecode" , map . get ( "filecode" ) ) ;
resultJson . put ( "keepday" , map . get ( "keepday" ) ) ;
resultJson . put ( "position" , map . get ( "position" ) . toString ( ) . replaceAll ( "-" , " " ) ) ;
resultJson . put ( "storeCode" , map . get ( "storeCode" ) ) ;
resultJson . put ( "editdate" , map . get ( "editdate" ) ) ;
resultJson . put ( "enclosure" , map . get ( "enclosure" ) ) ;
Integer filestatus = map . get ( "filestatus" ) = = null ? 0 : Integer . parseInt ( map . get ( "filestatus" ) . toString ( ) ) ;
Integer inputFilestatus = 8 ;
if ( filestatus = = 1 ) {
inputFilestatus = 2 ;
} else if ( filestatus = = 2 ) {
inputFilestatus = 4 ;
} else if ( filestatus = = 3 ) {
inputFilestatus = 6 ;
}
resultJson . put ( "filestatus" , inputFilestatus ) ;
String [ ] splitPostion = map . get ( "location" ) . toString ( ) . split ( "-" ) ;
resultJson . put ( "quNo" , splitPostion [ 0 ] ) ;
resultJson . put ( "colNo" , splitPostion [ 1 ] ) ;
resultJson . put ( "leNo" , splitPostion [ 2 ] ) ;
resultJson . put ( "divNo" , splitPostion [ 3 ] ) ;
resultJson . put ( "zyNo" , splitPostion [ 4 ] ) ;
JSONObject positionKeyJson = new JSONObject ( ) ;
positionKeyJson . put ( "quNo" , splitPostion [ 0 ] ) ;
positionKeyJson . put ( "colNo" , splitPostion [ 1 ] ) ;
positionKeyJson . put ( "leNo" , splitPostion [ 2 ] ) ;
positionKeyJson . put ( "divNo" , splitPostion [ 3 ] ) ;
positionKeyJson . put ( "zyNo" , splitPostion [ 4 ] ) ;
positionKeyJson . put ( "storeCode" , map . get ( "storeCode" ) ) ;
resultJson . put ( "positionKey" , positionKeyJson ) ;
jsonArray . add ( resultJson ) ;
}
JSONObject jsonContext = new JSONObject ( ) ;
jsonContext . put ( "list" , jsonArray ) ;
jsonContext . put ( "count" , jsonArray . size ( ) ) ;
jsonContext . put ( "currentPages" , dto . getPn ( ) ) ;
json . put ( "result" , jsonContext ) ;
json . put ( "errorinfo" , null ) ;
return json ;
}
}