@@ -1437,7 +1437,8 @@ public static LatestActivitiesDTO getLatestActivitiesForUserProjects(long userId
14371437 final Map <Long , ProjectBriefDTO > projects = new HashMap <Long , ProjectBriefDTO >();
14381438 final Map <Long , TypedContestBriefDTO > contests = new HashMap <Long , TypedContestBriefDTO >();//here
14391439
1440- final ResultSetContainer resultContainer = dataAccessor .getData (request ).get ("direct_latest_activities_replatforming" );
1440+ final ResultSetContainer resultContainer = dataAccessor .getData (request ).get (
1441+ "direct_latest_activities_replatforming" );
14411442 final int recordNum = resultContainer .size ();
14421443
14431444 for (int i = 0 ; i < recordNum ; i ++) {
@@ -2043,7 +2044,7 @@ private static List<ForumPoster> getLatestThreePosters(String lastPosters) throw
20432044 public static List <DashboardContestSearchResultDTO > searchUserContests (TCSubject tcSubject , String searchFor ,
20442045 final Date begin , final Date end ) throws Exception {
20452046 List <CommonProjectContestData > contests = DirectUtils .getContestServiceFacade ().getCommonProjectContestData (
2046- tcSubject );
2047+ tcSubject );
20472048 List <CommonProjectContestData > filteredContests ;
20482049 if (StringUtils .isBlank (searchFor ) && begin == null && end == null ) {
20492050 filteredContests = contests ;
@@ -2416,7 +2417,7 @@ public static void getDashboardProjectMetricsReport(TCSubject currentUser, long
24162417 stats .setTotalBudget (row .getStringItem ("total_budget" ));
24172418 stats .setActualCost (row .getDoubleItem ("actual_cost" ));
24182419 stats .setStartDate (getDate (row ,"create_date" ));
2419- stats .setCompletionDate (getDate (row ,"completion_date" ));
2420+ stats .setCompletionDate (getDate (row , "completion_date" ));
24202421 stats .setTotalContests (row .getIntItem ("total_number" ));
24212422
24222423 // draft
@@ -2440,8 +2441,8 @@ public static void getDashboardProjectMetricsReport(TCSubject currentUser, long
24402441 stats .setCostCanceled (row .getDoubleItem ("cost_cancelled" ));
24412442
24422443 stats .setProjectedCost (row .getDoubleItem ("cost_draft" ) + row .getDoubleItem ("cost_scheduled" ) +
2443- row .getDoubleItem ("cost_active" ) + row .getDoubleItem ("cost_finished" ) +
2444- row .getDoubleItem ("cost_cancelled" ) + row .getDoubleItem ("project_level_cost" ));
2444+ row .getDoubleItem ("cost_active" ) + row .getDoubleItem ("cost_finished" ) +
2445+ row .getDoubleItem ("cost_cancelled" ) + row .getDoubleItem ("project_level_cost" ));
24452446
24462447 stats .setPlannedCost (row .getDoubleItem ("planned_cost" ));
24472448 statses .add (stats );
@@ -3006,7 +3007,8 @@ public static List<TypedContestBriefDTO> getProjectTypedContests(long userId, lo
30063007 final Map <Long , ProjectBriefDTO > projects = new HashMap <Long , ProjectBriefDTO >();
30073008 final List <TypedContestBriefDTO > contests = new ArrayList <TypedContestBriefDTO >();
30083009
3009- final ResultSetContainer resultContainer = dataAccessor .getData (request ).get ("direct_my_typed_contests_replatforming" );
3010+ final ResultSetContainer resultContainer = dataAccessor .getData (request ).get (
3011+ "direct_my_typed_contests_replatforming" );
30103012 final int recordNum = resultContainer .size ();
30113013 for (int i = 0 ; i < recordNum ; i ++) {
30123014 long tcDirectProjectId = resultContainer .getLongItem (i , "tc_direct_project_id" );
@@ -7282,7 +7284,7 @@ public static List<EnterpriseDashboardMonthPipelineDTO> getEnterpriseDashboardCo
72827284 String phases = resultContainer .getStringItem (i , "phases" );
72837285
72847286 long monthCount = resultContainer .getLongItem (i , "monthcount" );
7285- EnterpriseDashboardMonthPipelineDTO item = resultMap .get ((monthCount / 100 ) * 12 + (monthCount % 100 ) -1 );
7287+ EnterpriseDashboardMonthPipelineDTO item = resultMap .get ((monthCount / 100 ) * 12 + (monthCount % 100 ) - 1 );
72867288
72877289 if (currentPhase != null && ((String )status ).equalsIgnoreCase (ProjectStatus .ACTIVE .getName ())) {
72887290 // active
@@ -7499,7 +7501,7 @@ else if (((String)status).equalsIgnoreCase(ProjectStatus.DRAFT.getName()))
74997501 long monthCount = resultContainer .getLongItem (i , "monthcount" );
75007502
75017503 EnterpriseDashboardMonthProjectPipelineDTO item =
7502- resultMap .get ((monthCount / 100 ) * 12 + (monthCount % 100 ) -1 );
7504+ resultMap .get ((monthCount / 100 ) * 12 + (monthCount % 100 ) - 1 );
75037505
75047506 if (projectStatusId == 4L ) {
75057507 item .setTotalCompletedProjects (item .getTotalCompletedProjects () + 1 );
@@ -7914,6 +7916,34 @@ public static InputStream generateWinnerSheet(long tcDirectProjectId) throws Exc
79147916 return new ByteArrayInputStream (saveTo .toByteArray ());
79157917 }
79167918
7919+ /**
7920+ * Gets the demand work id of the direct project, return null if the project does not exist or the direct project does not
7921+ * demand work id.
7922+ *
7923+ * @param tcDirectProjectId the id of the direct project
7924+ * @return the demand work id of the direct project or null the project does not exist or the direct project does not
7925+ * demand work id.
7926+ * @throws Exception if any error
7927+ */
7928+ public static String getDirectProjectDemandWorkId (long tcDirectProjectId ) throws Exception {
7929+ DataAccess dataAccessor = new DataAccess (DBMS .TCS_OLTP_DATASOURCE_NAME );
7930+ Request request = new Request ();
7931+ request .setContentHandle ("project_name" );
7932+ request .setProperty ("tcdirectid" , String .valueOf (tcDirectProjectId ));
7933+ ResultSetContainer resultSetContainer = dataAccessor .getData (request ).get ("project_contest_results" );
7934+
7935+ if (resultSetContainer != null && resultSetContainer .size () > 0 ) {
7936+ ResultSetRow resultSetRow = resultSetContainer .get (0 );
7937+ if (resultSetRow .getItem ("demand_work_id" ).getResultData () != null ) {
7938+ return resultSetRow .getStringItem ("demand_work_id" );
7939+ } else {
7940+ return null ;
7941+ }
7942+ }
7943+
7944+ return null ;
7945+ }
7946+
79177947 /**
79187948 * <p>Generates the <code>Excel</code> worksheet with results for contests for specified <code>TC Direct</code>
79197949 * project.</p>
0 commit comments