Commit 1b15143c authored by neo's avatar neo

[DEV] fixed BB can add manual datasource

parent 160a3bfe
......@@ -641,6 +641,8 @@ public class ReportGeneratorImpl {
if (!parameter.isEmpty()) {
List<PCTEntity> pctResults = periodCellDataMapper.queryByPCTs(parameter, projectId);
List<PCTEntity> manuaPctResults = periodCellDataMapper.queryManualPCTs(parameter, projectId);
Map<PCTEntity, BigDecimal> pctCache = new HashMap<>();
pctResults.forEach(m -> {
BigDecimal data = null;
......@@ -653,6 +655,20 @@ public class ReportGeneratorImpl {
pctCache.put(m, data);
});
manuaPctResults.forEach(m -> {
BigDecimal data = null;
try {
data = new BigDecimal(m.getData());
} catch (NumberFormatException e) {
logger.warn("number format ecption for parameter {}", m);
data = BigDecimal.ZERO;
}
if (!pctCache.containsKey(m))
pctCache.put(m, data);
else pctCache.get(m).add(data);
});
configMapToPCTs.forEach((k, v) -> {
v.forEach(pctStr -> {
List<PCTEntity> entities = formulaMapToPCT.get(pctStr);
......
......@@ -117,7 +117,7 @@ public interface PeriodCellDataMapper extends MyVatMapper {
@Select("<script>" +
"SELECT " +
" R.PERIOD, C.CELL_TEMPLATE_ID AS CELLTEMPLATEID, DATA " +
" R.PERIOD as period, C.CELL_TEMPLATE_ID AS cellTemplateId, DATA as data " +
"FROM " +
" PERIOD_CELL_DATA C, " +
" PERIOD_REPORT R " +
......@@ -132,7 +132,22 @@ public interface PeriodCellDataMapper extends MyVatMapper {
"</script>")
List<PCTEntity> queryByPCTs(@Param("list") Set<PCTEntity> parameter, @Param("projectId") String projectId);
@Select("<script>" +
"SELECT " +
" p.PERIOD AS period, " +
" p.CELL_TEMPLATE_ID AS cellTemplateId, " +
" p.AMOUNT AS data " +
"FROM " +
" PERIOD_DATA_SOURCE p " +
"WHERE " +
" PROJECT_ID = #{projectId} " +
" <foreach item=\"item\" index=\"index\" collection=\"list\"" +
" open=\"(\" separator=\"OR\" close=\")\">" +
" ( p.PERIOD=#{item.period} AND p.CELL_TEMPLATE_ID=#{item.cellTemplateId} )" +
" </foreach>" +
"</script>")
List<PCTEntity> queryManualPCTs(@Param("list") Set<PCTEntity> parameter, @Param("projectId") String projectId);
@Select("" +
"SELECT " +
" d.ID AS id, " +
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment