Merge branch 'dev' into deploy-dev-front
This commit is contained in:
@@ -17,7 +17,7 @@ class AdminIdDuplicateCheckPostController {
|
|||||||
private final CheckAdminIdPortIn checkAdminIdPortIn;
|
private final CheckAdminIdPortIn checkAdminIdPortIn;
|
||||||
|
|
||||||
@GetMapping("/api/settings/admin/idCheck")
|
@GetMapping("/api/settings/admin/idCheck")
|
||||||
ResponseEntity<?> updateMappingHousehold(@RequestParam String id ) {
|
ResponseEntity<?> selectIdCheck(@RequestParam String id ) {
|
||||||
return ResponseEntity.status(HttpStatus.OK).body(checkAdminIdPortIn.connect(id));
|
return ResponseEntity.status(HttpStatus.OK).body(checkAdminIdPortIn.connect(id));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.module.admin.usecase.admin.excelSaveAdmin.adapters.web;
|
||||||
|
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.ports.ExcelSaveAdminPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class ExcelSaveAdminController {
|
||||||
|
|
||||||
|
private final ExcelSaveAdminPortIn excelSaveAdminPortIn;
|
||||||
|
|
||||||
|
@PostMapping("/api/settings/admin/excelUpload")
|
||||||
|
ResponseEntity<?> excelUploadSaveAdmin(@RequestParam("file") MultipartFile file ) throws IOException {
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(excelSaveAdminPortIn.operate(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,19 @@
|
|||||||
|
package app.module.admin.usecase.admin.excelSaveAdmin.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ExcelAdminCreateVO {
|
||||||
|
private String id;
|
||||||
|
private String password;
|
||||||
|
private String name;
|
||||||
|
private String phone;
|
||||||
|
private String regionMainCode;
|
||||||
|
private String roleId;
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface CreateHouseholdMapper {
|
public interface CreateHouseholdMapper {
|
||||||
void createHousehold(CreateHouseholdOutCmd outCmd);
|
Integer createHousehold(CreateHouseholdOutCmd outCmd);
|
||||||
void createHouseholdHasRole(CreateHouseholdHasRoleCmd cmd);
|
void createHouseholdHasRole(CreateHouseholdHasRoleCmd cmd);
|
||||||
void createResearcherHasHousehold(CreateResearcherHasHouseholdCmd cmd);
|
void createResearcherHasHousehold(CreateResearcherHasHouseholdCmd cmd);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ package app.module.admin.usecase.household.createHouseholdUI.adapters.web;
|
|||||||
|
|
||||||
import app.module.admin.config.application.util.AdminUtil;
|
import app.module.admin.config.application.util.AdminUtil;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.toptier.ports.UICodeTopTierPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@@ -15,6 +16,7 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
|
|||||||
class CreateHouseholdUIController {
|
class CreateHouseholdUIController {
|
||||||
|
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final UICodeTopTierPortIn uiCodeTopTierPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/households/create")
|
@GetMapping(path = "/households/create")
|
||||||
String operate(Model model, @ModelAttribute("reqVO") CreateHouseholdUIReqVO reqVO,
|
String operate(Model model, @ModelAttribute("reqVO") CreateHouseholdUIReqVO reqVO,
|
||||||
@@ -28,14 +30,10 @@ class CreateHouseholdUIController {
|
|||||||
|
|
||||||
// 실사
|
// 실사
|
||||||
model.addAttribute("regionMainList", uiCodeListPortIn.connect("code.region.main"));
|
model.addAttribute("regionMainList", uiCodeListPortIn.connect("code.region.main"));
|
||||||
// 지역
|
// 지역 + 세부지역
|
||||||
model.addAttribute("regionSubList", uiCodeListPortIn.connect("code.region.sub"));
|
model.addAttribute("regionSubList", uiCodeTopTierPortIn.connect("code.region.sub"));
|
||||||
// 세부지역
|
// 업종 대분류 + 업종 중분류1
|
||||||
model.addAttribute("regionDetailList", uiCodeListPortIn.connect("code.region.detail"));
|
model.addAttribute("industryLargeList", uiCodeTopTierPortIn.connect("code.industry.large"));
|
||||||
// 업종 대분류
|
|
||||||
model.addAttribute("industryLargeList", uiCodeListPortIn.connect("code.industry.large"));
|
|
||||||
// 업종 중분류1
|
|
||||||
model.addAttribute("industryMiddleList", uiCodeListPortIn.connect("code.industry.middle"));
|
|
||||||
|
|
||||||
return "households/create";
|
return "households/create";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,182 @@
|
|||||||
|
package app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.checkHouseholdNum.adapters.persistence.CheckHouseholdNumMapper;
|
||||||
|
import app.module.admin.usecase.household.checkHouseholdNum.ports.application.domain.CheckHouseholdNum;
|
||||||
|
import app.module.admin.usecase.household.checkHouseholdNum.ports.application.domain.CheckHouseholdNumCmd;
|
||||||
|
import app.module.admin.usecase.household.createHousehold.adapters.persistence.CreateHouseholdMapper;
|
||||||
|
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateHouseholdHasRoleCmd;
|
||||||
|
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateHouseholdOutCmd;
|
||||||
|
import app.module.admin.usecase.household.createHousehold.ports.application.domain.CreateResearcherHasHouseholdCmd;
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model.ExcelCreateHouseholdVO;
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model.ExcelUploadContactVO;
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model.ExcelUploadResultVO;
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.ports.ExcelUploadCreateHouseholdPortOut;
|
||||||
|
import app.module.admin.usecase.researcher.adpaters.persistence.ResearcherMapper;
|
||||||
|
import app.module.core.config.application.util.AuditUtil;
|
||||||
|
import app.module.core.usecase.uicode.list.adapters.persistence.UICodeListMapper;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import lombok.extern.slf4j.Slf4j;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Repository;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Optional;
|
||||||
|
|
||||||
|
@Slf4j
|
||||||
|
@Repository
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class ExcelUploadCreateHouseholdDao implements ExcelUploadCreateHouseholdPortOut {
|
||||||
|
private final CreateHouseholdMapper createHouseholdMapper;
|
||||||
|
private final CheckHouseholdNumMapper checkHouseholdNumMapper;
|
||||||
|
private final UICodeListMapper uiCodeListMapper;
|
||||||
|
private final BCryptPasswordEncoder passwordEncoder;
|
||||||
|
private final ResearcherMapper researcherMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
|
||||||
|
// 엑셀 파일 읽기
|
||||||
|
Workbook workbook = WorkbookFactory.create(file.getInputStream());
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
Integer success = 0;
|
||||||
|
|
||||||
|
List<UICodeElement> RegionMainCodeList = uiCodeListMapper.findByParentId("code.region.main");
|
||||||
|
List<UICodeElement> RegionSubCodeList = uiCodeListMapper.findByParentId("code.region.sub");
|
||||||
|
List<UICodeElement> RegionDetailCodeList = uiCodeListMapper.findByLikeId("code.region.detail");
|
||||||
|
List<UICodeElement> IndustryLargeCodeList = uiCodeListMapper.findByParentId("code.industry.large");
|
||||||
|
List<UICodeElement> IndustryMiddleCodeList = uiCodeListMapper.findByParentId("code.industry.middle");
|
||||||
|
|
||||||
|
// 첫 번째 행은 헤더로 간주하고 스킵
|
||||||
|
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
|
||||||
|
Row row = sheet.getRow(i);
|
||||||
|
if (row == null) continue;
|
||||||
|
|
||||||
|
CheckHouseholdNum checkHouseholdNum = checkHouseholdNumMapper.checkHouseholdNum(new CheckHouseholdNumCmd(getCellValue(row.getCell(0)))).orElse(null);
|
||||||
|
ExcelUploadContactVO contactVO = getDivisionContact(row.getCell(3));
|
||||||
|
|
||||||
|
|
||||||
|
if(!checkHouseholdNum.getIsDuplicated() && contactVO != null) {
|
||||||
|
|
||||||
|
ExcelCreateHouseholdVO household = new ExcelCreateHouseholdVO();
|
||||||
|
household.setHouseholdNum(getCellValue(row.getCell(0))); // 임가번호
|
||||||
|
household.setOwnerName(getCellValue(row.getCell(1))); // 경영주명
|
||||||
|
household.setOwnerAge(getCellNumberValue(row.getCell(2))); // 연령
|
||||||
|
household.setTel(contactVO.getTel()); // 가구 연락처
|
||||||
|
household.setPhone(contactVO.getPhone()); // 연락처
|
||||||
|
household.setEncodedPassword(passwordEncoder.encode(contactVO.getPhoneLast())); // 비밀번호
|
||||||
|
household.setRegionMainCode(getUiCode(row.getCell(4),RegionMainCodeList,"code.region.main")); // 실사
|
||||||
|
household.setRegionSubCode(getUiCode(row.getCell(5),RegionSubCodeList,"code.region.sub")); // 지역
|
||||||
|
household.setRegionDetailCode(getUiCode(row.getCell(6),RegionDetailCodeList,"code.region.detail")); // 세부지역
|
||||||
|
household.setAddress(getCellValue(row.getCell(7))); // 전체주소
|
||||||
|
household.setIndustryLargeCode(getUiCode(row.getCell(8),IndustryLargeCodeList,"code.industry.large")); // 업종 대분류
|
||||||
|
household.setIndustryMiddleCode(getUiCode(row.getCell(9),IndustryMiddleCodeList,"code.industry.middle")); // 업종 중분류
|
||||||
|
household.setIndustrySubMiddle(getCellValue(row.getCell(10))); // 업종 중분류2
|
||||||
|
household.setIndustryDetail(getCellValue(row.getCell(11))); // 규모 / 세부품목
|
||||||
|
household.setResearcherSeq(getResearcherSeq(row.getCell(12))); // 조사원
|
||||||
|
household.setIsPanel(getIsPanel(row.getCell(13))); // 유지여부
|
||||||
|
|
||||||
|
|
||||||
|
CreateHouseholdOutCmd cmd = new CreateHouseholdOutCmd(
|
||||||
|
null,
|
||||||
|
household.getHouseholdNum(),
|
||||||
|
household.getOwnerName(),
|
||||||
|
household.getOwnerAge(),
|
||||||
|
household.getTel(),
|
||||||
|
household.getPhone(),
|
||||||
|
household.getEncodedPassword(),
|
||||||
|
household.getRegionMainCode(),
|
||||||
|
household.getRegionSubCode(),
|
||||||
|
household.getRegionDetailCode(),
|
||||||
|
household.getAddress(),
|
||||||
|
household.getIndustryLargeCode(),
|
||||||
|
household.getIndustryMiddleCode(),
|
||||||
|
household.getIndustrySubMiddle(),
|
||||||
|
household.getIndustryDetail(),
|
||||||
|
household.getResearcherSeq(),
|
||||||
|
household.getIsPanel(),
|
||||||
|
null,
|
||||||
|
List.of("ROLE_GENERAL")
|
||||||
|
);
|
||||||
|
|
||||||
|
success += createHouseholdMapper.createHousehold(AuditUtil.create(cmd));
|
||||||
|
|
||||||
|
if(cmd.getRoleIds() != null && !cmd.getRoleIds().isEmpty()) {
|
||||||
|
createHouseholdMapper.createHouseholdHasRole(AuditUtil.create(new CreateHouseholdHasRoleCmd(cmd.getSeq(), cmd.getRoleIds())));
|
||||||
|
}
|
||||||
|
|
||||||
|
if(cmd.getResearcherSeq() != null) {
|
||||||
|
createHouseholdMapper.createResearcherHasHousehold(AuditUtil.create(new CreateResearcherHasHouseholdCmd(cmd.getSeq(), cmd.getResearcherSeq())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
workbook.close();
|
||||||
|
return new ExcelUploadResultVO(sheet.getLastRowNum()-1 , success);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 셀 값을 문자열로 변환
|
||||||
|
private String getCellValue(Cell cell) {
|
||||||
|
if (cell == null) return "";
|
||||||
|
return switch (cell.getCellType()) {
|
||||||
|
case STRING -> cell.getStringCellValue();
|
||||||
|
case NUMERIC -> String.valueOf((long) cell.getNumericCellValue());
|
||||||
|
default -> "";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
// 셀 값을 문자열로 변환
|
||||||
|
private Integer getCellNumberValue(Cell cell) {
|
||||||
|
if (cell == null) return null;
|
||||||
|
return switch (cell.getCellType()) {
|
||||||
|
case NUMERIC -> (int) cell.getNumericCellValue();
|
||||||
|
default -> null;
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getUiCode(Cell cell,List<UICodeElement> uiCodeElementList,String codeId){
|
||||||
|
if (cell == null) return "";
|
||||||
|
return uiCodeElementList.stream().filter(code -> {
|
||||||
|
String[] cellValue = cell.getStringCellValue().trim().split("\\.");
|
||||||
|
return code.getId().equals(codeId+"."+cellValue[0]) || code.getCodeText().equals(cellValue[1]) ;
|
||||||
|
} )
|
||||||
|
.findFirst()
|
||||||
|
.map(UICodeElement::getId).orElse("");
|
||||||
|
}
|
||||||
|
|
||||||
|
private ExcelUploadContactVO getDivisionContact(Cell cell){
|
||||||
|
if (cell == null) return null;
|
||||||
|
|
||||||
|
String[] contact = cell.getStringCellValue().trim().split("-");
|
||||||
|
|
||||||
|
ExcelUploadContactVO contactVO = new ExcelUploadContactVO();
|
||||||
|
|
||||||
|
if(contact[2].length() == 4) {
|
||||||
|
if (contact[0].equals("010") || contact[0].equals("011")) {
|
||||||
|
contactVO.setPhone(getCellValue(cell));
|
||||||
|
contactVO.setPhoneLast(contact[2]);
|
||||||
|
} else {
|
||||||
|
contactVO.setTel(getCellValue(cell));
|
||||||
|
contactVO.setPhoneLast(contact[2]);
|
||||||
|
}
|
||||||
|
return contactVO;
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
private Boolean getIsPanel(Cell cell){
|
||||||
|
if (cell == null) return null;
|
||||||
|
String[] isPanel = cell.getStringCellValue().trim().split("\\.");
|
||||||
|
return "1".equals(isPanel[0]) || "유지".equals(isPanel[1]);
|
||||||
|
}
|
||||||
|
|
||||||
|
private Long getResearcherSeq(Cell cell){
|
||||||
|
if (cell == null) return null;
|
||||||
|
return researcherMapper.selectResearcherId(cell.getStringCellValue());
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,25 @@
|
|||||||
|
package app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.ports.ExcelUploadCreateHouseholdPortIn;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.http.HttpStatus;
|
||||||
|
import org.springframework.http.ResponseEntity;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@RestController
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class ExcelUploadCreateHouseholdController {
|
||||||
|
|
||||||
|
private final ExcelUploadCreateHouseholdPortIn excelUploadCreateHouseholdPortIn;
|
||||||
|
|
||||||
|
@PostMapping(path = "/api/household/excelUpload")
|
||||||
|
ResponseEntity<?> operate(@RequestParam("file") MultipartFile file ) throws IOException {
|
||||||
|
|
||||||
|
return ResponseEntity.status(HttpStatus.OK).body(excelUploadCreateHouseholdPortIn.operate(file));
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
package app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.*;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
@AllArgsConstructor
|
||||||
|
@EqualsAndHashCode
|
||||||
|
public class ExcelCreateHouseholdVO {
|
||||||
|
private String householdNum;
|
||||||
|
private String ownerName;
|
||||||
|
private Integer ownerAge;
|
||||||
|
private String tel;
|
||||||
|
private String phone;
|
||||||
|
private String encodedPassword;
|
||||||
|
private String regionMainCode;
|
||||||
|
private String regionSubCode;
|
||||||
|
private String regionDetailCode;
|
||||||
|
private String address;
|
||||||
|
private String industryLargeCode;
|
||||||
|
private String industryMiddleCode;
|
||||||
|
private String industrySubMiddle;
|
||||||
|
private String industryDetail;
|
||||||
|
private Long researcherSeq;
|
||||||
|
private Boolean isPanel;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ExcelUploadContactVO {
|
||||||
|
private String phone;
|
||||||
|
private String tel;
|
||||||
|
private String phoneLast;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
package app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
public class ExcelUploadResultVO {
|
||||||
|
private Integer total;
|
||||||
|
private Integer success;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.module.admin.usecase.household.excelUploadCreateHousehold.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model.ExcelUploadResultVO;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public interface ExcelUploadCreateHouseholdPortIn {
|
||||||
|
ExcelUploadResultVO operate(MultipartFile file) throws IOException;
|
||||||
|
}
|
||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package app.module.admin.usecase.household.excelUploadCreateHousehold.ports;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model.ExcelUploadResultVO;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public interface ExcelUploadCreateHouseholdPortOut {
|
||||||
|
ExcelUploadResultVO operate(MultipartFile file) throws IOException;
|
||||||
|
}
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
package app.module.admin.usecase.household.excelUploadCreateHousehold.ports.application;
|
||||||
|
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.adapters.web.model.ExcelUploadResultVO;
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.ports.ExcelUploadCreateHouseholdPortIn;
|
||||||
|
import app.module.admin.usecase.household.excelUploadCreateHousehold.ports.ExcelUploadCreateHouseholdPortOut;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class ExcelUploadCreateHouseholdService implements ExcelUploadCreateHouseholdPortIn {
|
||||||
|
private final ExcelUploadCreateHouseholdPortOut portOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExcelUploadResultVO operate(MultipartFile file) throws IOException {
|
||||||
|
return portOut.operate(file);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -7,6 +7,7 @@ import app.module.core.config.application.util.CommonUtil;
|
|||||||
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
import app.module.core.usecase.admin.view.ports.AdminViewPortIn;
|
||||||
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
import app.module.core.usecase.admin.view.ports.application.domain.AdminView;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.toptier.ports.UICodeTopTierPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
@@ -17,6 +18,7 @@ import org.springframework.web.bind.annotation.ModelAttribute;
|
|||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
class GetHouseholdsStatusUIController {
|
class GetHouseholdsStatusUIController {
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final UICodeTopTierPortIn uiCodeTopTierPortIn;
|
||||||
private final AdminViewPortIn adminViewPortIn;
|
private final AdminViewPortIn adminViewPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/households")
|
@GetMapping(path = "/households")
|
||||||
@@ -43,14 +45,10 @@ class GetHouseholdsStatusUIController {
|
|||||||
model.addAttribute("regionMainList", uiCodeListPortIn.connect("code.region.main"));
|
model.addAttribute("regionMainList", uiCodeListPortIn.connect("code.region.main"));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 지역
|
// 지역 + 세부지역
|
||||||
model.addAttribute("regionSubList", uiCodeListPortIn.connect("code.region.sub"));
|
model.addAttribute("regionSubList", uiCodeTopTierPortIn.connect("code.region.sub"));
|
||||||
// 세부지역
|
// 업종 대분류 + 업종 중분류1
|
||||||
model.addAttribute("regionDetailList", uiCodeListPortIn.connect("code.region.detail"));
|
model.addAttribute("industryLargeList", uiCodeTopTierPortIn.connect("code.industry.large"));
|
||||||
// 업종 대분류
|
|
||||||
model.addAttribute("industryLargeList", uiCodeListPortIn.connect("code.industry.large"));
|
|
||||||
// 업종 중분류1
|
|
||||||
model.addAttribute("industryMiddleList", uiCodeListPortIn.connect("code.industry.middle"));
|
|
||||||
|
|
||||||
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
||||||
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
||||||
|
|||||||
@@ -7,9 +7,11 @@ import app.module.admin.usecase.household.getHouseholdStatus.ports.application.d
|
|||||||
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
import app.module.admin.usecase.household.getHouseholdStatus.ports.application.domain.GetHouseholdStatusCmd;
|
||||||
import app.module.admin.usecase.household.updateHouseholdStatusUI.adapters.web.model.UpdateHouseholdStatusUIResVO;
|
import app.module.admin.usecase.household.updateHouseholdStatusUI.adapters.web.model.UpdateHouseholdStatusUIResVO;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.toptier.ports.UICodeTopTierPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.stereotype.Controller;
|
import org.springframework.stereotype.Controller;
|
||||||
import org.springframework.ui.Model;
|
import org.springframework.ui.Model;
|
||||||
|
import org.springframework.util.StringUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.ModelAttribute;
|
import org.springframework.web.bind.annotation.ModelAttribute;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
@@ -22,6 +24,7 @@ class UpdateHouseholdStatusUIController {
|
|||||||
|
|
||||||
private final GetHouseholdStatusPortIn getHouseholdStatusPortIn;
|
private final GetHouseholdStatusPortIn getHouseholdStatusPortIn;
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final UICodeTopTierPortIn uiCodeTopTierPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/households/update/{seq}")
|
@GetMapping(path = "/households/update/{seq}")
|
||||||
String operate(@PathVariable Long seq, Model model,
|
String operate(@PathVariable Long seq, Model model,
|
||||||
@@ -39,14 +42,10 @@ class UpdateHouseholdStatusUIController {
|
|||||||
|
|
||||||
// 실사
|
// 실사
|
||||||
model.addAttribute("regionMainList", uiCodeListPortIn.connect("code.region.main"));
|
model.addAttribute("regionMainList", uiCodeListPortIn.connect("code.region.main"));
|
||||||
// 지역
|
// 지역 + 세부지역
|
||||||
model.addAttribute("regionSubList", uiCodeListPortIn.connect("code.region.sub"));
|
model.addAttribute("regionSubList", uiCodeTopTierPortIn.connect("code.region.sub"));
|
||||||
// 세부지역
|
// 업종 대분류 + 업종 중분류1
|
||||||
model.addAttribute("regionDetailList", uiCodeListPortIn.connect("code.region.detail"));
|
model.addAttribute("industryLargeList", uiCodeTopTierPortIn.connect("code.industry.large"));
|
||||||
// 업종 대분류
|
|
||||||
model.addAttribute("industryLargeList", uiCodeListPortIn.connect("code.industry.large"));
|
|
||||||
// 업종 중분류1
|
|
||||||
model.addAttribute("industryMiddleList", uiCodeListPortIn.connect("code.industry.middle"));
|
|
||||||
|
|
||||||
|
|
||||||
// 임가 상세 정보
|
// 임가 상세 정보
|
||||||
@@ -59,12 +58,12 @@ class UpdateHouseholdStatusUIController {
|
|||||||
result.getHouseholdNum(),
|
result.getHouseholdNum(),
|
||||||
result.getHouseholdName(),
|
result.getHouseholdName(),
|
||||||
result.getHouseholdAge(),
|
result.getHouseholdAge(),
|
||||||
result.getHouseholdTel() != null ? result.getHouseholdTel().split("-")[0] : "",
|
StringUtils.hasText(result.getHouseholdTel()) ? result.getHouseholdTel().split("-")[0] : "",
|
||||||
result.getHouseholdTel() != null ? result.getHouseholdTel().split("-")[1] : "",
|
StringUtils.hasText(result.getHouseholdTel()) ? result.getHouseholdTel().split("-")[1] : "",
|
||||||
result.getHouseholdTel() != null ? result.getHouseholdTel().split("-")[2] : "",
|
StringUtils.hasText(result.getHouseholdTel()) ? result.getHouseholdTel().split("-")[2] : "",
|
||||||
result.getHouseholdPhone() != null ? result.getHouseholdPhone().split("-")[0] : "",
|
StringUtils.hasText(result.getHouseholdPhone()) ? result.getHouseholdPhone().split("-")[0] : "",
|
||||||
result.getHouseholdPhone() != null ? result.getHouseholdPhone().split("-")[1] : "",
|
StringUtils.hasText(result.getHouseholdPhone()) ? result.getHouseholdPhone().split("-")[1] : "",
|
||||||
result.getHouseholdPhone() != null ? result.getHouseholdPhone().split("-")[2] : "",
|
StringUtils.hasText(result.getHouseholdPhone()) ? result.getHouseholdPhone().split("-")[2] : "",
|
||||||
result.getRegionMainCode(),
|
result.getRegionMainCode(),
|
||||||
result.getRegionSubCode(),
|
result.getRegionSubCode(),
|
||||||
result.getRegionDetailCode(),
|
result.getRegionDetailCode(),
|
||||||
|
|||||||
@@ -27,5 +27,5 @@ public interface ResearcherMapper {
|
|||||||
void deleteHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("deletedBy") String deletedBy);
|
void deleteHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("deletedBy") String deletedBy);
|
||||||
Integer insertHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("createdBy") String createdBy);
|
Integer insertHouseholdResearcherMapping(@Param("researcherSeq") Integer researcherSeq, @Param("householdSeq") Integer householdSeq, @Param("createdBy") String createdBy);
|
||||||
List<GetPopupHouseholds> getPopupHouseholds(@Param("pageable") Pageable pageable, @Param("cmd") GetPopupHouseholdsCmd cmd);
|
List<GetPopupHouseholds> getPopupHouseholds(@Param("pageable") Pageable pageable, @Param("cmd") GetPopupHouseholdsCmd cmd);
|
||||||
|
Long selectResearcherId(@Param("id")String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ import app.module.admin.usecase.researcher.adpaters.web.model.GetResearchersUIRe
|
|||||||
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailUIReqVO;
|
import app.module.admin.usecase.researcher.adpaters.web.model.ResearchersDetailUIReqVO;
|
||||||
import app.module.admin.usecase.researcher.ports.ResearcherPortIn;
|
import app.module.admin.usecase.researcher.ports.ResearcherPortIn;
|
||||||
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
import app.module.core.usecase.uicode.list.ports.UICodeListPortIn;
|
||||||
|
import app.module.core.usecase.uicode.toptier.ports.UICodeTopTierPortIn;
|
||||||
import app.module.core.usecase.uicode.view.ports.UICodeViewPortIn;
|
import app.module.core.usecase.uicode.view.ports.UICodeViewPortIn;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
@@ -22,6 +23,7 @@ import java.util.Objects;
|
|||||||
@RequestMapping(path = "/researcher")
|
@RequestMapping(path = "/researcher")
|
||||||
class ResearcherController {
|
class ResearcherController {
|
||||||
private final UICodeListPortIn uiCodeListPortIn;
|
private final UICodeListPortIn uiCodeListPortIn;
|
||||||
|
private final UICodeTopTierPortIn uiCodeTopTierPortIn;
|
||||||
private final ResearcherPortIn researcherPortIn;
|
private final ResearcherPortIn researcherPortIn;
|
||||||
|
|
||||||
@GetMapping(path = "/researchers")
|
@GetMapping(path = "/researchers")
|
||||||
@@ -45,10 +47,8 @@ class ResearcherController {
|
|||||||
model.addAttribute("researcherDto", researcherPortIn.detail(adminSeq));
|
model.addAttribute("researcherDto", researcherPortIn.detail(adminSeq));
|
||||||
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
model.addAttribute("monthList", DateUiUtil.getRecentMonths(13));
|
||||||
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
model.addAttribute("currentMonth", DateUiUtil.getCurrentMonthValue());
|
||||||
// 모달용 지역
|
// 모달용 지역 + 세부지역
|
||||||
model.addAttribute("regionSubList", uiCodeListPortIn.connect("code.region.sub"));
|
model.addAttribute("regionSubList", uiCodeTopTierPortIn.connect("code.region.sub"));
|
||||||
// 모달용 세부지역
|
|
||||||
model.addAttribute("regionDetailList", uiCodeListPortIn.connect("code.region.detail"));
|
|
||||||
|
|
||||||
return "researcher/detail";
|
return "researcher/detail";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,7 +4,7 @@
|
|||||||
<mapper
|
<mapper
|
||||||
namespace="app.module.admin.usecase.household.createHousehold.adapters.persistence.CreateHouseholdMapper">
|
namespace="app.module.admin.usecase.household.createHousehold.adapters.persistence.CreateHouseholdMapper">
|
||||||
|
|
||||||
<insert id="createHousehold">
|
<update id="createHousehold">
|
||||||
/* createHousehold : 임가 등록 */
|
/* createHousehold : 임가 등록 */
|
||||||
<selectKey keyProperty="seq" resultType="long" order="BEFORE">
|
<selectKey keyProperty="seq" resultType="long" order="BEFORE">
|
||||||
SELECT nextval('household_seq')
|
SELECT nextval('household_seq')
|
||||||
@@ -79,7 +79,7 @@
|
|||||||
</if>
|
</if>
|
||||||
<include refid="common.fields.CreateUpdateBaseValues"/>
|
<include refid="common.fields.CreateUpdateBaseValues"/>
|
||||||
)
|
)
|
||||||
</insert>
|
</update>
|
||||||
|
|
||||||
<insert id="createHouseholdHasRole">
|
<insert id="createHouseholdHasRole">
|
||||||
/* createHouseholdHasRole : 임가 역할 등록 */
|
/* createHouseholdHasRole : 임가 역할 등록 */
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
<when test="cmd.searchField eq 'name'">
|
<when test="cmd.searchField eq 'name'">
|
||||||
AND a.name ILIKE '%' || #{cmd.searchValue} || '%'
|
AND a.name ILIKE '%' || #{cmd.searchValue} || '%'
|
||||||
</when>
|
</when>
|
||||||
|
|
||||||
<when test="cmd.searchField eq 'phone'">
|
<when test="cmd.searchField eq 'phone'">
|
||||||
AND a.phone ILIKE '%' || #{cmd.searchValue} || '%'
|
AND a.phone ILIKE '%' || #{cmd.searchValue} || '%'
|
||||||
</when>
|
</when>
|
||||||
|
|||||||
@@ -89,7 +89,7 @@
|
|||||||
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
|
join researcher_has_household rhh ON h.seq = rhh.household_seq and rhh.is_deleted = false
|
||||||
left join uicode rm ON rm.parent_id = 'code.region.main' AND rm.id = h.region_main_code
|
left join uicode rm ON rm.parent_id = 'code.region.main' AND rm.id = h.region_main_code
|
||||||
left join uicode rs ON rs.parent_id = 'code.region.sub' AND rs.id = h.region_sub_code
|
left join uicode rs ON rs.parent_id = 'code.region.sub' AND rs.id = h.region_sub_code
|
||||||
left join uicode rd ON rd.parent_id = 'code.region.detail' AND rd.id = h.region_detail_code
|
left join uicode rd ON rd.id = h.region_detail_code
|
||||||
left join uicode il ON il.parent_id = 'code.industry.large' AND il.id = h.industry_large_code
|
left join uicode il ON il.parent_id = 'code.industry.large' AND il.id = h.industry_large_code
|
||||||
left join uicode im ON im.parent_id = 'code.industry.middle' AND im.id = h.industry_middle_code
|
left join uicode im ON im.parent_id = 'code.industry.middle' AND im.id = h.industry_middle_code
|
||||||
where 1=1
|
where 1=1
|
||||||
@@ -357,4 +357,12 @@
|
|||||||
ORDER BY hvr.householdNum ASC
|
ORDER BY hvr.householdNum ASC
|
||||||
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
OFFSET #{pageable.offset} ROWS FETCH NEXT #{pageable.pageSize} ROWS ONLY
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectResearcherId">
|
||||||
|
select seq
|
||||||
|
from admin a
|
||||||
|
join admin_has_role ahr on ahr.admin_seq = a.seq and ahr.role_id = 'ROLE_RESEARCHER' and ahr.is_deleted = false
|
||||||
|
where a.id = #{id} and a.is_deleted = false
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -470,3 +470,50 @@ const limitMaxLength = (el) => {
|
|||||||
el.value = el.value.replace(/\D/g, '').slice(0, maxLength);
|
el.value = el.value.replace(/\D/g, '').slice(0, maxLength);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 공통코드 기반의 2단계 셀렉트박스(부모/자식) UI를 구성하는 함수
|
||||||
|
*
|
||||||
|
* @param {Object} codeList - 공통코드 리스트 객체
|
||||||
|
* @param {string} parentSelector - 부모 셀렉트박스 셀렉터 (ex. '#regionSubCode')
|
||||||
|
* @param {string} childSelector - 자식 셀렉트박스 셀렉터 (ex. '#regionDetailCode')
|
||||||
|
* @param {string} selectedParentCode - 초기 선택할 부모 코드값 (ex. 'code.region.sub.31')
|
||||||
|
* @param {string} selectedChildCode - 초기 선택할 자식 코드값 (ex. 'code.region.detail.9')
|
||||||
|
*/
|
||||||
|
const setSelectBoxUiCode = ({
|
||||||
|
codeList,
|
||||||
|
parentSelector,
|
||||||
|
childSelector,
|
||||||
|
selectedParentCode = '',
|
||||||
|
selectedChildCode = ''
|
||||||
|
}) => {
|
||||||
|
const $parent = $(parentSelector);
|
||||||
|
const $child = $(childSelector);
|
||||||
|
|
||||||
|
if (!codeList?.nodes || !$parent.length || !$child.length) return;
|
||||||
|
|
||||||
|
const renderOptions = ($el, list, selected) => {
|
||||||
|
$el.html('<option value="">전체</option>');
|
||||||
|
list.forEach(item => {
|
||||||
|
const val = item.id.split('.').pop();
|
||||||
|
const isSelected = item.id === selected ? 'selected' : '';
|
||||||
|
$el.append(`<option value="${item.id}" ${isSelected}>${val}. ${item.codeText}</option>`);
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const loadChildren = (parentId, selectedChild = '') => {
|
||||||
|
$child.html('<option value="">전체</option>');
|
||||||
|
if (!parentId) return;
|
||||||
|
|
||||||
|
const parent = codeList.nodes.find(n => n.id === parentId);
|
||||||
|
if (!parent?.nodes) return;
|
||||||
|
renderOptions($child, parent.nodes, selectedChild);
|
||||||
|
};
|
||||||
|
|
||||||
|
renderOptions($parent, codeList.nodes, selectedParentCode);
|
||||||
|
if (selectedParentCode) loadChildren(selectedParentCode, selectedChildCode);
|
||||||
|
|
||||||
|
$parent.on('change', function () {
|
||||||
|
loadChildren($(this).val());
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
<form method="post" name="adminParamForm" onsubmit="goSearch();"
|
<form method="post" name="adminParamForm" onsubmit="goSearch();"
|
||||||
th:action="@{/settings/admins}"
|
th:action="@{/settings/admins}"
|
||||||
th:object="${listStatus}">
|
th:object="${listStatus}">
|
||||||
|
<div th:replace="admin/modal/modal-admin-excel:: modalFragment"></div>
|
||||||
<!-- hidden parameters -->
|
<!-- hidden parameters -->
|
||||||
<input name="page" th:value="${listOutput.pageable.pageNumber}" type="hidden"/>
|
<input name="page" th:value="${listOutput.pageable.pageNumber}" type="hidden"/>
|
||||||
<input name="sort" th:value="${listOutput.pageable.sort}" type="hidden"/>
|
<input name="sort" th:value="${listOutput.pageable.sort}" type="hidden"/>
|
||||||
@@ -128,6 +128,9 @@
|
|||||||
|
|
||||||
<div class="component-btns bottom-btn-group">
|
<div class="component-btns bottom-btn-group">
|
||||||
<div class="btns-row align-right">
|
<div class="btns-row align-right">
|
||||||
|
<button class="btn" onclick="showAdminExcelUploadModal();" type="button">
|
||||||
|
<span class="btn-txt">엑셀 업로드</span>
|
||||||
|
</button>
|
||||||
<button class="btn" onclick="goExcel();" type="button"><span class="btn-txt">엑셀 다운로드</span></button>
|
<button class="btn" onclick="goExcel();" type="button"><span class="btn-txt">엑셀 다운로드</span></button>
|
||||||
<button class="btn" onclick="location.href='/settings/admins/create';" type="button"><span class="btn-txt">등록</span></button>
|
<button class="btn" onclick="location.href='/settings/admins/create';" type="button"><span class="btn-txt">등록</span></button>
|
||||||
<button class="btn" onclick="goRemove();" type="button"><span class="btn-txt">삭제</span></button>
|
<button class="btn" onclick="goRemove();" type="button"><span class="btn-txt">삭제</span></button>
|
||||||
@@ -135,15 +138,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
</form>
|
</form>
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
<!-- <script th:inline="javascript">
|
|
||||||
// 목록 정렬 표기 및 갱신 기능 적용
|
|
||||||
uiUtil.applyListSortNotation([[${listOutput.pageable.pageSize}]],
|
|
||||||
[[${listOutput.pageable.sort.toString()}]]);
|
|
||||||
</script>-->
|
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
// 검색
|
// 검색
|
||||||
function goSearch() {
|
function goSearch() {
|
||||||
@@ -211,6 +209,54 @@
|
|||||||
f.method = 'post';
|
f.method = 'post';
|
||||||
f.submit();
|
f.submit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
function showAdminExcelUploadModal() {
|
||||||
|
const modal = document.querySelector(".modal02");
|
||||||
|
modal.ui.open();
|
||||||
|
|
||||||
|
}
|
||||||
|
const uploadAdminExcel = () => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const fileInput = document.getElementById('file');
|
||||||
|
if (fileInput.files.length === 0) {
|
||||||
|
alert('업로드할 엑셀 파일을 선택해주세요.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('file', fileInput.files[0]);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/api/settings/admin/excelUpload',
|
||||||
|
data: formData,
|
||||||
|
contentType: false, // * 중요 *
|
||||||
|
processData: false, // * 중요 *
|
||||||
|
enctype: 'multipart/form-data', // * 중요 *
|
||||||
|
beforeSend: function (xhr) {
|
||||||
|
xhr.setRequestHeader(
|
||||||
|
$("meta[name='_csrf_header']").attr("content"),
|
||||||
|
$("meta[name='_csrf']").attr("content"));
|
||||||
|
},
|
||||||
|
success(res) {
|
||||||
|
alert("총 "+res.total+"건 중에 "+res.success+"건 등록되었습니다.");
|
||||||
|
},
|
||||||
|
statusCode: {
|
||||||
|
422: (res) => {
|
||||||
|
const resJson = res.responseJSON;
|
||||||
|
$(input).parent().find('.invalid-feedback').text(resJson.message);
|
||||||
|
$(input).addClass('is-invalid');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
|
const closeModal = () => {
|
||||||
|
document.querySelector(".modal02").ui.close();
|
||||||
|
};
|
||||||
|
|
||||||
</script>
|
</script>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,42 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<div class="component-modal modal02" id="test" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit" >엑셀 업로드</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<section>
|
||||||
|
<form autocomplete="off" method="post" name="AdminExcelReqForm" id ="AdminExcelReqForm" enctype="multipart/form-data" action="/api/settings/admin/excelUpload">
|
||||||
|
<label for="file" class="input-file-btn">
|
||||||
|
<input type="file" name="file" id="file" accept=".xlsx, .xls">
|
||||||
|
</label>
|
||||||
|
<div class="component-btns bottom-btn-group" th:fragment="modalButtons">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="uploadAdminExcel()">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
<button class="modal-close" onclick="closeModal()"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
<section layout:fragment="script">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
|
||||||
|
</script>
|
||||||
|
</section>
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -49,7 +49,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<select class="select-list" id="regionSubCode" name="regionSubCode">
|
<select class="select-list" id="regionSubCode" name="regionSubCode">
|
||||||
<option value="" selected>전체</option>
|
<option value="" selected>전체</option>
|
||||||
<option th:each="region : ${regionSubList}" th:value="${region.id}" th:text="${region.codeText}"></option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
@@ -58,7 +57,6 @@
|
|||||||
</div>
|
</div>
|
||||||
<select class="select-list" id="regionDetailCode" name="regionDetailCode">
|
<select class="select-list" id="regionDetailCode" name="regionDetailCode">
|
||||||
<option value="" selected>전체</option>
|
<option value="" selected>전체</option>
|
||||||
<option th:each="subRegion : ${regionDetailList}" th:value="${subRegion.id}" th:text="${subRegion.codeText}"></option>
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -142,6 +140,10 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
const regionList = [[${regionSubList}]];
|
||||||
|
</script>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
const showHouseholdModal = (button) => {
|
const showHouseholdModal = (button) => {
|
||||||
const regionMainCode = button.getAttribute('data-region-main-code') || '';
|
const regionMainCode = button.getAttribute('data-region-main-code') || '';
|
||||||
@@ -154,6 +156,13 @@
|
|||||||
existingModal.remove();
|
existingModal.remove();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 지역, 세부지역 셀렉트박스 세팅
|
||||||
|
setSelectBoxUiCode({
|
||||||
|
codeList: regionList,
|
||||||
|
parentSelector: '#regionSubCode',
|
||||||
|
childSelector: '#regionDetailCode',
|
||||||
|
});
|
||||||
|
|
||||||
document.querySelector(".modal01").ui.open();
|
document.querySelector(".modal01").ui.open();
|
||||||
|
|
||||||
// 초기 데이터 조회
|
// 초기 데이터 조회
|
||||||
|
|||||||
@@ -131,22 +131,16 @@
|
|||||||
<th>지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" name="regionSubCode" required>
|
<select class="select-list" name="regionSubCode" id="regionSubCode" required>
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${regionSubList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>세부 지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>세부 지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" name="regionDetailCode" required>
|
<select class="select-list" name="regionDetailCode" id="regionDetailCode" required>
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${regionDetailList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -165,22 +159,16 @@
|
|||||||
<th>업종 대분류</th>
|
<th>업종 대분류</th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" name="industryLargeCode">
|
<select class="select-list" name="industryLargeCode" id="industryLargeCode">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${industryLargeList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>업종 중분류1</th>
|
<th>업종 중분류1</th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" name="industryMiddleCode">
|
<select class="select-list" name="industryMiddleCode" id="industryMiddleCode">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>>
|
||||||
<option th:each="item : ${industryMiddleList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -269,6 +257,27 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
const regionList = [[${regionSubList}]];
|
||||||
|
const industryLargeList = [[${industryLargeList}]];
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
// 지역, 세부지역 셀렉트박스 세팅
|
||||||
|
setSelectBoxUiCode({
|
||||||
|
codeList: regionList,
|
||||||
|
parentSelector: '#regionSubCode',
|
||||||
|
childSelector: '#regionDetailCode'
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업종 대분류, 중분류 셀렉트박스 세팅
|
||||||
|
setSelectBoxUiCode({
|
||||||
|
codeList: industryLargeList,
|
||||||
|
parentSelector: '#industryLargeCode',
|
||||||
|
childSelector: '#industryMiddleCode',
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
// 임가번호 중복확인 변수
|
// 임가번호 중복확인 변수
|
||||||
let checkDuplicate = false;
|
let checkDuplicate = false;
|
||||||
|
|||||||
@@ -78,11 +78,8 @@
|
|||||||
지역
|
지역
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<select class="select-list" name="regionSubCode" th:field="*{regionSubCode}">
|
<select class="select-list" name="regionSubCode" id="regionSubCode" th:field="*{regionSubCode}">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${regionSubList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
@@ -91,11 +88,8 @@
|
|||||||
세부지역
|
세부지역
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<select class="select-list" name="regionDetailCode" th:field="*{regionDetailCode}">
|
<select class="select-list" name="regionDetailCode" id="regionDetailCode" th:field="*{regionDetailCode}">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${regionDetailList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -109,11 +103,8 @@
|
|||||||
업종 대분류
|
업종 대분류
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<select class="select-list" name="industryLargeCode" th:field="*{industryLargeCode}">
|
<select class="select-list" name="industryLargeCode" id="industryLargeCode" th:field="*{industryLargeCode}">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${industryLargeList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
@@ -122,11 +113,8 @@
|
|||||||
업종 중분류
|
업종 중분류
|
||||||
</p>
|
</p>
|
||||||
</div>
|
</div>
|
||||||
<select class="select-list" name="industryMiddleCode" th:field="*{industryMiddleCode}">
|
<select class="select-list" name="industryMiddleCode" id="industryMiddleCode" th:field="*{industryMiddleCode}">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${industryMiddleList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -284,6 +272,9 @@
|
|||||||
|
|
||||||
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
|
<div class="component-btns bottom-btn-group" th:unless="${activeProfile != 'local'}">
|
||||||
<div class="btns-row align-right">
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn" onclick="showExcelHouseholdModal();">
|
||||||
|
<span class="btn-txt">엑셀 업로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
|
||||||
|
</button>
|
||||||
<button type="button" class="btn">
|
<button type="button" class="btn">
|
||||||
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
|
<span class="btn-txt">엑셀 다운로드 <i class="ico-download ico-small" aria-hidden="true"></i></span>
|
||||||
</button>
|
</button>
|
||||||
@@ -302,9 +293,40 @@
|
|||||||
</form>
|
</form>
|
||||||
|
|
||||||
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
|
<div th:replace="common/modal-researcher-mapping :: modalFragment"></div>
|
||||||
|
<div th:replace="households/modal/modal-excel-household :: modalFragment"></div>
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
const regionList = [[${regionSubList}]];
|
||||||
|
const selectedRegionSubCode = /*[[${reqVO.regionSubCode}]]*/ '';
|
||||||
|
const selectedRegionDetailCode = /*[[${reqVO.regionDetailCode}]]*/ '';
|
||||||
|
|
||||||
|
const industryLargeList = [[${industryLargeList}]];
|
||||||
|
const selectedIndustryLargeCode = /*[[${reqVO.industryLargeCode}]]*/ '';
|
||||||
|
const selectedIndustryMiddleCode= /*[[${reqVO.industryMiddleCode}]]*/ '';
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
// 지역, 세부지역 셀렉트박스 세팅
|
||||||
|
setSelectBoxUiCode({
|
||||||
|
codeList: regionList,
|
||||||
|
parentSelector: '#regionSubCode',
|
||||||
|
childSelector: '#regionDetailCode',
|
||||||
|
selectedParentCode: selectedRegionSubCode,
|
||||||
|
selectedChildCode: selectedRegionDetailCode
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업종 대분류, 중분류 셀렉트박스 세팅
|
||||||
|
setSelectBoxUiCode({
|
||||||
|
codeList: industryLargeList,
|
||||||
|
parentSelector: '#industryLargeCode',
|
||||||
|
childSelector: '#industryMiddleCode',
|
||||||
|
selectedParentCode: selectedIndustryLargeCode,
|
||||||
|
selectedChildCode: selectedIndustryMiddleCode
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
// 임가 목록 조회
|
// 임가 목록 조회
|
||||||
const getHouseholds = (pageNo) => {
|
const getHouseholds = (pageNo) => {
|
||||||
|
|||||||
@@ -0,0 +1,85 @@
|
|||||||
|
<!DOCTYPE html>
|
||||||
|
<html xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" xmlns:th="http://www.thymeleaf.org"
|
||||||
|
layout:decorate="~{layout/layout}">
|
||||||
|
|
||||||
|
<div class="layer-wrap" th:fragment="modalFragment">
|
||||||
|
<form autocomplete="off" method="get" name="reqHouseholdExcelForm">
|
||||||
|
|
||||||
|
<div class="component-modal mypage-wrap modal01 modal-excel-household" data-props-dimm-click="true" data-state="close">
|
||||||
|
<div class="modal-dimm"></div>
|
||||||
|
<div class="modal-frame">
|
||||||
|
<div class="modal-container">
|
||||||
|
<div class="modal-header">
|
||||||
|
<h3 class="modal-tit">
|
||||||
|
임가 등록 엑셀업로드
|
||||||
|
</h3>
|
||||||
|
</div>
|
||||||
|
<div class="modal-content">
|
||||||
|
<div class="modal-content-inner">
|
||||||
|
<label for="householdFile" class="input-file-btn">
|
||||||
|
<input type="file" name="file" id="householdFile" accept=".xlsx, .xls">
|
||||||
|
</label>
|
||||||
|
<div class="component-btns bottom-btn-group">
|
||||||
|
<div class="btns-row align-right">
|
||||||
|
<button type="button" class="btn btn-primary" onclick="ExcelUploadHousehold();">
|
||||||
|
<span class="btn-txt">등록</span>
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<button type="button" class="modal-close"></button>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</form>
|
||||||
|
|
||||||
|
<script th:inline="javascript">
|
||||||
|
// 임가방문정보 모달창 띄우기
|
||||||
|
const showExcelHouseholdModal = () => {
|
||||||
|
document.querySelector(".modal-excel-household").ui.open();
|
||||||
|
}
|
||||||
|
|
||||||
|
// 임가방문정보 등록
|
||||||
|
const ExcelUploadHousehold = () => {
|
||||||
|
event.preventDefault();
|
||||||
|
|
||||||
|
const fileInput = document.getElementById('householdFile');
|
||||||
|
if (fileInput.files.length === 0) {
|
||||||
|
alert('업로드할 엑셀 파일을 선택해주세요.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
let formData = new FormData();
|
||||||
|
formData.append('file', fileInput.files[0]);
|
||||||
|
|
||||||
|
$.ajax({
|
||||||
|
method: 'POST',
|
||||||
|
url: '/api/household/excelUpload',
|
||||||
|
data: formData,
|
||||||
|
contentType: false, // * 중요 *
|
||||||
|
processData: false, // * 중요 *
|
||||||
|
enctype: 'multipart/form-data', // * 중요 *
|
||||||
|
beforeSend: function (xhr) {
|
||||||
|
xhr.setRequestHeader(
|
||||||
|
$("meta[name='_csrf_header']").attr("content"),
|
||||||
|
$("meta[name='_csrf']").attr("content"));
|
||||||
|
},
|
||||||
|
success(res) {
|
||||||
|
alert("총 "+res.total+"건 중에 "+res.success+"건 등록되었습니다.");
|
||||||
|
},
|
||||||
|
statusCode: {
|
||||||
|
422: (res) => {
|
||||||
|
const resJson = res.responseJSON;
|
||||||
|
$(input).parent().find('.invalid-feedback').text(resJson.message);
|
||||||
|
$(input).addClass('is-invalid');
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
</script>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
</html>
|
||||||
@@ -141,24 +141,16 @@
|
|||||||
<th>지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" name="regionSubCode" required>
|
<select class="select-list" name="regionSubCode" id="regionSubCode" required>
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${regionSubList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}"
|
|
||||||
th:selected="${item.id == householdInfo.regionSubCode}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>세부 지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
<th>세부 지역<i class="ico-required-mark" role="img" aria-label="필수">*</i></th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" name="regionDetailCode" required>
|
<select class="select-list" name="regionDetailCode" id="regionDetailCode" required>
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${regionDetailList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}"
|
|
||||||
th:selected="${item.id == householdInfo.regionDetailCode}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -178,24 +170,16 @@
|
|||||||
<th>업종 대분류</th>
|
<th>업종 대분류</th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" name="industryLargeCode">
|
<select class="select-list" name="industryLargeCode" id="industryLargeCode">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>>
|
||||||
<option th:each="item : ${industryLargeList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}"
|
|
||||||
th:selected="${item.id == householdInfo.industryLargeCode}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
<th>업종 중분류1</th>
|
<th>업종 중분류1</th>
|
||||||
<td>
|
<td>
|
||||||
<div class="component-select">
|
<div class="component-select">
|
||||||
<select class="select-list" name="industryMiddleCode">
|
<select class="select-list" name="industryMiddleCode" id="industryMiddleCode">
|
||||||
<option value="">전체</option>
|
<option value="">전체</option>
|
||||||
<option th:each="item : ${industryMiddleList}"
|
|
||||||
th:value="${item.id}"
|
|
||||||
th:text="${item.codeValue + '. ' + item.codeText}"
|
|
||||||
th:selected="${item.id == householdInfo.industryMiddleCode}">
|
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
@@ -296,6 +280,36 @@
|
|||||||
</section>
|
</section>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
|
<script th:inline="javascript">
|
||||||
|
const regionList = [[${regionSubList}]];
|
||||||
|
const selectedRegionSubCode = /*[[${householdInfo.regionSubCode}]]*/ '';
|
||||||
|
const selectedRegionDetailCode = /*[[${householdInfo.regionDetailCode}]]*/ '';
|
||||||
|
|
||||||
|
const industryLargeList = [[${industryLargeList}]];
|
||||||
|
const selectedIndustryLargeCode = /*[[${householdInfo.industryLargeCode}]]*/ '';
|
||||||
|
const selectedIndustryMiddleCode= /*[[${householdInfo.industryMiddleCode}]]*/ '';
|
||||||
|
|
||||||
|
$(document).ready(function () {
|
||||||
|
// 지역, 세부지역 셀렉트박스 세팅
|
||||||
|
setSelectBoxUiCode({
|
||||||
|
codeList: regionList,
|
||||||
|
parentSelector: '#regionSubCode',
|
||||||
|
childSelector: '#regionDetailCode',
|
||||||
|
selectedParentCode: selectedRegionSubCode,
|
||||||
|
selectedChildCode: selectedRegionDetailCode
|
||||||
|
});
|
||||||
|
|
||||||
|
// 업종 대분류, 중분류 셀렉트박스 세팅
|
||||||
|
setSelectBoxUiCode({
|
||||||
|
codeList: industryLargeList,
|
||||||
|
parentSelector: '#industryLargeCode',
|
||||||
|
childSelector: '#industryMiddleCode',
|
||||||
|
selectedParentCode: selectedIndustryLargeCode,
|
||||||
|
selectedChildCode: selectedIndustryMiddleCode
|
||||||
|
});
|
||||||
|
});
|
||||||
|
</script>
|
||||||
|
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
// 임가 수정
|
// 임가 수정
|
||||||
const updateHousehold= () => {
|
const updateHousehold= () => {
|
||||||
|
|||||||
@@ -0,0 +1,110 @@
|
|||||||
|
package app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence;
|
||||||
|
|
||||||
|
import app.module.core.config.application.util.AuditUtil;
|
||||||
|
import app.module.core.usecase.admin.checkAdminId.persistence.CheckAdminIdMapper;
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model.ExcelAdminCreateVO;
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model.ExcelResultVO;
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.ports.ExcelSaveAdminPortOut;
|
||||||
|
import app.module.core.usecase.admin.saveAdmin.adapters.persistence.SaveAdminMapper;
|
||||||
|
import app.module.core.usecase.admin.saveAdmin.adapters.persistence.model.SaveAdminHasRoleParam;
|
||||||
|
import app.module.core.usecase.admin.saveAdmin.ports.application.domain.SaveAdminCmd;
|
||||||
|
import app.module.core.usecase.uicode.list.adapters.persistence.UICodeListMapper;
|
||||||
|
import app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.apache.poi.ss.usermodel.*;
|
||||||
|
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
|
||||||
|
import org.springframework.stereotype.Component;
|
||||||
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
@Component
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
class ExcelSaveAdminIdDao implements ExcelSaveAdminPortOut {
|
||||||
|
|
||||||
|
private final CheckAdminIdMapper checkAdminIdMapper;
|
||||||
|
private final SaveAdminMapper saveAdminMapper;
|
||||||
|
private final BCryptPasswordEncoder passwordEncoder;
|
||||||
|
private final UICodeListMapper uiCodeListMapper;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public ExcelResultVO operate(MultipartFile file) throws IOException {
|
||||||
|
// 엑셀 파일 읽기
|
||||||
|
Workbook workbook = WorkbookFactory.create(file.getInputStream());
|
||||||
|
Sheet sheet = workbook.getSheetAt(0);
|
||||||
|
Integer success = 0;
|
||||||
|
List<UICodeElement> uiCodeElementList = uiCodeListMapper.findByParentId("code.region.main");
|
||||||
|
// 첫 번째 행은 헤더로 간주하고 스킵
|
||||||
|
for (int i = 1; i <= sheet.getLastRowNum(); i++) {
|
||||||
|
Row row = sheet.getRow(i);
|
||||||
|
if (row == null) continue;
|
||||||
|
|
||||||
|
ExcelAdminCreateVO admin = new ExcelAdminCreateVO();
|
||||||
|
admin.setRoleId(getRoleId(row.getCell(0))); // 권한
|
||||||
|
admin.setRegionMainCode(getRegionMainCode(row.getCell(1),uiCodeElementList)); // 실사
|
||||||
|
admin.setId(getCellValue(row.getCell(2))); // ID
|
||||||
|
admin.setPassword(getCellValue(row.getCell(3))); // 비밀번호
|
||||||
|
admin.setName(getCellValue(row.getCell(4))); // 이름
|
||||||
|
admin.setPhone(getCellValue(row.getCell(5))); // 전화번호
|
||||||
|
|
||||||
|
Integer duplicate = checkAdminIdMapper.checkAdminId(admin.getId());
|
||||||
|
|
||||||
|
if(duplicate == 0) {
|
||||||
|
SaveAdminCmd cmd = new SaveAdminCmd(
|
||||||
|
null,
|
||||||
|
admin.getId(),
|
||||||
|
passwordEncoder.encode(admin.getPassword()),
|
||||||
|
LocalDateTime.now(),
|
||||||
|
admin.getName(),
|
||||||
|
admin.getPhone(),
|
||||||
|
admin.getRegionMainCode(),
|
||||||
|
false,
|
||||||
|
0,
|
||||||
|
admin.getRoleId()
|
||||||
|
);
|
||||||
|
success += saveAdminMapper.insertAdmin(AuditUtil.create(cmd));
|
||||||
|
|
||||||
|
if (!admin.getRoleId().isEmpty()) {
|
||||||
|
saveAdminMapper.insertAdminHasRoles(
|
||||||
|
AuditUtil.create(new SaveAdminHasRoleParam(cmd.getSeq(), admin.getRoleId())));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
workbook.close();
|
||||||
|
return new ExcelResultVO(sheet.getLastRowNum()-1 , success);
|
||||||
|
}
|
||||||
|
|
||||||
|
// 셀 값을 문자열로 변환
|
||||||
|
private String getCellValue(Cell cell) {
|
||||||
|
if (cell == null) return "";
|
||||||
|
return switch (cell.getCellType()) {
|
||||||
|
case STRING -> cell.getStringCellValue();
|
||||||
|
case NUMERIC -> String.valueOf((long) cell.getNumericCellValue());
|
||||||
|
default -> "";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getRoleId(Cell cell){
|
||||||
|
if (cell == null) return "";
|
||||||
|
return switch (cell.getStringCellValue().trim()) {
|
||||||
|
case "관리자" -> "ROLE_ADMIN";
|
||||||
|
case "지방실사" -> "ROLE_LOCAL_INSPECTOR";
|
||||||
|
case "조사원" -> "ROLE_RESEARCHER";
|
||||||
|
default -> "";
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
private String getRegionMainCode(Cell cell,List<UICodeElement> uiCodeElementList){
|
||||||
|
if (cell == null) return "";
|
||||||
|
|
||||||
|
return uiCodeElementList.stream().filter(code -> code.getCodeText().equals(cell.getStringCellValue().trim()))
|
||||||
|
.findFirst()
|
||||||
|
.map(UICodeElement::getId).orElse("");
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,20 @@
|
|||||||
|
package app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ExcelAdminCreateVO {
|
||||||
|
private Long seq;
|
||||||
|
private String id;
|
||||||
|
private String password;
|
||||||
|
private String name;
|
||||||
|
private String phone;
|
||||||
|
private String regionMainCode;
|
||||||
|
private String roleId;
|
||||||
|
}
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model;
|
||||||
|
|
||||||
|
import lombok.AllArgsConstructor;
|
||||||
|
import lombok.Getter;
|
||||||
|
import lombok.NoArgsConstructor;
|
||||||
|
import lombok.Setter;
|
||||||
|
|
||||||
|
@Getter
|
||||||
|
@Setter
|
||||||
|
@AllArgsConstructor
|
||||||
|
@NoArgsConstructor
|
||||||
|
public class ExcelResultVO {
|
||||||
|
private Integer total;
|
||||||
|
private Integer success;
|
||||||
|
}
|
||||||
@@ -0,0 +1,9 @@
|
|||||||
|
package app.module.core.usecase.admin.excelSaveAdmin.ports;
|
||||||
|
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model.ExcelResultVO;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public interface ExcelSaveAdminPortIn {
|
||||||
|
ExcelResultVO operate(MultipartFile file) throws IOException;
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
package app.module.core.usecase.admin.excelSaveAdmin.ports;
|
||||||
|
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model.ExcelResultVO;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
public interface ExcelSaveAdminPortOut {
|
||||||
|
|
||||||
|
ExcelResultVO operate(MultipartFile file) throws IOException;
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package app.module.core.usecase.admin.excelSaveAdmin.ports.application;
|
||||||
|
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.adapters.persistence.model.ExcelResultVO;
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.ports.ExcelSaveAdminPortIn;
|
||||||
|
import app.module.core.usecase.admin.excelSaveAdmin.ports.ExcelSaveAdminPortOut;
|
||||||
|
import app.module.core.usecase.admin.saveAdmin.ports.SaveAdminPortOut;
|
||||||
|
import lombok.RequiredArgsConstructor;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import org.springframework.web.multipart.MultipartFile;
|
||||||
|
|
||||||
|
import java.io.IOException;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
@RequiredArgsConstructor
|
||||||
|
public class ExcelSaveAdminService implements ExcelSaveAdminPortIn {
|
||||||
|
|
||||||
|
private final ExcelSaveAdminPortOut excelSaveAdminPortOut;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public ExcelResultVO operate(MultipartFile file) throws IOException {
|
||||||
|
|
||||||
|
return excelSaveAdminPortOut.operate(file);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@@ -7,7 +7,7 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
|
|
||||||
@Mapper
|
@Mapper
|
||||||
public interface SaveAdminMapper {
|
public interface SaveAdminMapper {
|
||||||
void insertAdmin(SaveAdminCmd cmd);
|
Integer insertAdmin(SaveAdminCmd cmd);
|
||||||
void updateAdmin(SaveAdminCmd cmd);
|
void updateAdmin(SaveAdminCmd cmd);
|
||||||
void insertAdminHasRoles(SaveAdminHasRoleParam param);
|
void insertAdminHasRoles(SaveAdminHasRoleParam param);
|
||||||
void deleteAdminRolesByAdminId(DeleteAdminHasRoleParam param);
|
void deleteAdminRolesByAdminId(DeleteAdminHasRoleParam param);
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import app.module.core.config.adapters.persistence.entity.UploadFile;
|
|||||||
import app.module.core.config.application.annotation.DeleteCommand;
|
import app.module.core.config.application.annotation.DeleteCommand;
|
||||||
import app.module.core.config.application.annotation.UpdateCommand;
|
import app.module.core.config.application.annotation.UpdateCommand;
|
||||||
import app.module.core.config.application.enums.FileUploadType;
|
import app.module.core.config.application.enums.FileUploadType;
|
||||||
|
import app.module.core.config.application.util.AuditUtil;
|
||||||
import app.module.core.config.application.util.CommonUtil;
|
import app.module.core.config.application.util.CommonUtil;
|
||||||
import app.module.core.config.application.util.SftpFileDeleteUtil;
|
import app.module.core.config.application.util.SftpFileDeleteUtil;
|
||||||
import app.module.core.usecase.file.createFile.ports.CreateFilePortOut;
|
import app.module.core.usecase.file.createFile.ports.CreateFilePortOut;
|
||||||
@@ -34,11 +35,11 @@ class UpdateFileDao implements UpdateFilePortOut {
|
|||||||
@DeleteCommand
|
@DeleteCommand
|
||||||
public void operate(UpdateFileCmd command) {
|
public void operate(UpdateFileCmd command) {
|
||||||
|
|
||||||
List<UploadFileDto> deletedFileList = mapper.findDeleteFileList(new UpdateUploadFileParam(
|
List<UploadFileDto> deletedFileList = mapper.findDeleteFileList(AuditUtil.update(new UpdateUploadFileParam(
|
||||||
command.getId(),
|
command.getId(),
|
||||||
command.getFileMappingIds(),
|
command.getFileMappingIds(),
|
||||||
command.getType().getName()
|
command.getType().getName()
|
||||||
));
|
)));
|
||||||
|
|
||||||
for (UploadFileDto file : deletedFileList) {
|
for (UploadFileDto file : deletedFileList) {
|
||||||
try {
|
try {
|
||||||
@@ -54,13 +55,13 @@ class UpdateFileDao implements UpdateFilePortOut {
|
|||||||
|
|
||||||
if (!deletedFileList.isEmpty()) {
|
if (!deletedFileList.isEmpty()) {
|
||||||
mapper.deleteFile(
|
mapper.deleteFile(
|
||||||
new UpdateUploadFileParam(
|
AuditUtil.delete(new UpdateUploadFileParam(
|
||||||
command.getId(),
|
command.getId(),
|
||||||
deletedFileList.stream().map(UploadFileDto::getId).toList(),
|
deletedFileList.stream().map(UploadFileDto::getId).toList(),
|
||||||
command.getType().getName()));
|
command.getType().getName())));
|
||||||
}
|
}
|
||||||
|
|
||||||
command.getFileMappingIds().forEach(fileId -> mapper.updateFile(new UploadFileDto(fileId, command.getId(),command.getType().getName())));
|
command.getFileMappingIds().forEach(fileId -> mapper.updateFile(AuditUtil.update(new UploadFileDto(fileId, command.getId(),command.getType().getName()))));
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,4 +8,5 @@ import org.apache.ibatis.annotations.Param;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface UICodeListMapper {
|
public interface UICodeListMapper {
|
||||||
List<UICodeElement> findByParentId(@Param("parentId") String parentId);
|
List<UICodeElement> findByParentId(@Param("parentId") String parentId);
|
||||||
|
List<UICodeElement> findByLikeId(@Param("id") String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -23,6 +23,13 @@ class UICodeTopTierDao implements UICodeTopTierPortOut {
|
|||||||
return recursiveMapping(topTier);
|
return recursiveMapping(topTier);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
@Transactional
|
||||||
|
public UICodeTopTier connect(String id) {
|
||||||
|
UICode topTier = mapper.findTopTierId(id);
|
||||||
|
return recursiveMapping(topTier);
|
||||||
|
}
|
||||||
|
|
||||||
private UICodeTopTier recursiveMapping(UICode topTier) {
|
private UICodeTopTier recursiveMapping(UICode topTier) {
|
||||||
List<UICode> children = mapper.findChildren(topTier.getId());
|
List<UICode> children = mapper.findChildren(topTier.getId());
|
||||||
|
|
||||||
|
|||||||
@@ -7,5 +7,6 @@ import org.apache.ibatis.annotations.Mapper;
|
|||||||
@Mapper
|
@Mapper
|
||||||
public interface UICodeTopTierMapper {
|
public interface UICodeTopTierMapper {
|
||||||
UICode findTopTier(); // parent_id IS NULL 인 UICode 조회
|
UICode findTopTier(); // parent_id IS NULL 인 UICode 조회
|
||||||
|
UICode findTopTierId(String id); // UICode id 조회
|
||||||
List<UICode> findChildren(String parentId); // 재귀 하위 코드
|
List<UICode> findChildren(String parentId); // 재귀 하위 코드
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ import app.module.core.usecase.uicode.toptier.ports.application.domain.UICodeTop
|
|||||||
public interface UICodeTopTierPortIn {
|
public interface UICodeTopTierPortIn {
|
||||||
|
|
||||||
UICodeTopTier connect();
|
UICodeTopTier connect();
|
||||||
|
UICodeTopTier connect(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,4 +5,5 @@ import app.module.core.usecase.uicode.toptier.ports.application.domain.UICodeTop
|
|||||||
public interface UICodeTopTierPortOut {
|
public interface UICodeTopTierPortOut {
|
||||||
|
|
||||||
UICodeTopTier connect();
|
UICodeTopTier connect();
|
||||||
|
UICodeTopTier connect(String id);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,4 +16,10 @@ public class UICodeTopTierService implements UICodeTopTierPortIn {
|
|||||||
public UICodeTopTier connect() {
|
public UICodeTopTier connect() {
|
||||||
return portOut.connect();
|
return portOut.connect();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UICodeTopTier connect(String parentId) {
|
||||||
|
return portOut.connect(parentId);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
|
||||||
<mapper namespace="app.module.core.usecase.admin.saveAdmin.adapters.persistence.SaveAdminMapper">
|
<mapper namespace="app.module.core.usecase.admin.saveAdmin.adapters.persistence.SaveAdminMapper">
|
||||||
|
|
||||||
<insert id="insertAdmin">
|
<update id="insertAdmin">
|
||||||
<selectKey keyProperty="seq" resultType="long" order="BEFORE">
|
<selectKey keyProperty="seq" resultType="long" order="BEFORE">
|
||||||
SELECT nextval('admin_seq')
|
SELECT nextval('admin_seq')
|
||||||
</selectKey>
|
</selectKey>
|
||||||
@@ -29,7 +29,7 @@
|
|||||||
#{accountDisabled},
|
#{accountDisabled},
|
||||||
#{loginFailCnt},
|
#{loginFailCnt},
|
||||||
<include refid="common.fields.CreateUpdateBaseValues"/>)
|
<include refid="common.fields.CreateUpdateBaseValues"/>)
|
||||||
</insert>
|
</update>
|
||||||
|
|
||||||
<update id="updateAdmin">
|
<update id="updateAdmin">
|
||||||
/* updateAdmin : 관리자 정보 수정 */
|
/* updateAdmin : 관리자 정보 수정 */
|
||||||
|
|||||||
@@ -19,4 +19,20 @@
|
|||||||
ORDER BY order_no ASC
|
ORDER BY order_no ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="findByLikeId" resultType="app.module.core.usecase.uicode.list.ports.application.domain.UICodeElement">
|
||||||
|
SELECT
|
||||||
|
id,
|
||||||
|
parent_id,
|
||||||
|
order_no,
|
||||||
|
code_text,
|
||||||
|
code_value,
|
||||||
|
code_type,
|
||||||
|
msg_code,
|
||||||
|
in_use
|
||||||
|
FROM uicode
|
||||||
|
WHERE id LIKE '%' || #{id} || '%'
|
||||||
|
AND is_deleted = false
|
||||||
|
ORDER BY order_no ASC
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -19,4 +19,12 @@
|
|||||||
AND is_deleted = false
|
AND is_deleted = false
|
||||||
ORDER BY order_no ASC
|
ORDER BY order_no ASC
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="findTopTierId"
|
||||||
|
resultType="app.module.core.config.adapters.persistence.entity.UICode">
|
||||||
|
SELECT id, code_text, order_no, parent_id
|
||||||
|
FROM uicode
|
||||||
|
WHERE id = #{id}
|
||||||
|
AND is_deleted = false
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
||||||
@@ -61,7 +61,8 @@ class CreateBankInputController {
|
|||||||
//TODO 트렌젝션 고려
|
//TODO 트렌젝션 고려
|
||||||
removeBanksPortIn.operate(new RemoveBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq(), reqVO.getTransferType()));
|
removeBanksPortIn.operate(new RemoveBanksCmd(currentMonthlyInfo.getId(), AuthUtil.getUserSeq(), reqVO.getTransferType()));
|
||||||
|
|
||||||
if (!reqVO.getStatus() && reqVO.getBankList() != null && !reqVO.getBankList().isEmpty()) { // 등록없음 처리가 아님.
|
// if (!reqVO.getStatus() && reqVO.getBankList() != null && !reqVO.getBankList().isEmpty()) { // 등록없음 처리가 아님.
|
||||||
|
if (reqVO.getBankList() != null && !reqVO.getBankList().isEmpty()) { // 등록없음 처리가 아님.
|
||||||
for (CreateBankInputProductReqVO item : reqVO.getBankList()) {
|
for (CreateBankInputProductReqVO item : reqVO.getBankList()) {
|
||||||
|
|
||||||
UICodeView code = uiCodeViewPortIn.connect(item.getTransferCategoryCode()).orElse(null);
|
UICodeView code = uiCodeViewPortIn.connect(item.getTransferCategoryCode()).orElse(null);
|
||||||
@@ -99,16 +100,17 @@ class CreateBankInputController {
|
|||||||
reqVO.getTransferType().equals("code.bank.input") ? MonthStatus.REGISTERED : currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
reqVO.getTransferType().equals("code.bank.input") ? MonthStatus.REGISTERED : currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||||
reqVO.getTransferType().equals("code.bank.output") ? MonthStatus.REGISTERED : currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
reqVO.getTransferType().equals("code.bank.output") ? MonthStatus.REGISTERED : currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
||||||
));
|
));
|
||||||
} else {
|
|
||||||
updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
|
|
||||||
currentMonthlyInfo.getId(),
|
|
||||||
AuthUtil.getUserSeq(),
|
|
||||||
currentMonthlyInfo.getMonth(),
|
|
||||||
currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
|
||||||
reqVO.getTransferType().equals("code.bank.input") ? MonthStatus.NOTHING : currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
|
||||||
reqVO.getTransferType().equals("code.bank.output") ? MonthStatus.NOTHING : currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
|
||||||
));
|
|
||||||
}
|
}
|
||||||
|
// else {
|
||||||
|
// updateMonthlyInputStatusPortIn.operate(new UpdateMonthlyInputStatusCmd(
|
||||||
|
// currentMonthlyInfo.getId(),
|
||||||
|
// AuthUtil.getUserSeq(),
|
||||||
|
// currentMonthlyInfo.getMonth(),
|
||||||
|
// currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||||
|
// reqVO.getTransferType().equals("code.bank.input") ? MonthStatus.NOTHING : currentMonthlyInfo.getBankAutoTransferInputStatus(),
|
||||||
|
// reqVO.getTransferType().equals("code.bank.output") ? MonthStatus.NOTHING : currentMonthlyInfo.getBankAutoTransferOutputStatus()
|
||||||
|
// ));
|
||||||
|
// }
|
||||||
return ResponseEntity.ok(ApiResponse.success(null));
|
return ResponseEntity.ok(ApiResponse.success(null));
|
||||||
} else {
|
} else {
|
||||||
return ResponseEntity.ok(ApiResponse.failure(null));
|
return ResponseEntity.ok(ApiResponse.failure(null));
|
||||||
|
|||||||
@@ -13,7 +13,7 @@ import java.util.List;
|
|||||||
public class CreateBankInputReqVO {
|
public class CreateBankInputReqVO {
|
||||||
|
|
||||||
|
|
||||||
private Boolean status;
|
// private Boolean status;
|
||||||
private Long id;
|
private Long id;
|
||||||
private String transferType;
|
private String transferType;
|
||||||
private List<CreateBankInputProductReqVO> bankList;
|
private List<CreateBankInputProductReqVO> bankList;
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
AND a.forest_product_status != 'NONE'
|
AND a.forest_product_status != 'NONE'
|
||||||
AND a.household_seq = #{householdSeq}
|
AND a.household_seq = #{householdSeq}
|
||||||
AND a.month = (
|
AND a.month = (
|
||||||
SELECT TO_CHAR(TO_DATE(month, 'YYYY-MM') - INTERVAL '1 month', 'YYYY-MM')
|
SELECT TO_CHAR(TO_DATE(month, 'YYYYMM') - INTERVAL '1 month', 'YYYYMM')
|
||||||
FROM monthly_input_status
|
FROM monthly_input_status
|
||||||
WHERE is_deleted = false AND id = #{id}
|
WHERE is_deleted = false AND id = #{id}
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -31,18 +31,18 @@
|
|||||||
<span class="btn-txt">추가 등록</span>
|
<span class="btn-txt">추가 등록</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button type="button" class="btn btn-m btn-link btn-full" id="callPastInfoBtn">
|
<button type="button" class="btn btn-m btn-link btn-full" id="callPastInfoBtn" onclick="formControl.checkUsePastData()">
|
||||||
<span class="btn-txt">이전 정보 불러오기</span>
|
<span class="btn-txt">이전 정보 불러오기</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
<div class="component-input align-center" id="forestProductStatusDiv">
|
<!-- <div class="component-input align-center" id="forestProductStatusDiv">-->
|
||||||
<label class="checkbox-inner">
|
<!-- <label class="checkbox-inner">-->
|
||||||
<input type="checkbox" id="forestProductStatus" name="forestProductStatus"
|
<!-- <input type="checkbox" id="forestProductStatus" name="forestProductStatus"-->
|
||||||
th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">
|
<!-- th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">-->
|
||||||
<span class="checkbox-item"><span class="checkbox-txt">이번달 등록내용 없음</span></span>
|
<!-- <span class="checkbox-item"><span class="checkbox-txt">이번달 등록내용 없음</span></span>-->
|
||||||
</label>
|
<!-- </label>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -97,7 +97,7 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
</div>"/api/front/info/bank/create"
|
</div>
|
||||||
|
|
||||||
<section layout:fragment="script">
|
<section layout:fragment="script">
|
||||||
<script th:inline="javascript">
|
<script th:inline="javascript">
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
editable: /*[[${editable}]]*/,
|
editable: /*[[${editable}]]*/,
|
||||||
},
|
},
|
||||||
elementRefs: {
|
elementRefs: {
|
||||||
noDataCheckbox: document.getElementById("forestProductStatus"),
|
// noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||||
select:{
|
select:{
|
||||||
cropCodeSelect : null,
|
cropCodeSelect : null,
|
||||||
transferCategoryCodeSelect : null,
|
transferCategoryCodeSelect : null,
|
||||||
@@ -190,7 +190,8 @@
|
|||||||
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
||||||
|
|
||||||
//데이터 없음 버튼
|
//데이터 없음 버튼
|
||||||
const forestProductStatus = document.getElementById("forestProductStatus");
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
|
// const forestProductStatus = document.getElementById("forestProductStatus");
|
||||||
|
|
||||||
//등록 완료 버튼
|
//등록 완료 버튼
|
||||||
const next = document.getElementById('complateBtn');
|
const next = document.getElementById('complateBtn');
|
||||||
@@ -206,15 +207,17 @@
|
|||||||
if (ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastBankList.length > 0) {
|
if (ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastBankList.length > 0) {
|
||||||
this.checkUsePastData();
|
this.checkUsePastData();
|
||||||
}
|
}
|
||||||
} else if (ENV.data.currentStatus == "NOTHING") {
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
|
// }
|
||||||
|
// else if (ENV.data.currentStatus == "NOTHING") {
|
||||||
addItemBtn.disabled = true;
|
//
|
||||||
icon.classList.toggle("ico-add", false);
|
//
|
||||||
icon.classList.toggle("ico-add-disabled", true);
|
// addItemBtn.disabled = true;
|
||||||
callPastInfoBtn.disabled = true;
|
// icon.classList.toggle("ico-add", false);
|
||||||
forestProductStatus.checked = true;
|
// icon.classList.toggle("ico-add-disabled", true);
|
||||||
next.disabled = true;
|
// callPastInfoBtn.disabled = true;
|
||||||
|
// forestProductStatus.checked = true;
|
||||||
|
// next.disabled = true;
|
||||||
|
|
||||||
} else if (ENV.data.currentStatus == "REGISTERED") {
|
} else if (ENV.data.currentStatus == "REGISTERED") {
|
||||||
if (ENV.data.bankList.length > 0) {
|
if (ENV.data.bankList.length > 0) {
|
||||||
@@ -240,7 +243,7 @@
|
|||||||
icon.classList.toggle("ico-add", false);
|
icon.classList.toggle("ico-add", false);
|
||||||
icon.classList.toggle("ico-add-disabled", true);
|
icon.classList.toggle("ico-add-disabled", true);
|
||||||
callPastInfoBtn.disabled = true;
|
callPastInfoBtn.disabled = true;
|
||||||
forestProductStatus.disabled = true;
|
// forestProductStatus.disabled = true;
|
||||||
next.disabled = true;
|
next.disabled = true;
|
||||||
next.style.display = "none";
|
next.style.display = "none";
|
||||||
clearAllItems.style.display = "none";
|
clearAllItems.style.display = "none";
|
||||||
@@ -321,12 +324,12 @@
|
|||||||
},
|
},
|
||||||
updateLayout() {
|
updateLayout() {
|
||||||
|
|
||||||
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
|
// const btn = document.getElementById("addItemBtn");
|
||||||
|
// const isChecked = ENV.elementRefs.noDataCheckbox.checked;
|
||||||
|
// const icon = btn.querySelector("i");
|
||||||
|
// const status = document.getElementById('forestProductStatusDiv');
|
||||||
|
|
||||||
const isChecked = ENV.elementRefs.noDataCheckbox.checked;
|
|
||||||
const btn = document.getElementById("addItemBtn");
|
|
||||||
const icon = btn.querySelector("i");
|
|
||||||
|
|
||||||
const status = document.getElementById('forestProductStatusDiv');
|
|
||||||
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
||||||
|
|
||||||
const next = document.getElementById('complateBtn');
|
const next = document.getElementById('complateBtn');
|
||||||
@@ -334,20 +337,20 @@
|
|||||||
const count = document.getElementById('listCount');
|
const count = document.getElementById('listCount');
|
||||||
const totalItems = document.getElementById('totalItems');
|
const totalItems = document.getElementById('totalItems');
|
||||||
const total = ENV.data.bankList.length;
|
const total = ENV.data.bankList.length;
|
||||||
|
const isData = total > 0;
|
||||||
|
|
||||||
|
header.style.display = isData ? '' : 'none';
|
||||||
header.style.display = total > 0 ? '' : 'none';
|
// status.style.display = total > 0 ? 'none' : '';
|
||||||
status.style.display = total > 0 ? 'none' : '';
|
callPastInfoBtn.style.display = isData? 'none' : '';
|
||||||
callPastInfoBtn.style.display = total > 0 ? 'none' : '';
|
|
||||||
count.textContent = total;
|
count.textContent = total;
|
||||||
totalItems.textContent = total;
|
totalItems.textContent = total;
|
||||||
|
|
||||||
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
btn.disabled = isChecked;
|
// btn.disabled = isData;
|
||||||
icon.classList.toggle("ico-add", !isChecked);
|
// icon.classList.toggle("ico-add", !isData);
|
||||||
icon.classList.toggle("ico-add-disabled", isChecked);
|
// icon.classList.toggle("ico-add-disabled", isData);
|
||||||
if (isChecked) {
|
if (isData) {
|
||||||
next.disabled = !isChecked;
|
next.disabled = !isData;
|
||||||
} else {
|
} else {
|
||||||
next.disabled = total <= 0;
|
next.disabled = total <= 0;
|
||||||
}
|
}
|
||||||
@@ -486,7 +489,7 @@
|
|||||||
ajaxUtil._ajaxAsync(
|
ajaxUtil._ajaxAsync(
|
||||||
ENV.httpUrl.save,
|
ENV.httpUrl.save,
|
||||||
{
|
{
|
||||||
status: ENV.elementRefs.noDataCheckbox.checked,
|
// status: ENV.elementRefs.noDataCheckbox.checked,
|
||||||
id: ENV.data.id,
|
id: ENV.data.id,
|
||||||
transferType:"code.bank.input",
|
transferType:"code.bank.input",
|
||||||
bankList: ENV.data.bankList
|
bankList: ENV.data.bankList
|
||||||
|
|||||||
@@ -31,18 +31,18 @@
|
|||||||
<span class="btn-txt">추가 등록</span>
|
<span class="btn-txt">추가 등록</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
<button type="button" class="btn btn-m btn-link btn-full" id="callPastInfoBtn">
|
<button type="button" class="btn btn-m btn-link btn-full" id="callPastInfoBtn" onclick="formControl.checkUsePastData()">
|
||||||
<span class="btn-txt">이전 정보 불러오기</span>
|
<span class="btn-txt">이전 정보 불러오기</span>
|
||||||
</button>
|
</button>
|
||||||
|
|
||||||
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
<div class="component-input align-center" id="forestProductStatusDiv">
|
<!-- <div class="component-input align-center" id="forestProductStatusDiv">-->
|
||||||
<label class="checkbox-inner">
|
<!-- <label class="checkbox-inner">-->
|
||||||
<input type="checkbox" id="forestProductStatus" name="forestProductStatus"
|
<!-- <input type="checkbox" id="forestProductStatus" name="forestProductStatus"-->
|
||||||
th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">
|
<!-- th:value="${MonthStatus.NOTHING}" onchange="formControl.handleNoDataToggle()">-->
|
||||||
<span class="checkbox-item"><span class="checkbox-txt">이번달 등록내용 없음</span></span>
|
<!-- <span class="checkbox-item"><span class="checkbox-txt">이번달 등록내용 없음</span></span>-->
|
||||||
</label>
|
<!-- </label>-->
|
||||||
</div>
|
<!-- </div>-->
|
||||||
|
|
||||||
</section>
|
</section>
|
||||||
|
|
||||||
@@ -122,7 +122,7 @@
|
|||||||
editable: /*[[${editable}]]*/,
|
editable: /*[[${editable}]]*/,
|
||||||
},
|
},
|
||||||
elementRefs: {
|
elementRefs: {
|
||||||
noDataCheckbox: document.getElementById("forestProductStatus"),
|
// noDataCheckbox: document.getElementById("forestProductStatus"),
|
||||||
select:{
|
select:{
|
||||||
transferCategoryCodeSelect : null,
|
transferCategoryCodeSelect : null,
|
||||||
unitCodeSelect : null,
|
unitCodeSelect : null,
|
||||||
@@ -189,7 +189,8 @@
|
|||||||
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
||||||
|
|
||||||
//데이터 없음 버튼
|
//데이터 없음 버튼
|
||||||
const forestProductStatus = document.getElementById("forestProductStatus");
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
|
// const forestProductStatus = document.getElementById("forestProductStatus");
|
||||||
|
|
||||||
//등록 완료 버튼
|
//등록 완료 버튼
|
||||||
const next = document.getElementById('complateBtn');
|
const next = document.getElementById('complateBtn');
|
||||||
@@ -205,15 +206,16 @@
|
|||||||
if (ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastBankList.length > 0) {
|
if (ENV.data.pastStatus && ENV.data.pastStatus == "REGISTERED" && ENV.data.pastBankList.length > 0) {
|
||||||
this.checkUsePastData();
|
this.checkUsePastData();
|
||||||
}
|
}
|
||||||
} else if (ENV.data.currentStatus == "NOTHING") {
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
|
// } else if (ENV.data.currentStatus == "NOTHING") {
|
||||||
|
//
|
||||||
addItemBtn.disabled = true;
|
//
|
||||||
icon.classList.toggle("ico-add", false);
|
// addItemBtn.disabled = true;
|
||||||
icon.classList.toggle("ico-add-disabled", true);
|
// icon.classList.toggle("ico-add", false);
|
||||||
callPastInfoBtn.disabled = true;
|
// icon.classList.toggle("ico-add-disabled", true);
|
||||||
forestProductStatus.checked = true;
|
// callPastInfoBtn.disabled = true;
|
||||||
next.disabled = true;
|
// forestProductStatus.checked = true;
|
||||||
|
// next.disabled = true;
|
||||||
|
|
||||||
} else if (ENV.data.currentStatus == "REGISTERED") {
|
} else if (ENV.data.currentStatus == "REGISTERED") {
|
||||||
if (ENV.data.bankList.length > 0) {
|
if (ENV.data.bankList.length > 0) {
|
||||||
@@ -239,7 +241,7 @@
|
|||||||
icon.classList.toggle("ico-add", false);
|
icon.classList.toggle("ico-add", false);
|
||||||
icon.classList.toggle("ico-add-disabled", true);
|
icon.classList.toggle("ico-add-disabled", true);
|
||||||
callPastInfoBtn.disabled = true;
|
callPastInfoBtn.disabled = true;
|
||||||
forestProductStatus.disabled = true;
|
// forestProductStatus.disabled = true;
|
||||||
next.disabled = true;
|
next.disabled = true;
|
||||||
next.style.display = "none";
|
next.style.display = "none";
|
||||||
clearAllItems.style.display = "none";
|
clearAllItems.style.display = "none";
|
||||||
@@ -313,11 +315,11 @@
|
|||||||
updateLayout() {
|
updateLayout() {
|
||||||
|
|
||||||
|
|
||||||
const isChecked = ENV.elementRefs.noDataCheckbox.checked;
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
const btn = document.getElementById("addItemBtn");
|
// const isChecked = ENV.elementRefs.noDataCheckbox.checked;
|
||||||
const icon = btn.querySelector("i");
|
// const btn = document.getElementById("addItemBtn");
|
||||||
|
// const icon = btn.querySelector("i");
|
||||||
const status = document.getElementById('forestProductStatusDiv');
|
// const status = document.getElementById('forestProductStatusDiv');
|
||||||
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
const callPastInfoBtn = document.getElementById("callPastInfoBtn");
|
||||||
|
|
||||||
const next = document.getElementById('complateBtn');
|
const next = document.getElementById('complateBtn');
|
||||||
@@ -325,20 +327,21 @@
|
|||||||
const count = document.getElementById('listCount');
|
const count = document.getElementById('listCount');
|
||||||
const totalItems = document.getElementById('totalItems');
|
const totalItems = document.getElementById('totalItems');
|
||||||
const total = ENV.data.bankList.length;
|
const total = ENV.data.bankList.length;
|
||||||
|
const isData = total > 0;
|
||||||
|
|
||||||
|
|
||||||
header.style.display = total > 0 ? '' : 'none';
|
header.style.display = isData ? '' : 'none';
|
||||||
status.style.display = total > 0 ? 'none' : '';
|
// status.style.display = total > 0 ? 'none' : '';
|
||||||
callPastInfoBtn.style.display = total > 0 ? 'none' : '';
|
callPastInfoBtn.style.display = isData ? 'none' : '';
|
||||||
count.textContent = total;
|
count.textContent = total;
|
||||||
totalItems.textContent = total;
|
totalItems.textContent = total;
|
||||||
|
|
||||||
|
<!-- TODO(ks) : "이번달 등록내용 없음" 삭제 확정 시 주석 지우기 -->
|
||||||
btn.disabled = isChecked;
|
// btn.disabled = isData;
|
||||||
icon.classList.toggle("ico-add", !isChecked);
|
// icon.classList.toggle("ico-add", !isData);
|
||||||
icon.classList.toggle("ico-add-disabled", isChecked);
|
// icon.classList.toggle("ico-add-disabled", isData);
|
||||||
if (isChecked) {
|
if (isData) {
|
||||||
next.disabled = !isChecked;
|
next.disabled = !isData;
|
||||||
} else {
|
} else {
|
||||||
next.disabled = total <= 0;
|
next.disabled = total <= 0;
|
||||||
}
|
}
|
||||||
@@ -480,7 +483,7 @@
|
|||||||
ajaxUtil._ajaxAsync(
|
ajaxUtil._ajaxAsync(
|
||||||
ENV.httpUrl.save,
|
ENV.httpUrl.save,
|
||||||
{
|
{
|
||||||
status: ENV.elementRefs.noDataCheckbox.checked,
|
// status: ENV.elementRefs.noDataCheckbox.checked,
|
||||||
id: ENV.data.id,
|
id: ENV.data.id,
|
||||||
transferType:"code.bank.output",
|
transferType:"code.bank.output",
|
||||||
bankList: ENV.data.bankList
|
bankList: ENV.data.bankList
|
||||||
|
|||||||
Reference in New Issue
Block a user