Skip to content

Commit d48b5a7

Browse files
Merge branch 'dev'
2 parents d023369 + 58a20a0 commit d48b5a7

13 files changed

Lines changed: 148 additions & 43 deletions

File tree

pom.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
</parent>
1111
<groupId>cc.altius.FASP.rest.webservice</groupId>
1212
<artifactId>FASP</artifactId>
13-
<version>2.124[5810]</version>
13+
<version>2.124[5824]</version>
1414
<name>QAT</name>
1515
<description>Quantification Analytics Tool</description>
1616
<packaging>jar</packaging>

src/main/java/cc/altius/FASP/dao/impl/DashboardDaoImpl.java

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,16 @@ public List<DashboardTop> getDashboardTop(String[] programIds, CustomUserDetails
197197
List<DashboardTop> edList = this.namedParameterJdbcTemplate.query(sqlBuilder.toString(), params, new DashboardTopRowMapper());
198198
Date curMonth = DateUtils.getStartOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), -1 * curUser.getRealm().getNoOfMonthsInPastForTopDashboard()));
199199
Date endMonth = DateUtils.getEndOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), curUser.getRealm().getNoOfMonthsInFutureForTopDashboard() - 1));
200+
Date curMonthForScore = DateUtils.getStartOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), 0));
201+
Date endMonthForScore = DateUtils.getEndOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), 17));
200202
edList.forEach(ed -> {
201203
String sql1 = "SELECT SUM(IF(s1.`SUM_STOCK_OUT`>0,1,0)) `PRODUCTS_WITH_STOCK_OUT` FROM (SELECT sma.PROGRAM_ID, sma.PLANNING_UNIT_ID, SUM(IF(sma.MOS=0,1,0)) `SUM_STOCK_OUT` FROM vw_program p LEFT JOIN rm_program_planning_unit ppu ON p.PROGRAM_ID=ppu.PROGRAM_ID AND ppu.ACTIVE LEFT JOIN rm_planning_unit pu ON ppu.PLANNING_UNIT_ID=pu.PLANNING_UNIT_ID AND pu.ACTIVE LEFT JOIN rm_supply_plan_amc sma ON p.PROGRAM_ID=sma.PROGRAM_ID AND p.CURRENT_VERSION_ID=sma.VERSION_ID AND pu.PLANNING_UNIT_ID=sma.PLANNING_UNIT_ID WHERE p.PROGRAM_ID=:programId AND sma.TRANS_DATE BETWEEN :curMonth AND :endMonth group by sma.PROGRAM_ID, sma.PLANNING_UNIT_ID) s1 GROUP BY s1.PROGRAM_ID";
202204
Map<String, Object> eParams = new HashMap<>();
203205
eParams.put("programId", ed.getProgram().getId());
204206
eParams.put("curMonth", curMonth);
205207
eParams.put("endMonth", endMonth);
208+
eParams.put("curMonthForScore", curMonthForScore);
209+
eParams.put("endMonthForScore", endMonthForScore);
206210
String sql2 = "SELECT SUM(ROUND(p1.EXPIRED_STOCK*st.RATE,0)) EXPIRED_VALUE "
207211
+ " FROM ( "
208212
+ " SELECT "
@@ -231,7 +235,7 @@ public List<DashboardTop> getDashboardTop(String[] programIds, CustomUserDetails
231235

232236
}
233237

234-
String sqlString = "CALL getDashboardStockStatus(:curMonth, :endMonth, :programId)";
238+
String sqlString = "CALL getDashboardStockStatus(:curMonthForScore, :endMonthForScore, :programId)";
235239
ed.setStockStatus(this.namedParameterJdbcTemplate.queryForObject(sqlString, eParams, new DashboardStockStatusRowMapper()));
236240

237241
sqlString = "CALL getDashboardForecastConsumptionProblems(:programId)";
@@ -252,17 +256,21 @@ public List<DashboardTop> getDashboardTop(String[] programIds, CustomUserDetails
252256
@Override
253257
public DashboardBottom getDashboardBottom(int programId, String startDate, String stopDate, int displayShipmentsBy, CustomUserDetails curUser) throws ParseException {
254258
DashboardBottom db = new DashboardBottom();
255-
String sqlString = "CALL getDashboardStockStatus(:startDate, :stopDate, :programId)";
259+
Date curMonthForScore = DateUtils.getStartOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), 0));
260+
Date endMonthForScore = DateUtils.getEndOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), 17));
261+
String sqlString = "CALL getDashboardStockStatus(:curMonthForScore, :endMonthForScore, :programId)";
256262
Map<String, Object> params = new HashMap<>();
257263
params.put("programId", programId);
258264
params.put("startDate", startDate);
259265
params.put("stopDate", DateUtils.getEndOfMonthVariable(stopDate));
266+
params.put("curMonthForScore", curMonthForScore);
267+
params.put("endMonthForScore", endMonthForScore);
260268
params.put("curDate", DateUtils.getCurrentDateString(DateUtils.EST, DateUtils.YMD));
261269
params.put("curStartOfMonth", DateUtils.getStartOfMonthString(DateUtils.YMD));
262270
params.put("curEndOfMonth", DateUtils.getEndOfMonthString(DateUtils.YMD));
263271
db.setStockStatus(this.namedParameterJdbcTemplate.queryForObject(sqlString, params, new DashboardStockStatusRowMapper()));
264272

265-
sqlString = "CALL getDashboardStockOutCount(:startDate, :stopDate, :programId, -1)";
273+
sqlString = "CALL getDashboardStockOutCount(:curMonthForScore, :endMonthForScore, :programId, -1)";
266274
// logger.debug(LogUtils.buildStringForLog(sqlString, params));
267275
db.getStockStatus().setPuStockOutList(this.namedParameterJdbcTemplate.query(sqlString, params, new DashboardPuWithCountRowMapper()).stream().filter(d -> d.getCount() > 0).collect(Collectors.toList()));
268276
// logger.debug(LogUtils.buildStringForLog("completed", params));
@@ -313,14 +321,16 @@ public DashboardBottom getDashboardBottom(int programId, String startDate, Strin
313321

314322
@Override
315323
public DashboardForLoadProgram getDashboardForLoadProgram(int programId, int versionId, int noOfMonthsInPastForBottom, int noOfMonthsInFutureForBottom, int noOfMonthsInPastForTop, int noOfMonthsInFutureForTop, CustomUserDetails curUser) throws ParseException {
324+
Date curMonthForScore = DateUtils.getStartOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), 0));
325+
Date endMonthForScore = DateUtils.getEndOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), 17));
316326
DashboardForLoadProgram db = new DashboardForLoadProgram();
317327
db.setCurDate(DateUtils.getCurrentDateObject(DateUtils.EST));
318328
db.setStartDateBottom(DateUtils.getStartOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), -1 * noOfMonthsInPastForBottom)));
319329
db.setStopDateBottom(DateUtils.getEndOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), noOfMonthsInFutureForBottom - 1)));
320330
db.setStartDateTop(DateUtils.getStartOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), -1 * noOfMonthsInPastForTop)));
321331
db.setStopDateTop(DateUtils.getEndOfMonthVariable(DateUtils.addMonths(DateUtils.getCurrentDateObject(DateUtils.EST), noOfMonthsInFutureForTop - 1)));
322332

323-
String sqlString = "CALL getDashboardStockStatusForLoadProgram(:startDateBottom, :stopDateBottom, :programId, :versionId)";
333+
String sqlString = "CALL getDashboardStockStatusForLoadProgram(:curMonthForScore, :endMonthForScore, :programId, :versionId)";
324334
Map<String, Object> params = new HashMap<>();
325335
params.put("programId", programId);
326336
params.put("versionId", versionId);
@@ -331,6 +341,8 @@ public DashboardForLoadProgram getDashboardForLoadProgram(int programId, int ver
331341
params.put("curDate", db.getCurDate());
332342
params.put("curStartOfMonth", DateUtils.getStartOfMonthString(DateUtils.YMD));
333343
params.put("curEndOfMonth", DateUtils.getEndOfMonthString(DateUtils.YMD));
344+
params.put("curMonthForScore", curMonthForScore);
345+
params.put("endMonthForScore", endMonthForScore);
334346
this.namedParameterJdbcTemplate.query(sqlString, params, new DashboardStockStatusForLoadProgramResultSetExtractor(db));
335347

336348
sqlString = "SELECT p1.*, st.`RATE` FROM (SELECT "
@@ -363,7 +375,7 @@ public DashboardForLoadProgram getDashboardForLoadProgram(int programId, int ver
363375
this.namedParameterJdbcTemplate.query(sqlString, params, new DashboardQplForLoadProgramResultSetExtractor(db, 3));
364376
sqlString = "CALL getDashboardShipmentProblemsForLoadProgram(:programId, :versionId, :curEndOfMonth)";
365377
this.namedParameterJdbcTemplate.query(sqlString, params, new DashboardQplForLoadProgramResultSetExtractor(db, 4));
366-
sqlString = "CALL getDashboardStockOutCount(:startDateTop, :stopDateTop, :programId, :versionId)";
378+
sqlString = "CALL getDashboardStockOutCount(:curMonthForScore, :endMonthForScore, :programId, :versionId)";
367379
this.namedParameterJdbcTemplate.query(sqlString, params, new DashboardTopStockOutForLoadProgramResultSetExtractor(db));
368380
sqlString = "CALL getDashboardExpiriesList(:startDateTop, :stopDateTop, :programId, :versionId)";
369381
this.namedParameterJdbcTemplate.query(sqlString, params, new DashboardTopExpiriesForLoadProgramResultSetExtractor(db));

src/main/java/cc/altius/FASP/dao/impl/ErpLinkingDaoImpl.java

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1787,8 +1787,11 @@ public int getNotificationCount(CustomUserDetails curUser) {
17871787
// System.out.println("ids%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" + programIds);
17881788
sql = "SELECT COUNT(*) FROM ( "
17891789
+ "SELECT n.`NOTIFICATION_ID` FROM rm_erp_notification n "
1790-
+ " LEFT JOIN rm_shipment_linking s ON s.SHIPMENT_LINKING_ID=n.SHIPMENT_LINKING_ID "
1791-
+ " WHERE n.`ACTIVE` AND s.ACTIVE AND n.`ADDRESSED`=0 AND s.`PROGRAM_ID` IN (" + programIds + ") GROUP BY n.`NOTIFICATION_ID` ) AS a;";
1790+
+ " LEFT JOIN rm_shipment_linking sl ON sl.SHIPMENT_LINKING_ID=n.SHIPMENT_LINKING_ID "
1791+
+ " left join rm_shipment s on s.SHIPMENT_ID=sl.CHILD_SHIPMENT_ID "
1792+
+ " left join rm_shipment_trans st on st.SHIPMENT_ID=s.SHIPMENT_ID and st.VERSION_ID=s.MAX_VERSION_ID "
1793+
+ " left join rm_program_planning_unit ppu on ppu.PROGRAM_ID = sl.PROGRAM_ID AND ppu.PLANNING_UNIT_ID=st.PLANNING_UNIT_ID "
1794+
+ " WHERE n.`ACTIVE` AND sl.ACTIVE AND n.`ADDRESSED`=0 AND sl.`PROGRAM_ID` IN (" + programIds + ") and ppu.PROGRAM_PLANNING_UNIT_ID IS NOT NULL and ppu.ACTIVE GROUP BY n.`NOTIFICATION_ID` ) AS a;";
17921795
return this.jdbcTemplate.queryForObject(sql, Integer.class);
17931796
}
17941797

@@ -1813,14 +1816,17 @@ public List<NotificationSummaryDTO> getNotificationSummary(CustomUserDetails cur
18131816
}
18141817
programIds = programIds.substring(0, programIds.lastIndexOf(","));
18151818
// System.out.println("ids 1%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%" + programIds);
1816-
sql = "SELECT s.`PROGRAM_ID`,p.`LABEL_ID`,p.`LABEL_EN`,p.`LABEL_FR`,p.`LABEL_SP`,p.`LABEL_PR`, "
1819+
sql = "SELECT sl.`PROGRAM_ID`,p.`LABEL_ID`,p.`LABEL_EN`,p.`LABEL_FR`,p.`LABEL_SP`,p.`LABEL_PR`, "
18171820
+ " COUNT(DISTINCT(n.`NOTIFICATION_ID`)) as NOTIFICATION_COUNT "
18181821
+ " FROM rm_erp_notification n "
1819-
+ " LEFT JOIN rm_shipment_linking s ON s.SHIPMENT_LINKING_ID=n.SHIPMENT_LINKING_ID "
1822+
+ " LEFT JOIN rm_shipment_linking sl ON sl.SHIPMENT_LINKING_ID=n.SHIPMENT_LINKING_ID "
18201823
+ " LEFT JOIN vw_program p ON p.`PROGRAM_ID`=s.`PROGRAM_ID` "
1821-
+ " WHERE n.`ACTIVE` AND s.ACTIVE AND n.`ADDRESSED`=0 "
1822-
+ " AND s.`PROGRAM_ID` IN (" + programIds + ") "
1823-
+ " GROUP BY s.`PROGRAM_ID` ;";
1824+
+ " left join rm_shipment s on s.SHIPMENT_ID=sl.CHILD_SHIPMENT_ID "
1825+
+ " left join rm_shipment_trans st on st.SHIPMENT_ID=s.SHIPMENT_ID and st.VERSION_ID=s.MAX_VERSION_ID "
1826+
+ " left join rm_program_planning_unit ppu on ppu.PROGRAM_ID = sl.PROGRAM_ID AND ppu.PLANNING_UNIT_ID=st.PLANNING_UNIT_ID "
1827+
+ " WHERE n.`ACTIVE` AND sl.ACTIVE AND n.`ADDRESSED`=0 and ppu.PROGRAM_PLANNING_UNIT_ID IS NOT NULL and ppu.ACTIVE "
1828+
+ " AND sl.`PROGRAM_ID` IN (" + programIds + ") "
1829+
+ " GROUP BY sl.`PROGRAM_ID` ;";
18241830
return this.jdbcTemplate.query(sql, new NotificationSummaryDTORowMapper());
18251831
}
18261832

src/main/java/cc/altius/FASP/dao/impl/ProblemDaoImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ public List<RealmProblem> getProblemListByRealmId(int realmId, CustomUserDetails
113113

114114
@Override
115115
public List<ProblemReport> getProblemReportList(int programId, int versionId, CustomUserDetails curUser) {
116-
String sql = this.problemReportSql + " AND rp.ACTIVE ORDER BY prr.PROBLEM_REPORT_ID, prt.PROBLEM_REPORT_TRANS_ID";
116+
String sql = this.problemReportSql + " ORDER BY prr.PROBLEM_REPORT_ID, prt.PROBLEM_REPORT_TRANS_ID";
117117
Map<String, Object> params = new HashMap<>();
118118
params.put("programId", programId);
119119
params.put("versionId", versionId);

src/main/resources/application.properties

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@ syncExpiresOn=15
3131

3232
info.app.name=QAT
3333
info.app.description=Quantification Analytics Tool
34-
info.app.version=2.124[5810]
35-
info.app.frontEndVersion=[13897]
34+
info.app.version=2.124[5824]
35+
info.app.frontEndVersion=[13938]
3636
management.endpoints.web.exposure.include=*
3737
management.info.env.enabled = true
3838
management.endpoint.sessions.enabled=true

0 commit comments

Comments
 (0)