Resources information on planet list
* Added resource information records to the planet list's response. * Added a database view and the corresponding row mapper and DAO method which can be used as the data source for the planet list's resource information. For now this view always returns 0 for both civilian and military investments. * Added new tab to display resource information on the planet list page. The old version of the economy tab will be kept until the corresponding data no longer exists. * The following SQL scripts must be re-executed to upgrade a database: -> 040-functions/167-planet-list.sql
This commit is contained in:
parent
bf6bea5a79
commit
96670d45be
15 changed files with 1079 additions and 31 deletions
legacyworlds-server-beans-simple/src/main/java/com/deepclone/lw/beans/empire
|
@ -1,8 +1,10 @@
|
|||
package com.deepclone.lw.beans.empire;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
@ -16,6 +18,7 @@ import com.deepclone.lw.cmd.player.elist.EnemyListResponse;
|
|||
import com.deepclone.lw.cmd.player.gdata.GamePageData;
|
||||
import com.deepclone.lw.cmd.player.gdata.NameIdPair;
|
||||
import com.deepclone.lw.cmd.player.gdata.PlanetListData;
|
||||
import com.deepclone.lw.cmd.player.gdata.PlanetListResourceRecord;
|
||||
import com.deepclone.lw.cmd.player.gdata.battles.BattleListEntry;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.OverviewData;
|
||||
import com.deepclone.lw.cmd.player.gdata.empire.ResearchLineData;
|
||||
|
@ -177,9 +180,19 @@ public class EmpireManagementBean
|
|||
@Override
|
||||
public ListPlanetsResponse getPlanetList( int empireId )
|
||||
{
|
||||
GamePageData page = this.getGeneralInformation( empireId );
|
||||
List< PlanetListData > planets = this.empireDao.getPlanetList( empireId );
|
||||
return new ListPlanetsResponse( page , planets );
|
||||
|
||||
Map< Integer , List< PlanetListResourceRecord >> resources;
|
||||
resources = this.resourcesInformationDao.getPlanetListData( empireId );
|
||||
for ( PlanetListData planet : planets ) {
|
||||
List< PlanetListResourceRecord > planetResources = resources.get( planet.getId( ) );
|
||||
if ( planetResources == null ) {
|
||||
planetResources = new ArrayList< PlanetListResourceRecord >( );
|
||||
}
|
||||
planet.setResources( planetResources );
|
||||
}
|
||||
|
||||
return new ListPlanetsResponse( this.getGeneralInformation( empireId ) , planets );
|
||||
}
|
||||
|
||||
|
||||
|
|
Reference in a new issue