Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@@ -43,9 +43,9 @@ public class ChartDao implements ChartPortOut {
|
|||||||
// 관리자 일경우
|
// 관리자 일경우
|
||||||
return new ChartDto(
|
return new ChartDto(
|
||||||
recordMonthText,
|
recordMonthText,
|
||||||
chartMapper.selectTotalPercentage(reqVO),
|
chartMapper.selectTotalPercentage(reqVO,activeProfiles),
|
||||||
chartMapper.selectLocalRegionPercentage(reqVO),
|
chartMapper.selectLocalRegionPercentage(reqVO,activeProfiles),
|
||||||
chartMapper.selectLocalRegionResearcherPercentage(reqVO),
|
chartMapper.selectLocalRegionResearcherPercentage(reqVO,activeProfiles),
|
||||||
uiCodeListMapper.findByParentId("code.region.main",AdminUtil.getLoginUserRole(),activeProfiles));
|
uiCodeListMapper.findByParentId("code.region.main",AdminUtil.getLoginUserRole(),activeProfiles));
|
||||||
|
|
||||||
} else if("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
} else if("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
||||||
@@ -54,14 +54,14 @@ public class ChartDao implements ChartPortOut {
|
|||||||
|
|
||||||
return new ChartDto(
|
return new ChartDto(
|
||||||
recordMonthText,
|
recordMonthText,
|
||||||
chartMapper.selectTotalPercentage(reqVO),
|
chartMapper.selectTotalPercentage(reqVO,activeProfiles),
|
||||||
null,
|
null,
|
||||||
chartMapper.selectLocalRegionResearcherPercentage(reqVO),
|
chartMapper.selectLocalRegionResearcherPercentage(reqVO,activeProfiles),
|
||||||
null);
|
null);
|
||||||
} else if("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
} else if("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
||||||
// 조사원 일경우
|
// 조사원 일경우
|
||||||
reqVO.setAdminSeq(AdminUtil.getLoginUserSeq());
|
reqVO.setAdminSeq(AdminUtil.getLoginUserSeq());
|
||||||
return new ChartDto(recordMonthText, chartMapper.selectTotalPercentageResearcher(reqVO), null,null,null);
|
return new ChartDto(recordMonthText, chartMapper.selectTotalPercentageResearcher(reqVO,activeProfiles), null,null,null);
|
||||||
}
|
}
|
||||||
|
|
||||||
return new ChartDto(null,null,null,null,null);
|
return new ChartDto(null,null,null,null,null);
|
||||||
@@ -73,7 +73,7 @@ public class ChartDao implements ChartPortOut {
|
|||||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
||||||
String formattedDate = today.format(formatter);
|
String formattedDate = today.format(formatter);
|
||||||
if("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
if("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
||||||
return chartMapper.selectLocalRegionResearcherPercentage(new TotalPercentageReqVO(usageType,regionMainCode,formattedDate));
|
return chartMapper.selectLocalRegionResearcherPercentage(new TotalPercentageReqVO(usageType,regionMainCode,formattedDate),activeProfiles);
|
||||||
}else{
|
}else{
|
||||||
throw new NoMatchingURIException("잘못된 접근");
|
throw new NoMatchingURIException("잘못된 접근");
|
||||||
}
|
}
|
||||||
@@ -82,7 +82,7 @@ public class ChartDao implements ChartPortOut {
|
|||||||
@Override
|
@Override
|
||||||
public DashboardExcelDto selectDashboard(String recordMonth) {
|
public DashboardExcelDto selectDashboard(String recordMonth) {
|
||||||
return new DashboardExcelDto(
|
return new DashboardExcelDto(
|
||||||
chartMapper.selectRegionMainExcel(recordMonth),
|
chartMapper.selectRegionMainExcel(recordMonth,activeProfiles),
|
||||||
chartMapper.selectRegionDetailExcel(recordMonth));
|
chartMapper.selectRegionDetailExcel(recordMonth,activeProfiles));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,17 +3,18 @@ package app.module.admin.usecase.dashboard.chart.adapters.persistence;
|
|||||||
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.*;
|
import app.module.admin.usecase.dashboard.chart.adapters.persistence.model.*;
|
||||||
import app.module.admin.usecase.dashboard.chart.adapters.web.model.TotalPercentageReqVO;
|
import app.module.admin.usecase.dashboard.chart.adapters.web.model.TotalPercentageReqVO;
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface ChartMapper {
|
public interface ChartMapper {
|
||||||
|
|
||||||
TotalPercentDto selectTotalPercentage(TotalPercentageReqVO reqVO);
|
TotalPercentDto selectTotalPercentage(@Param("reqVO") TotalPercentageReqVO reqVO,@Param("activeProfiles") String activeProfiles);
|
||||||
TotalPercentDto selectTotalPercentageResearcher(TotalPercentageReqVO reqVO);
|
TotalPercentDto selectTotalPercentageResearcher(@Param("reqVO") TotalPercentageReqVO reqVO,@Param("activeProfiles") String activeProfiles);
|
||||||
List<LocalRegionPercentDto> selectLocalRegionPercentage(TotalPercentageReqVO reqVO);
|
List<LocalRegionPercentDto> selectLocalRegionPercentage(@Param("reqVO") TotalPercentageReqVO reqVO,@Param("activeProfiles") String activeProfiles);
|
||||||
List<LocalRegionResearcherPercentDto> selectLocalRegionResearcherPercentage(TotalPercentageReqVO reqVO);
|
List<LocalRegionResearcherPercentDto> selectLocalRegionResearcherPercentage(@Param("reqVO") TotalPercentageReqVO reqVO,@Param("activeProfiles") String activeProfiles);
|
||||||
List<RegionMainExcelDto> selectRegionMainExcel(String recordMonth);
|
List<RegionMainExcelDto> selectRegionMainExcel(@Param("recordMonth") String recordMonth,@Param("activeProfiles") String activeProfiles);
|
||||||
List<RegionDetailExcelDto> selectRegionDetailExcel(String recordMonth);
|
List<RegionDetailExcelDto> selectRegionDetailExcel(@Param("recordMonth") String recordMonth,@Param("activeProfiles") String activeProfiles);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -155,12 +155,21 @@ class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut
|
|||||||
|
|
||||||
private String getUiCode(Cell cell,List<UICodeElement> uiCodeElementList,String codeId){
|
private String getUiCode(Cell cell,List<UICodeElement> uiCodeElementList,String codeId){
|
||||||
if (cell == null) return "";
|
if (cell == null) return "";
|
||||||
|
try {
|
||||||
|
String cellValue = cell.getStringCellValue().trim();
|
||||||
|
String[] cellValueParts = cellValue.split("\\.");
|
||||||
|
|
||||||
return uiCodeElementList.stream().filter(code -> {
|
return uiCodeElementList.stream().filter(code -> {
|
||||||
String[] cellValue = cell.getStringCellValue().trim().split("\\.");
|
if(cellValueParts.length == 1 ) return code.getCodeText().equals(codeId+"."+cellValueParts[0]) || code.getCodeText().equals(cellValueParts[0]) ;
|
||||||
return code.getId().equals(codeId+"."+cellValue[0]) || code.getCodeText().equals(cellValue[1]) ;
|
if(cellValueParts.length == 2 ) return code.getId().equals(codeId+"."+cellValueParts[0]) || code.getCodeText().equals(cellValueParts[1]) ;
|
||||||
|
return Boolean.parseBoolean(null);
|
||||||
} )
|
} )
|
||||||
.findFirst()
|
.findFirst()
|
||||||
.map(UICodeElement::getId).orElse("");
|
.map(UICodeElement::getId).orElse("");
|
||||||
|
} catch (ArrayIndexOutOfBoundsException e) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private ExcelUploadContactVO getDivisionContact(Cell cell){
|
private ExcelUploadContactVO getDivisionContact(Cell cell){
|
||||||
|
|||||||
@@ -12,15 +12,15 @@
|
|||||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
||||||
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1) , 0 ) as gift_sent_percent
|
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1) , 0 ) as gift_sent_percent
|
||||||
FROM household h
|
FROM household h
|
||||||
JOIN uicode u on u.parent_id ='code.region.main' and u.in_use = true and u.is_deleted = false
|
JOIN uicode u on u.parent_id ='code.region.main' and u.is_deleted = false <if test="'prod'.equals(activeProfiles)"> and u.in_use = true </if>
|
||||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{recordMonth}
|
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{reqVO.recordMonth}
|
||||||
LEFT join household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{recordMonth} and hv.is_deleted = false
|
LEFT join household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{reqVO.recordMonth} and hv.is_deleted = false
|
||||||
WHERE h.is_deleted = false
|
WHERE h.is_deleted = false
|
||||||
<if test="usageType != null and usageType != ''">
|
<if test="reqVO.usageType != null and reqVO.usageType != ''">
|
||||||
and h.usage_type = #{usageType}
|
and h.usage_type = #{reqVO.usageType}
|
||||||
</if>
|
</if>
|
||||||
<if test="regionMainCode != null and regionMainCode != ''">
|
<if test="reqVO.regionMainCode != null and reqVO.regionMainCode != ''">
|
||||||
and h.region_main_code = #{regionMainCode}
|
and h.region_main_code = #{reqVO.regionMainCode}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -33,16 +33,16 @@
|
|||||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
||||||
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT rhh.household_seq), 0), 1),0) as gift_sent_percent
|
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT rhh.household_seq), 0), 1),0) as gift_sent_percent
|
||||||
FROM household h
|
FROM household h
|
||||||
JOIN uicode u on u.parent_id ='code.region.main' and u.in_use = true and u.is_deleted = false
|
JOIN uicode u on u.parent_id ='code.region.main' and u.is_deleted = false <if test="'prod'.equals(activeProfiles)"> and u.in_use = true </if>
|
||||||
JOIN researcher_has_household rhh on rhh.household_seq = h.seq and rhh.admin_seq = #{adminSeq} and rhh.is_deleted = false
|
JOIN researcher_has_household rhh on rhh.household_seq = h.seq and rhh.admin_seq = #{reqVO.adminSeq} and rhh.is_deleted = false
|
||||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{recordMonth}
|
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{reqVO.recordMonth}
|
||||||
LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{recordMonth} and hv.is_deleted = false
|
LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{reqVO.recordMonth} and hv.is_deleted = false
|
||||||
WHERE h.is_deleted = false
|
WHERE h.is_deleted = false
|
||||||
<if test="usageType != null and usageType != ''">
|
<if test="reqVO.usageType != null and reqVO.usageType != ''">
|
||||||
and h.usage_type = #{usageType}
|
and h.usage_type = #{reqVO.usageType}
|
||||||
</if>
|
</if>
|
||||||
<if test="regionMainCode != null and regionMainCode != ''">
|
<if test="reqVO.regionMainCode != null and reqVO.regionMainCode != ''">
|
||||||
and h.region_main_code = #{regionMainCode}
|
and h.region_main_code = #{reqVO.regionMainCode}
|
||||||
</if>
|
</if>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@@ -65,14 +65,17 @@
|
|||||||
ON rhh.admin_seq = a.seq AND rhh.is_deleted = false
|
ON rhh.admin_seq = a.seq AND rhh.is_deleted = false
|
||||||
LEFT JOIN household h
|
LEFT JOIN household h
|
||||||
ON h.seq = rhh.household_seq AND h.is_deleted = false AND h.is_panel = true
|
ON h.seq = rhh.household_seq AND h.is_deleted = false AND h.is_panel = true
|
||||||
<if test="usageType != null and usageType != ''">
|
<if test="reqVO.usageType != null and reqVO.usageType != ''">
|
||||||
and h.usage_type = #{usageType}
|
and h.usage_type = #{reqVO.usageType}
|
||||||
</if>
|
</if>
|
||||||
LEFT JOIN household_visit hv
|
LEFT JOIN household_visit hv
|
||||||
ON hv.household_seq = h.seq AND hv.is_deleted = false AND to_char(hv.visit_date,'YYYYMM') = #{recordMonth}
|
ON hv.household_seq = h.seq AND hv.is_deleted = false AND to_char(hv.visit_date,'YYYYMM') = #{reqVO.recordMonth}
|
||||||
LEFT JOIN v_monthly_completion_rate v
|
LEFT JOIN v_monthly_completion_rate v
|
||||||
ON v.household_seq = h.seq AND v.record_month = #{recordMonth}
|
ON v.household_seq = h.seq AND v.record_month = #{reqVO.recordMonth}
|
||||||
WHERE u.parent_id = 'code.region.main' and u.in_use = true
|
WHERE u.parent_id = 'code.region.main'
|
||||||
|
<if test="'prod'.equals(activeProfiles)">
|
||||||
|
and u.in_use = true
|
||||||
|
</if>
|
||||||
GROUP BY ROLLUP(u.code_text)
|
GROUP BY ROLLUP(u.code_text)
|
||||||
ORDER BY CASE WHEN COALESCE(u.code_text, '전체') = '전체' THEN 1 ELSE 0 END,
|
ORDER BY CASE WHEN COALESCE(u.code_text, '전체') = '전체' THEN 1 ELSE 0 END,
|
||||||
MIN(u.order_no) NULLS LAST,
|
MIN(u.order_no) NULLS LAST,
|
||||||
@@ -91,18 +94,18 @@
|
|||||||
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) AS total_gift_sent_count,
|
||||||
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1), 0) AS gift_sent_percent
|
COALESCE(ROUND(COUNT(DISTINCT CASE WHEN hv.is_gift_sent = true THEN hv.household_seq END) * 100::numeric / NULLIF(COUNT(DISTINCT h.seq), 0), 1), 0) AS gift_sent_percent
|
||||||
FROM admin a
|
FROM admin a
|
||||||
JOIN uicode u ON a.region_main_code = u.id and u.parent_id = 'code.region.main' and u.in_use = true
|
JOIN uicode u ON a.region_main_code = u.id and u.parent_id = 'code.region.main' <if test="'prod'.equals(activeProfiles)"> and u.in_use = true </if>
|
||||||
JOIN admin_has_role ahr ON a.seq = ahr.admin_seq AND ahr.is_deleted = false AND ahr.role_id = 'ROLE_RESEARCHER'
|
JOIN admin_has_role ahr ON a.seq = ahr.admin_seq AND ahr.is_deleted = false AND ahr.role_id = 'ROLE_RESEARCHER'
|
||||||
LEFT JOIN researcher_has_household rhh on rhh.admin_seq = ahr.admin_seq
|
LEFT JOIN researcher_has_household rhh on rhh.admin_seq = ahr.admin_seq
|
||||||
LEFT JOIN household h on h.seq = rhh.household_seq
|
LEFT JOIN household h on h.seq = rhh.household_seq
|
||||||
<if test="usageType != null and usageType != ''">
|
<if test="reqVO.usageType != null and reqVO.usageType != ''">
|
||||||
and h.usage_type = #{usageType}
|
and h.usage_type = #{reqVO.usageType}
|
||||||
</if>
|
</if>
|
||||||
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{recordMonth}
|
LEFT JOIN v_monthly_completion_rate cr on cr.household_seq = h.seq AND cr.record_month = #{reqVO.recordMonth}
|
||||||
LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{recordMonth}
|
LEFT JOIN household_visit hv on hv.household_seq = h.seq and to_char(hv.visit_date,'YYYYMM') = #{reqVO.recordMonth}
|
||||||
WHERE a.is_deleted = false and a.account_disabled = false
|
WHERE a.is_deleted = false and a.account_disabled = false
|
||||||
<if test="regionMainCode != null and regionMainCode != ''">
|
<if test="reqVO.regionMainCode != null and reqVO.regionMainCode != ''">
|
||||||
and a.region_main_code = #{regionMainCode}
|
and a.region_main_code = #{reqVO.regionMainCode}
|
||||||
</if>
|
</if>
|
||||||
GROUP BY a.seq,u.id
|
GROUP BY a.seq,u.id
|
||||||
</select>
|
</select>
|
||||||
@@ -143,7 +146,10 @@
|
|||||||
LEFT JOIN v_monthly_completion_rate v
|
LEFT JOIN v_monthly_completion_rate v
|
||||||
ON v.household_seq = h.seq
|
ON v.household_seq = h.seq
|
||||||
AND v.record_month = #{recordMonth}
|
AND v.record_month = #{recordMonth}
|
||||||
WHERE u.parent_id = 'code.region.main' and u.in_use = true and u.is_deleted = false
|
WHERE u.parent_id = 'code.region.main' and u.is_deleted = false
|
||||||
|
<if test="'prod'.equals(activeProfiles)">
|
||||||
|
and u.in_use = true
|
||||||
|
</if>
|
||||||
GROUP BY u.code_text, u.order_no
|
GROUP BY u.code_text, u.order_no
|
||||||
UNION ALL
|
UNION ALL
|
||||||
-- 전체 합계 행
|
-- 전체 합계 행
|
||||||
@@ -177,7 +183,10 @@
|
|||||||
LEFT JOIN v_monthly_completion_rate v
|
LEFT JOIN v_monthly_completion_rate v
|
||||||
ON v.household_seq = h.seq
|
ON v.household_seq = h.seq
|
||||||
AND v.record_month = #{recordMonth}
|
AND v.record_month = #{recordMonth}
|
||||||
WHERE u.parent_id = 'code.region.main' and u.in_use = true and u.is_deleted = false
|
WHERE u.parent_id = 'code.region.main' and u.is_deleted = false
|
||||||
|
<if test="'prod'.equals(activeProfiles)">
|
||||||
|
and u.in_use = true
|
||||||
|
</if>
|
||||||
ORDER BY order_no
|
ORDER BY order_no
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user