Merge remote-tracking branch 'origin/fetch_friday' into fetch_friday
This commit is contained in:
@@ -28,53 +28,50 @@ public class ChartDao implements ChartPortOut {
|
||||
private final UICodeListMapper uiCodeListMapper;
|
||||
|
||||
@Override
|
||||
public ChartDto selectTotalPercentage(String usageType) {
|
||||
public ChartDto selectTotalPercentage(String usageType, String recordMonth) {
|
||||
TotalPercentageReqVO reqVO = new TotalPercentageReqVO();
|
||||
|
||||
reqVO.setUsageType(usageType);
|
||||
reqVO.setRecordMonth(recordMonth);
|
||||
|
||||
LocalDate today = LocalDate.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
||||
String formattedDate = today.format(formatter);
|
||||
reqVO.setRecordMonth(formattedDate);
|
||||
DateTimeFormatter formatterText = DateTimeFormatter.ofPattern("yyyy년 MM월 현황");
|
||||
String recordMonthText = today.format(formatterText);
|
||||
String year = recordMonth.substring(0, 4);
|
||||
String month = recordMonth.substring(4, 6);
|
||||
String recordMonthText = year + "년 " + month + "월 현황";
|
||||
|
||||
if("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
||||
if ("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
||||
// 관리자 일경우
|
||||
return new ChartDto(
|
||||
recordMonthText,
|
||||
chartMapper.selectTotalPercentage(reqVO,activeProfiles),
|
||||
chartMapper.selectLocalRegionPercentage(reqVO,activeProfiles),
|
||||
chartMapper.selectLocalRegionResearcherPercentage(reqVO,activeProfiles),
|
||||
uiCodeListMapper.findByParentId("code.region.main",AdminUtil.getLoginUserRole(),activeProfiles));
|
||||
return new ChartDto(recordMonthText,
|
||||
chartMapper.selectTotalPercentage(reqVO, activeProfiles),
|
||||
chartMapper.selectLocalRegionPercentage(reqVO, activeProfiles),
|
||||
chartMapper.selectLocalRegionResearcherPercentage(reqVO, 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())) {
|
||||
// 지방 실사 일경우 실사 지역으로만
|
||||
reqVO.setRegionMainCode(AdminUtil.getLoginUserRegionMainCode());
|
||||
|
||||
return new ChartDto(
|
||||
recordMonthText,
|
||||
chartMapper.selectTotalPercentage(reqVO,activeProfiles),
|
||||
chartMapper.selectLocalRegionPercentage(reqVO,activeProfiles),
|
||||
chartMapper.selectLocalRegionResearcherPercentage(reqVO,activeProfiles),
|
||||
null);
|
||||
} else if("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
||||
return new ChartDto(recordMonthText,
|
||||
chartMapper.selectTotalPercentage(reqVO, activeProfiles),
|
||||
chartMapper.selectLocalRegionPercentage(reqVO, activeProfiles),
|
||||
chartMapper.selectLocalRegionResearcherPercentage(reqVO, activeProfiles), null);
|
||||
} else if ("ROLE_LOCAL_INSPECTOR".equals(AdminUtil.getLoginUserRole())) {
|
||||
// 조사원 일경우
|
||||
reqVO.setAdminSeq(AdminUtil.getLoginUserSeq());
|
||||
return new ChartDto(recordMonthText, chartMapper.selectTotalPercentageResearcher(reqVO,activeProfiles), 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);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType, String regionMainCode) {
|
||||
LocalDate today = LocalDate.now();
|
||||
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyyMM");
|
||||
String formattedDate = today.format(formatter);
|
||||
if("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
||||
return chartMapper.selectLocalRegionResearcherPercentage(new TotalPercentageReqVO(usageType,regionMainCode,formattedDate),activeProfiles);
|
||||
}else{
|
||||
public List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType, String regionMainCode, String recordMonth) {
|
||||
if ("ROLE_ADMIN".equals(AdminUtil.getLoginUserRole())) {
|
||||
return chartMapper.selectLocalRegionResearcherPercentage(
|
||||
new TotalPercentageReqVO(usageType, regionMainCode, recordMonth), activeProfiles);
|
||||
} else {
|
||||
throw new NoMatchingURIException("잘못된 접근");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -37,20 +37,24 @@ class ChartApiController {
|
||||
private final ChartPortIn chartPortIn;
|
||||
|
||||
@GetMapping(path = "/total")
|
||||
ResponseEntity<?> selectTotalPercentage(@RequestParam("usageType") String usageType) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(chartPortIn.selectTotalPercentage(usageType));
|
||||
ResponseEntity<?> selectTotalPercentage(@RequestParam("usageType") String usageType,
|
||||
@RequestParam("recordMonth") String recordMonth) {
|
||||
return ResponseEntity.status(HttpStatus.OK)
|
||||
.body(chartPortIn.selectTotalPercentage(usageType, recordMonth));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/researcher")
|
||||
ResponseEntity<?> selectRegionMainCodePercentage(@RequestParam("usageType") String usageType,@RequestParam("regionMainCode") String regionMainCode) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(chartPortIn.selectRegionMainCodePercentage(usageType,regionMainCode));
|
||||
ResponseEntity<?> selectRegionMainCodePercentage(@RequestParam("usageType") String usageType,
|
||||
@RequestParam("regionMainCode") String regionMainCode,
|
||||
@RequestParam("recordMonth") String recordMonth) {
|
||||
return ResponseEntity.status(HttpStatus.OK).body(
|
||||
chartPortIn.selectRegionMainCodePercentage(usageType, regionMainCode, recordMonth));
|
||||
}
|
||||
|
||||
@GetMapping(path = "/excel")
|
||||
ResponseEntity<byte[]> exportDashboardExcel() {
|
||||
ResponseEntity<byte[]> exportDashboardExcel(@RequestParam("recordMonth") String recordMonth) {
|
||||
|
||||
DashboardExcelDto dashboardExcel = chartPortIn.selectDashboard(
|
||||
DateUiUtil.getCurrentMonthValue());
|
||||
DashboardExcelDto dashboardExcel = chartPortIn.selectDashboard(recordMonth);
|
||||
|
||||
List<List<String>> rows1 = new ArrayList<>();
|
||||
for (RegionMainExcelDto item : dashboardExcel.getRegionMain()) {
|
||||
|
||||
@@ -8,8 +8,8 @@ import java.util.List;
|
||||
|
||||
public interface ChartPortIn {
|
||||
|
||||
ChartDto selectTotalPercentage(String usageType);
|
||||
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode);
|
||||
ChartDto selectTotalPercentage(String usageType, String recordMonth);
|
||||
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode, String recordMonth);
|
||||
DashboardExcelDto selectDashboard(String recordMonth);
|
||||
|
||||
}
|
||||
@@ -8,7 +8,7 @@ import java.util.List;
|
||||
|
||||
public interface ChartPortOut {
|
||||
|
||||
ChartDto selectTotalPercentage(String usageType);
|
||||
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode);
|
||||
ChartDto selectTotalPercentage(String usageType, String recordMonth);
|
||||
List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode, String recordMonth);
|
||||
DashboardExcelDto selectDashboard(String recordMonth);
|
||||
}
|
||||
@@ -16,13 +16,14 @@ class ChartService implements ChartPortIn {
|
||||
private final ChartPortOut portOut;
|
||||
|
||||
@Override
|
||||
public ChartDto selectTotalPercentage(String usageType){
|
||||
return portOut.selectTotalPercentage(usageType);
|
||||
public ChartDto selectTotalPercentage(String usageType, String recordMonth){
|
||||
return portOut.selectTotalPercentage(usageType, recordMonth);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,String regionMainCode) {
|
||||
return portOut.selectRegionMainCodePercentage(usageType,regionMainCode);
|
||||
public List<LocalRegionResearcherPercentDto> selectRegionMainCodePercentage(String usageType,
|
||||
String regionMainCode, String recordMonth) {
|
||||
return portOut.selectRegionMainCodePercentage(usageType, regionMainCode, recordMonth);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package app.module.admin.usecase.home.adapters.web;
|
||||
|
||||
import app.module.admin.config.application.util.DateUiUtil;
|
||||
import app.module.admin.usecase.dashboard.getSmsAutoStatus.ports.GetSmsAutoStatusPortIn;
|
||||
import app.module.admin.usecase.dashboard.getSmsAutoStatus.ports.application.domain.GetSmsAutoStatus;
|
||||
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
||||
@@ -32,6 +33,8 @@ public class HomeController {
|
||||
GetSmsAutoStatus smsAutoStatus = getSmsAutoStatusPortIn.operate().orElse(null);
|
||||
|
||||
model.addAttribute("smsActive", smsAutoStatus != null && smsAutoStatus.getActive());
|
||||
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
||||
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
||||
|
||||
return "home";
|
||||
}
|
||||
|
||||
@@ -56,6 +56,7 @@ class GetHouseholdsExcelController {
|
||||
getHouseholdsStatusPortIn.operate(pageable,
|
||||
new GetHouseholdsStatusCmd(
|
||||
reqVO.getRecordMonth(),
|
||||
reqVO.getHouseholdNum(),
|
||||
reqVO.getOwnerField(),
|
||||
reqVO.getOwnerValue(),
|
||||
reqVO.getRegionMainCode(),
|
||||
@@ -154,7 +155,7 @@ class GetHouseholdsExcelController {
|
||||
StringUtils.defaultString(item.getIndustryDetail()),
|
||||
StringUtils.defaultString(item.getResearcherName()),
|
||||
StringUtils.defaultString(item.getResearcherPhone()),
|
||||
StringUtils.defaultString(item.getCompletionRate()) + "%",
|
||||
StringUtils.defaultString(item.getCompletionRate()),
|
||||
StringUtils.defaultString(item.getFirstVisitDate()),
|
||||
StringUtils.defaultString(item.getSecondVisitDate()),
|
||||
StringUtils.defaultString(item.getGiftSend()),
|
||||
@@ -180,7 +181,7 @@ class GetHouseholdsExcelController {
|
||||
"규모/세부품목",
|
||||
"조사원",
|
||||
"조사원 연락처",
|
||||
"당월 일계부 현황",
|
||||
"당월 일계부 현황(%)",
|
||||
"당월 1차 임가방문",
|
||||
"당월 2차 임가방문",
|
||||
"답례품 전달",
|
||||
@@ -496,6 +497,7 @@ class GetHouseholdsExcelController {
|
||||
StringUtils.defaultString(item.getWorkName()),
|
||||
StringUtils.defaultString(item.getWorkMark()),
|
||||
StringUtils.defaultString(item.getWorkLandArea()),
|
||||
StringUtils.defaultString(item.getAreaMark()),
|
||||
StringUtils.defaultString(item.getAreaUnitName()),
|
||||
StringUtils.defaultString(item.getHarvestQuantity()),
|
||||
StringUtils.defaultString(item.getHarvestUnitName()),
|
||||
@@ -523,6 +525,7 @@ class GetHouseholdsExcelController {
|
||||
"작업명",
|
||||
"작업 부호",
|
||||
"작업면적",
|
||||
"면적 부호",
|
||||
"단위",
|
||||
"수확량",
|
||||
"단위",
|
||||
|
||||
@@ -14,6 +14,8 @@ import lombok.Setter;
|
||||
public class GetHouseholdsExcelReqVO {
|
||||
// 연월
|
||||
private String recordMonth;
|
||||
// 임가번호
|
||||
private String householdNum;
|
||||
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
||||
private String ownerField;
|
||||
// 경영주 검색어
|
||||
|
||||
@@ -19,6 +19,7 @@ public class GetDailyWork {
|
||||
private String workName;
|
||||
private String workMark;
|
||||
private String workLandArea;
|
||||
private String areaMark;
|
||||
private String areaUnitName;
|
||||
private String harvestQuantity;
|
||||
private String harvestUnitName;
|
||||
|
||||
@@ -26,6 +26,7 @@ class GetHouseholdsStatusController {
|
||||
getHouseholdsStatusPortIn.operate(pageable,
|
||||
new GetHouseholdsStatusCmd(
|
||||
reqVO.getRecordMonth(),
|
||||
reqVO.getHouseholdNum(),
|
||||
reqVO.getOwnerField(),
|
||||
reqVO.getOwnerValue(),
|
||||
reqVO.getRegionMainCode(),
|
||||
|
||||
@@ -13,6 +13,8 @@ import lombok.Setter;
|
||||
public class GetHouseholdsStatusReqVO {
|
||||
// 연월
|
||||
private String recordMonth;
|
||||
// 임가번호
|
||||
private String householdNum;
|
||||
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
||||
private String ownerField;
|
||||
// 경영주 검색어
|
||||
|
||||
@@ -12,6 +12,8 @@ import lombok.Setter;
|
||||
public class GetHouseholdsStatusCmd {
|
||||
// 연월
|
||||
private String recordMonth;
|
||||
// 임가번호
|
||||
private String householdNum;
|
||||
// 경영주 검색 필드 (전체, 경영주명, 전화번호)
|
||||
private String ownerField;
|
||||
// 경영주 검색어
|
||||
|
||||
@@ -15,6 +15,7 @@ public class GetHouseholdsUIReqVO {
|
||||
private String sort;
|
||||
private Integer size;
|
||||
private String recordMonth;
|
||||
private String householdNum;
|
||||
private String ownerField;
|
||||
private String ownerValue;
|
||||
private String regionMainCode;
|
||||
|
||||
@@ -90,6 +90,11 @@
|
||||
<where>
|
||||
1=1
|
||||
|
||||
<if test="cmd.householdNum != null and cmd.householdNum != ''">
|
||||
/* 임가번호 검색 */
|
||||
AND hvr.householdNum ILIKE '%' || #{cmd.householdNum} || '%'
|
||||
</if>
|
||||
|
||||
<if test="cmd.ownerValue != null and cmd.ownerValue != ''">
|
||||
/* 경영주 검색 */
|
||||
<choose>
|
||||
|
||||
@@ -312,6 +312,7 @@
|
||||
dw.work_name ,
|
||||
dw.work_mark ,
|
||||
dw.work_land_area ,
|
||||
dw.area_mark ,
|
||||
case when dw.area_unit_code = 'code.record.area.self' then dw.area_unit_self
|
||||
else unit_code.code_value end as area_unit_name,
|
||||
dw.harvest_quantity ,
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -19,6 +19,15 @@
|
||||
<option value="PAPER">지류</option>
|
||||
</select>
|
||||
</div>
|
||||
<div class="component-select">
|
||||
<select class="select-list" id="recordMonth" name="recordMonth" required>
|
||||
<option th:each="month : ${monthList}"
|
||||
th:value="${month.value}"
|
||||
th:text="${month.label}"
|
||||
th:selected="${month.value == currentMonth}">
|
||||
</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
@@ -414,6 +423,10 @@
|
||||
$('#regionMainCode').change(function() {
|
||||
getResearcherArea();
|
||||
});
|
||||
|
||||
$('#recordMonth').change(function() {
|
||||
getTotalPercentage();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
<script>
|
||||
@@ -459,7 +472,9 @@
|
||||
|
||||
// 엑셀 다운로드
|
||||
const goExcel = () => {
|
||||
excelDownload('/api/dashboard/chart/excel', null);
|
||||
const f = document.reqForm;
|
||||
const data = $(f).serializeObject();
|
||||
excelDownload('/api/dashboard/chart/excel', data);
|
||||
}
|
||||
</script>
|
||||
</section>
|
||||
|
||||
@@ -31,6 +31,22 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 임가번호 -->
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
<p class="label-txt">
|
||||
임가번호
|
||||
</p>
|
||||
</div>
|
||||
<div class="d-flex">
|
||||
<div class="component-input">
|
||||
<div class="input-field">
|
||||
<input type="text" id="householdNum" name="householdNum" th:field="*{householdNum}" placeholder="임가번호 입력">
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- 경영주 -->
|
||||
<div class="input-group">
|
||||
<div class="input-label">
|
||||
|
||||
Reference in New Issue
Block a user