fix:외사분실현황 중간저장

TaehunPark 2022-09-29 17:55:12 +09:00
parent 4c86769cb6
commit 8e97cb8860
12 changed files with 674 additions and 30 deletions

View File

@ -2,25 +2,16 @@ package com.dbnt.faisp.fipTarget;
import com.dbnt.faisp.authMgt.service.AuthMgtService; import com.dbnt.faisp.authMgt.service.AuthMgtService;
import com.dbnt.faisp.equip.model.Equip;
import com.dbnt.faisp.equip.model.EquipLog;
import com.dbnt.faisp.equip.service.EquipService;
import com.dbnt.faisp.fipTarget.model.PartInfo; import com.dbnt.faisp.fipTarget.model.PartInfo;
import com.dbnt.faisp.fipTarget.service.FipTargetService; import com.dbnt.faisp.fipTarget.service.FipTargetService;
import com.dbnt.faisp.organMgt.service.OrganConfigService; import com.dbnt.faisp.organMgt.service.OrganConfigService;
import com.dbnt.faisp.publicBoard.model.PublicBoard;
import com.dbnt.faisp.translator.model.Translator;
import com.dbnt.faisp.userInfo.model.UserInfo; import com.dbnt.faisp.userInfo.model.UserInfo;
import com.dbnt.faisp.util.ParamMap; import com.dbnt.faisp.util.ParamMap;
import com.dbnt.faisp.util.Utils; import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.util.List; import java.util.List;
@ -43,16 +34,44 @@ public class FipTargetController {
private final FipTargetService fipTargetSevice; private final FipTargetService fipTargetSevice;
@GetMapping("/partInfoList") @GetMapping("/partInfoList")
public ModelAndView partInfoList(@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo) { public ModelAndView partInfoList(@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo, HttpServletResponse response) {
ModelAndView mav = new ModelAndView("fipTarget/partInfoList"); ModelAndView mav = new ModelAndView("fipTarget/partInfoList");
partInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
//엑셀다운
if(partInfo.getExcel() != null && partInfo.getExcel().equals("Y")){
ParamMap header = fipTargetSevice.selectWorkTypeTotal(partInfo);
String[] headers = { "mgt_organ", "land_police", "mp_work_type", "mp_people_cnt", "mp_description", "pl_work_type", "pl_people_cnt", "pl_description", "terminal_nm", "pi_manager_name", "rent_price", "utility_price", "wrt_dt"};
String[] headerNames = { "해경서", "육경서", "해경", "", "", "육경", "", "", "", "", "", "",""};
String[] headerNames2 = { "", "", "상주 "+header.getString("mp_sangju")+"개소 "+header.getString("mp_sangju_total")+"명"
,"상주 "+header.getString("mp_bsangju")+"개소 "+header.getString("mp_bsangju_total")+"명"
,"상주 "+header.getString("mp_closure")+"개소 "+header.getString("mp_closure_total")+"명"
,"상주 "+header.getString("pl_sangju")+"개소 "+header.getString("pl_sangju_total")+"명"
,"상주 "+header.getString("pl_bsangju")+"개소 "+header.getString("pl_bsangju_total")+"명"
,"상주 "+header.getString("pl_closure")+"개소 "+header.getString("pl_closure_total")+"명"
, "", "", "", "", "" };
String[] headerNames3 = { "", "", "근무방법", "명", "비고", "근무방법", "명", "비고", "터미널명", "담당자", "임차료", "공공요금", "최종수정일" };
String[] columnType = { "String", "String", "String", "int", "String", "String", "int", "String", "String", "String", "int","int", "String"};
String sheetName = "외사 분실 현황";
String excelFileName = "외사 분실 현황";
List<PartInfo> partInfoList= fipTargetSevice.selectPartInfoList(partInfo);
try {
Utils.partInfolistToExcel(partInfoList, response, headers, headerNames,headerNames2,headerNames3, columnType, sheetName, excelFileName);
} catch (IOException e) {
}
return null;
}
//메뉴권한 확인 //메뉴권한 확인
String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/equipStatus").get(0).getAccessAuth(); String accessAuth = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/equip/equipStatus").get(0).getAccessAuth();
mav.addObject("accessAuth", accessAuth); mav.addObject("accessAuth", accessAuth);
partInfo.setDownOrganCdList(loginUser.getDownOrganCdList()); partInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
partInfo.setQueryInfo(); partInfo.setQueryInfo();
mav.addObject("total", fipTargetSevice.selectWorkTypeTotal(partInfo));
mav.addObject("partInfoList", fipTargetSevice.selectPartInfoList(partInfo)); mav.addObject("partInfoList", fipTargetSevice.selectPartInfoList(partInfo));
partInfo.setContentCnt(fipTargetSevice.selectPartInfoListCnt(partInfo)); partInfo.setContentCnt(fipTargetSevice.selectPartInfoListCnt(partInfo));
partInfo.setPaginationInfo(); partInfo.setPaginationInfo();
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
mav.addObject("searchParams", partInfo); mav.addObject("searchParams", partInfo);
return mav; return mav;
} }
@ -67,7 +86,7 @@ public class FipTargetController {
@GetMapping("/partInfoSelecBox") @GetMapping("/partInfoSelecBox")
public ModelAndView equipTypeSelecBox(String ogCd) { public ModelAndView equipTypeSelecBox(String ogCd) {
ModelAndView mav = new ModelAndView("fipTarget/parkInfoSelecBox"); ModelAndView mav = new ModelAndView("fipTarget/partInfoSelecBox");
ParamMap param = new ParamMap(); ParamMap param = new ParamMap();
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(ogCd)); param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(ogCd));
mav.addObject("managerList", fipTargetSevice.selectPartInfoManagerList(param)); mav.addObject("managerList", fipTargetSevice.selectPartInfoManagerList(param));
@ -85,6 +104,19 @@ public class FipTargetController {
fipTargetSevice.savePartInfo(partInfo); fipTargetSevice.savePartInfo(partInfo);
} }
@GetMapping("/updatePartInfoPage")
public ModelAndView updatePartInfoPage(@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo) {
ModelAndView mav = new ModelAndView("fipTarget/partInfoModifyModal");
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
PartInfo partInfoView = fipTargetSevice.selectPartInfo(partInfo);
ParamMap param = new ParamMap();
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(partInfoView.getMgtOrgan()));
mav.addObject("managerList", fipTargetSevice.selectPartInfoManagerList(param));
partInfoView.setFileList(fipTargetSevice.selectPartInfoFile(partInfo));
mav.addObject("partInfo", partInfoView);
return mav;
}

View File

@ -16,6 +16,10 @@ public interface FipTargetMapper {
Integer selectPartInfoListCnt(PartInfo partInfo); Integer selectPartInfoListCnt(PartInfo partInfo);
ParamMap selectWorkTypeTotal(PartInfo partInfo);
PartInfo selectPartInfo(PartInfo partInfo);

View File

@ -73,6 +73,7 @@ public class PartInfo extends BaseModel implements Serializable{
@Column(name = "wrt_nm") @Column(name = "wrt_nm")
private String wrtNm; private String wrtNm;
@Column(name = "wrt_dt") @Column(name = "wrt_dt")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
private LocalDateTime wrtDt; private LocalDateTime wrtDt;
@Transient @Transient
@ -80,8 +81,17 @@ public class PartInfo extends BaseModel implements Serializable{
@Transient @Transient
private String piManagerName; private String piManagerName;
@Transient
private String excel;
@Transient
private List<PartInfoFile> fileList;
@Override @Override
public String toString() { public String toString() {
return "PartInfo [piSeq=" + piSeq + ", versionNo=" + versionNo + ", mgtOrgan=" + mgtOrgan + ", piUserSeq=" return "PartInfo [piSeq=" + piSeq + ", versionNo=" + versionNo + ", mgtOrgan=" + mgtOrgan + ", piUserSeq="
@ -90,10 +100,14 @@ public String toString() {
+ ", mpWorkType=" + mpWorkType + ", mpPeopleCnt=" + mpPeopleCnt + ", mpDescription=" + mpDescription + ", mpWorkType=" + mpWorkType + ", mpPeopleCnt=" + mpPeopleCnt + ", mpDescription=" + mpDescription
+ ", plWorkType=" + plWorkType + ", plPeopleCnt=" + plPeopleCnt + ", plDescription=" + plDescription + ", plWorkType=" + plWorkType + ", plPeopleCnt=" + plPeopleCnt + ", plDescription=" + plDescription
+ ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm + ", wrtOrgan=" + wrtOrgan + ", wrtPart=" + wrtPart + ", wrtUserSeq=" + wrtUserSeq + ", wrtNm=" + wrtNm
+ ", wrtDt=" + wrtDt + ", multipartFileList=" + multipartFileList + "]"; + ", wrtDt=" + wrtDt + ", multipartFileList=" + multipartFileList + ", piManagerName=" + piManagerName
+ ", fileList=" + fileList + "]";
} }
@Embeddable @Embeddable
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@ -50,6 +50,15 @@ public class PartInfoFile extends BaseModel implements Serializable{
@Override
public String toString() {
return "PartInfoFile [fileSeq=" + fileSeq + ", piSeq=" + piSeq + ", versionNo=" + versionNo + ", origNm=" + origNm
+ ", convNm=" + convNm + ", fileExtn=" + fileExtn + ", fileSize=" + fileSize + ", filePath=" + filePath
+ "]";
}
@Embeddable @Embeddable
@Data @Data
@NoArgsConstructor @NoArgsConstructor

View File

@ -3,6 +3,8 @@ package com.dbnt.faisp.fipTarget.repository;
import com.dbnt.faisp.fipTarget.model.PartInfoFile; import com.dbnt.faisp.fipTarget.model.PartInfoFile;
import java.util.List;
import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaRepository;
@ -11,6 +13,8 @@ public interface PartInfoFileRepository extends JpaRepository<PartInfoFile, Part
PartInfoFile findTopByPiSeqOrderByFileSeq(Integer piSeq); PartInfoFile findTopByPiSeqOrderByFileSeq(Integer piSeq);
List<PartInfoFile> findByPiSeqAndVersionNoOrderByFileSeqAsc(Integer piSeq, Integer versionNo);

View File

@ -3,17 +3,12 @@ package com.dbnt.faisp.fipTarget.service;
import com.dbnt.faisp.config.BaseService; import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.equip.model.Equip;
import com.dbnt.faisp.equip.model.EquipLog;
import com.dbnt.faisp.fipTarget.mapper.FipTargetMapper; import com.dbnt.faisp.fipTarget.mapper.FipTargetMapper;
import com.dbnt.faisp.fipTarget.model.PartInfo; import com.dbnt.faisp.fipTarget.model.PartInfo;
import com.dbnt.faisp.fipTarget.model.PartInfoFile; import com.dbnt.faisp.fipTarget.model.PartInfoFile;
import com.dbnt.faisp.fipTarget.repository.PartInfoFileRepository; import com.dbnt.faisp.fipTarget.repository.PartInfoFileRepository;
import com.dbnt.faisp.fipTarget.repository.PartInfoRepository; import com.dbnt.faisp.fipTarget.repository.PartInfoRepository;
import com.dbnt.faisp.publicBoard.model.PublicFile;
import com.dbnt.faisp.userInfo.model.UserInfo;
import com.dbnt.faisp.util.ParamMap; import com.dbnt.faisp.util.ParamMap;
import com.dbnt.faisp.util.Utils;
import lombok.RequiredArgsConstructor; import lombok.RequiredArgsConstructor;
@ -97,6 +92,18 @@ public class FipTargetService extends BaseService {
public Integer selectPartInfoListCnt(PartInfo partInfo) { public Integer selectPartInfoListCnt(PartInfo partInfo) {
return fipTargetMapper.selectPartInfoListCnt(partInfo); return fipTargetMapper.selectPartInfoListCnt(partInfo);
} }
public ParamMap selectWorkTypeTotal(PartInfo partInfo) {
return fipTargetMapper.selectWorkTypeTotal(partInfo);
}
public PartInfo selectPartInfo(PartInfo partInfo) {
return fipTargetMapper.selectPartInfo(partInfo);
}
public List<PartInfoFile> selectPartInfoFile(PartInfo partInfo) {
return partInfoFileRepository.findByPiSeqAndVersionNoOrderByFileSeqAsc(partInfo.getPiSeq(),partInfo.getVersionNo());
}

View File

@ -4,7 +4,7 @@ package com.dbnt.faisp.util;
import java.io.IOException; import java.io.IOException;
import java.io.PrintWriter; import java.io.PrintWriter;
import java.time.format.DateTimeFormatter;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@ -25,6 +25,8 @@ import org.apache.poi.ss.util.CellRangeAddress;
import org.apache.poi.xssf.usermodel.XSSFDataFormat; import org.apache.poi.xssf.usermodel.XSSFDataFormat;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import com.dbnt.faisp.fipTarget.model.PartInfo;
public class Utils { public class Utils {
@ -373,6 +375,135 @@ public class Utils {
} }
} }
public static void partInfolistToExcel(List<PartInfo> partInfoList, HttpServletResponse response, String[] headers,
String[] headerNames,String[] headerNames2,String[] headerNames3, String[] columnType, String sheetName, String excelFileName) throws IOException {
if(Utils.isNotEmpty(partInfoList)) {
// 메모리에 100개의 행을 유지합니다. 행의 수가 넘으면 디스크에 적습니다.
XSSFWorkbook wb = new XSSFWorkbook();
Sheet sheet = wb.createSheet(sheetName);
Row headerRow = sheet.createRow(0);
Row headerRow2 = sheet.createRow(1);
Row headerRow3 = sheet.createRow(2);
CellStyle cellStyle1 = wb.createCellStyle(); //쉼표들어간 숫자 양식
CellStyle cellStyle2 = wb.createCellStyle(); //숫자양식
CellStyle headerStyle = wb.createCellStyle(); //숫자양식
CellStyle headerStyle2 = wb.createCellStyle();
CellStyle headerStyle3 = wb.createCellStyle();
XSSFDataFormat format = wb.createDataFormat();
cellStyle1.setAlignment(HorizontalAlignment.CENTER);
cellStyle2.setDataFormat(format.getFormat("#,##0"));
cellStyle2.setAlignment(HorizontalAlignment.CENTER);
headerStyle2.setBorderTop(BorderStyle.THIN);
headerStyle2.setBorderBottom(BorderStyle.THIN);
headerStyle2.setBorderLeft(BorderStyle.THIN);
headerStyle2.setBorderRight(BorderStyle.THIN);
headerStyle2.setAlignment(HorizontalAlignment.CENTER);
headerStyle2.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headerStyle2.setFillForegroundColor((short)3);
headerStyle2.setFillForegroundColor(IndexedColors.LIME.getIndex());
headerStyle.setAlignment(HorizontalAlignment.CENTER);
headerStyle.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headerStyle.setFillForegroundColor((short)3);
headerStyle.setFillForegroundColor(IndexedColors.LIME.getIndex());
headerStyle3.setBorderTop(BorderStyle.THIN);
headerStyle3.setBorderBottom(BorderStyle.THIN);
headerStyle3.setBorderLeft(BorderStyle.THIN);
headerStyle3.setBorderRight(BorderStyle.THIN);
headerStyle3.setAlignment(HorizontalAlignment.CENTER);
headerStyle3.setFillPattern(FillPatternType.SOLID_FOREGROUND);
headerStyle3.setFillForegroundColor((short)3);
headerStyle3.setFillForegroundColor(IndexedColors.LIME.getIndex());
//로우그리기
for(int i=0; i<partInfoList.size(); i++) {
ParamMap rowData = new ParamMap();
Row row = sheet.createRow(i+3);
rowData.set("mgt_organ", partInfoList.get(i).getMgtOrgan());
rowData.set("land_police", partInfoList.get(i).getLandPolice());
rowData.set("mp_work_type", partInfoList.get(i).getMpWorkType());
rowData.set("mp_people_cnt", partInfoList.get(i).getMpPeopleCnt());
rowData.set("mp_description", partInfoList.get(i).getMpDescription());
rowData.set("pl_work_type", partInfoList.get(i).getPlWorkType());
rowData.set("pl_people_cnt", partInfoList.get(i).getPlPeopleCnt());
rowData.set("pl_description", partInfoList.get(i).getPlDescription());
rowData.set("terminal_nm", partInfoList.get(i).getTerminalNm());
rowData.set("pi_manager_name", partInfoList.get(i).getPiManagerName());
rowData.set("rent_price", partInfoList.get(i).getRentPrice());
rowData.set("utility_price", partInfoList.get(i).getUtilityPrice());
rowData.set("wrt_dt", partInfoList.get(i).getWrtDt().format(DateTimeFormatter.ofPattern("yyyy-MM-dd")));
for(int j=0; j<headers.length; j++) {
Cell cell = row.createCell(j);
if(columnType[j].equalsIgnoreCase("Int")) {
cell.setCellValue(rowData.getInt(headers[j]));
cell.setCellStyle(cellStyle2);
} else if(columnType[j].equalsIgnoreCase("String")) {
cell.setCellValue(rowData.getString(headers[j]));
cell.setCellStyle(cellStyle1);
} else {
cell.setCellValue(rowData.getString(headers[j]));
cell.setCellStyle(cellStyle1);
}
}
}
//헤더
for(int j=0; j<headerNames.length; j++) {
Cell cell = headerRow.createCell(j);
cell.setCellValue(headerNames[j]);
cell.setCellStyle(headerStyle3);
sheet.autoSizeColumn(j);
sheet.setColumnWidth(j, (sheet.getColumnWidth(j)) + 1024);
}
for(int j=0; j<headerNames2.length; j++) {
Cell cell = headerRow2.createCell(j);
cell.setCellValue(headerNames2[j]);
cell.setCellStyle(headerStyle2);
sheet.autoSizeColumn(j);
sheet.setColumnWidth(j, (sheet.getColumnWidth(j)) + 1024);
}
for(int j=0; j<headerNames3.length; j++) {
Cell cell = headerRow3.createCell(j);
cell.setCellValue(headerNames3[j]);
cell.setCellStyle(headerStyle2);
sheet.autoSizeColumn(j);
sheet.setColumnWidth(j, (sheet.getColumnWidth(j)) + 1024);
}
sheet.addMergedRegion(new CellRangeAddress(0,2,0,0));
sheet.addMergedRegion(new CellRangeAddress(0,2,1,1));
sheet.addMergedRegion(new CellRangeAddress(0,0,2,4));
sheet.addMergedRegion(new CellRangeAddress(0,0,5,7));
sheet.addMergedRegion(new CellRangeAddress(0,1,8,12));
//엑셀이름 한글깨짐방지
String outputFileName = new String(excelFileName.getBytes("KSC5601"), "8859_1");
response.setHeader("Set-Cookie", "fileDownload=true; path=/");
response.setHeader("Content-Disposition", String.format("attachment; filename=\""+outputFileName+"_"+Utils.getTimeStampString("yyyyMMdd_HHmm")+".xlsx\""));
wb.write(response.getOutputStream());
wb.close();
} else {
response.setHeader("Content-Type", "text/html; charset=UTF-8");
PrintWriter out = response.getWriter();
out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">");
out.write("<html lang=\"ko\">");
out.write("<head>");
out.write("<script type=\"text/javascript\">");
out.write("alert('데이터가 없습니다.');");
out.write("history.back(-1);");
out.write("</script>");
out.write("</head>");
out.write("</html>");
out.flush();
out.close();
}
}

View File

@ -29,6 +29,7 @@
pl_people_cnt, pl_people_cnt,
pl_description, pl_description,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name, (select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
terminal_nm,
rent_type, rent_type,
rent_price, rent_price,
utility_type, utility_type,
@ -43,8 +44,28 @@
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")"> <foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
<if test='mgtOrgan != null and mgtOrgan != ""'>
and mgt_organ = #{mgtOrgan}
</if>
<if test='landPolice != null and landPolice != ""'>
and land_police LIKE CONCAT('%', #{landPolice}, '%')
</if>
<if test='mpWorkType != null and mpWorkType != ""'>
and mp_work_type = #{mpWorkType}
</if>
<if test='plWorkType != null and plWorkType != ""'>
and pl_work_type = #{plWorkType}
</if>
<if test='terminalNm != null and terminalNm != ""'>
and terminal_nm LIKE CONCAT('%', #{terminalNm}, '%')
</if>
<if test='startDate != null and startDate != ""'>
and to_char(wrt_dt, 'YYYY-MM-DD') = #{startDate}
</if>
order by wrt_dt desc order by wrt_dt desc
limit #{rowCnt} offset #{firstIndex} <if test='rowCnt != null and rowCnt != ""'>
limit #{rowCnt} offset #{firstIndex}
</if>
</select> </select>
<select id="selectPartInfoListCnt" resultType="int" parameterType="PartInfo"> <select id="selectPartInfoListCnt" resultType="int" parameterType="PartInfo">
@ -61,6 +82,7 @@
pl_people_cnt, pl_people_cnt,
pl_description, pl_description,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name, (select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
terminal_nm,
rent_type, rent_type,
rent_price, rent_price,
utility_type, utility_type,
@ -75,8 +97,146 @@
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")"> <foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item} #{item}
</foreach> </foreach>
<if test='mgtOrgan != null and mgtOrgan != ""'>
and mgt_organ = #{mgtOrgan}
</if>
<if test='landPolice != null and landPolice != ""'>
and land_police LIKE CONCAT('%', #{landPolice}, '%')
</if>
<if test='mpWorkType != null and mpWorkType != ""'>
and mp_work_type = #{mpWorkType}
</if>
<if test='plWorkType != null and plWorkType != ""'>
and pl_work_type = #{plWorkType}
</if>
<if test='terminalNm != null and terminalNm != ""'>
and terminal_nm LIKE CONCAT('%', #{terminalNm}, '%')
</if>
<if test='startDate != null and startDate != ""'>
and to_char(wrt_dt, 'YYYY-MM-DD') = #{startDate}
</if>
order by wrt_dt desc order by wrt_dt desc
) a ) a
</select> </select>
<select id="selectWorkTypeTotal" resultType="com.dbnt.faisp.util.ParamMap" parameterType="PartInfo">
select sum(mp_sangju) as mp_sangju,
sum(mp_sangju_cnt) as mp_sangju_total,
sum(mp_bsangju) as mp_bsangju,
sum(mp_bsangju_cnt) as mp_bsangju_total,
sum(mp_closure) as mp_closure,
sum(mp_closure_cnt) as mp_closure_total,
sum(pl_sangju) as pl_sangju,
sum(pl_sangju_cnt) as pl_sangju_total,
sum(pl_bsangju) as pl_bsangju,
sum(pl_bsangju_cnt) as pl_bsangju_total,
sum(pl_closure) as pl_closure,
sum(pl_closure_cnt) as pl_closure_total
from(
select case
when mp_work_type = 'PIS001' then coalesce(mp_people_cnt,0)
else 0
end as mp_sangju_cnt,
case
when mp_work_type = 'PIS002' then coalesce(mp_people_cnt,0)
else 0
end as mp_bsangju_cnt,
case
when mp_work_type = 'PIS003' then coalesce(mp_people_cnt,0)
else 0
end as mp_closure_cnt,
case
when pl_work_type = 'PIS001' then coalesce(pl_people_cnt,0)
else 0
end as pl_sangju_cnt,
case
when pl_work_type = 'PIS002' then coalesce(pl_people_cnt,0)
else 0
end as pl_bsangju_cnt,
case
when pl_work_type = 'PIS003' then coalesce(pl_people_cnt,0)
else 0
end as pl_closure_cnt,
case
when mp_work_type = 'PIS001' then 1
else 0
end as mp_sangju,
case
when mp_work_type = 'PIS002' then 1
else 0
end as mp_bsangju,
case
when mp_work_type = 'PIS003' then 1
else 0
end as mp_closure,
case
when pl_work_type = 'PIS001' then 1
else 0
end as pl_sangju,
case
when pl_work_type = 'PIS002' then 1
else 0
end as pl_bsangju,
case
when pl_work_type = 'PIS003' then 1
else 0
end as pl_closure
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and wrt_organ in
<foreach collection="downOrganCdList" item="item" index="index" separator="," open="(" close=")">
#{item}
</foreach>
<if test='mgtOrgan != null and mgtOrgan != ""'>
and mgt_organ = #{mgtOrgan}
</if>
<if test='landPolice != null and landPolice != ""'>
and land_police LIKE CONCAT('%', #{landPolice}, '%')
</if>
<if test='mpWorkType != null and mpWorkType != ""'>
and mp_work_type = #{mpWorkType}
</if>
<if test='plWorkType != null and plWorkType != ""'>
and pl_work_type = #{plWorkType}
</if>
<if test='terminalNm != null and terminalNm != ""'>
and terminal_nm LIKE CONCAT('%', #{terminalNm}, '%')
</if>
<if test='startDate != null and startDate != ""'>
and to_char(wrt_dt, 'YYYY-MM-DD') = #{startDate}
</if>
group by pi.pi_seq, version_no
) a
</select>
<select id="selectPartInfo" resultType="PartInfo" parameterType="PartInfo">
select pi.pi_seq,
version_no,
mgt_organ,
land_police,
mp_work_type,
mp_people_cnt,
mp_description,
pl_work_type,
pl_people_cnt,
pl_description,
pi_user_seq,
(select user_nm from user_info where user_seq = pi_user_seq ) as pi_manager_name,
terminal_nm,
rent_type,
rent_price,
utility_type,
utility_price,
wrt_dt
from part_info pi,
(select pi_seq,max(version_no) as lastVer
from part_info group by pi_seq) b
where pi.pi_seq = b.pi_seq
and pi.version_no = b.lastVer
and pi.pi_seq = #{piSeq}
</select>
</mapper> </mapper>

View File

@ -60,6 +60,20 @@ $(document).on('change', '#mgtOrgan', function (){
}); });
$(document).on('click', '#savePartInfo', function (){ $(document).on('click', '#savePartInfo', function (){
if($("#rentType").val() == 'Y'){
if($("#rentPrice").val() == ''){
alert("임차료를 입력해주세요.");
$('#rentPrice').focus();
return false;
}
}
if($("#utilityType").val() == 'Y'){
if($("#utilityPrice").val() == ''){
alert("공공요금을 입력해주세요.");
$('#utilityPrice').focus();
return false;
}
}
if(confirm("저장하시겠습니까?")){ if(confirm("저장하시겠습니까?")){
contentFade("in"); contentFade("in");
const formData = new FormData($("#partInfoSave")[0]); const formData = new FormData($("#partInfoSave")[0]);
@ -86,5 +100,73 @@ $(document).on('click', '#savePartInfo', function (){
} }
}) })
$(document).on('click', '.partInfoTr', function (){
const piSeq = (Number($(this).find(".piSeq").val()));
const versionNo = (Number($(this).find(".verNo").val()));
const url = '/target/updatePartInfoPage';
showModal(piSeq,versionNo,url);
})
function showModal(piSeq,versionNo,url){
$.ajax({
url: url,
data: {
piSeq: piSeq,
versionNo: versionNo
},
type: 'GET',
dataType:"html",
success: function(html){
$("#partInfoEditModalEditModalContent").empty().append(html);
$("#partInfoEditModal").modal('show');
if($("#mRentType").val() != 'Y'){
$("#mRentPrice").hide();
}
if($("#mUtilityType").val() != 'Y'){
$("#mUtilityPrice").hide();
}
setUploadDiv();
},
error:function(){
}
});
}
$(function(){
$("#startDate").datepicker({
format: "yyyy-mm-dd",
language: "ko"
});
})
$(document).on('click', '#goExcel', function (){
if(confirm("엑셀로 다운로드 하시겠습니까?")){
$('input[name=excel]').val('Y');
$('#searchFm').submit();
$('input[name=excel]').val('');
}else{
false;
}
})
$(document).on('change', '#mRentType', function (){
if($("#mRentType").val() == 'Y'){
$("#mRentPrice").show();
}else{
$("#mRentPrice").hide();
$("#mRentPrice").val('');
}
});
$(document).on('change', '#mUtilityType', function (){
if($("#mUtilityType").val() == 'Y'){
$("#mUtilityPrice").show();
}else{
$("#mUtilityPrice").hide();
$("#mUtilityPrice").val('');
}
});

View File

@ -13,7 +13,7 @@
<div class="row mx-0"> <div class="row mx-0">
<div class="col-12 card text-center"> <div class="col-12 card text-center">
<div class="card-body"> <div class="card-body">
<form id="searchFm" method="get" th:action="@{/translator/info}"> <form id="searchFm" method="get" th:action="@{/target/partInfoList}">
<input type="hidden" name="excel"> <input type="hidden" name="excel">
<input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}"> <input type="hidden" name="pageIndex" id="pageIndex" th:value="${searchParams.pageIndex}">
<div class="row justify-content-between pe-3 py-1"> <div class="row justify-content-between pe-3 py-1">
@ -26,10 +26,57 @@
</div> </div>
<div class="col-auto"> <div class="col-auto">
<div class="row justify-content-end"> <div class="row justify-content-end">
<div class="col-auto">
<select class="form-select form-select-sm" name="mgtOrgan">
<option value="">-해경서 선택-</option>
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.mgtOrgan}"></option>
</th:block>
</th:block>
</select>
</div>
<div class="col-auto">
<input type="text" class="form-control form-control-sm" name="landPolice" th:value="${searchParams.landPolice}" placeholder="육경서">
</div>
<div class="col-auto">
<select class="form-select form-select-sm" name="mpWorkType">
<option value="">해경서 근무방법</option>
<th:block th:each="commonCode:${session.commonCode.get('PIS')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.mpWorkType}"></option>
</th:block>
</select>
</div>
<div class="col-auto">
<select class="form-select form-select-sm" name="plWorkType">
<option value="">육경서 근무방법</option>
<th:block th:each="commonCode:${session.commonCode.get('PIS')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq searchParams.plWorkType}"></option>
</th:block>
</select>
</div>
<div class="col-auto">
<input type="text" class="form-control form-control-sm" name="terminalNm" th:value="${searchParams.terminalNm}" placeholder="터미널명">
</div>
<input type="submit" class="btn btn-sm btn-primary col-auto" id="searchBtn" value="검색"> <input type="submit" class="btn btn-sm btn-primary col-auto" id="searchBtn" value="검색">
</div> </div>
</div> </div>
</div> </div>
<div class="row justify-content-between py-1">
<div class="col-auto">
<div class="row justify-content-end">
<div class="col-auto">
</div>
<div class="col-auto">
</div>
<div class="col-auto">
<input type="text" class="form-control form-control-sm" id="startDate" name="startDate" placeholder="최종수정일" autocomplete="off" readonly th:value="${searchParams.startDate}">
</div>
</div>
</div>
</div>
</form> </form>
<div class="row justify-content-start"> <div class="row justify-content-start">
<div class="col-12"> <div class="col-12">
@ -41,15 +88,23 @@
<table class="table table-striped"> <table class="table table-striped">
<thead> <thead>
<tr> <tr>
<th rowspan="2">해경서</th> <th rowspan="3">해경서</th>
<th rowspan="2">육경서</th> <th rowspan="3">육경서</th>
<th colspan="3">해경</th> <th colspan="3">해경</th>
<th colspan="3">육경</th> <th colspan="3">육경</th>
<th rowspan="2">터미널명</th> <th rowspan="3">터미널명</th>
<th rowspan="2">담당자</th> <th rowspan="3">담당자</th>
<th rowspan="2">임차료</th> <th rowspan="3">임차료</th>
<th rowspan="2">공공요금</th> <th rowspan="3">공공요금</th>
<th rowspan="2">최종수정일</th> <th rowspan="3">최종수정일</th>
</tr>
<tr>
<th th:text="|상주 ${total.mp_sangju}개소 ${total.mp_sangju_total}명|"></th>
<th th:text="|비상주 ${total.mp_bsangju}개소 ${total.mp_bsangju_total}명|"></th>
<th th:text="|폐쇄 ${total.mp_closure}개소 ${total.mp_closure_total}명|"></th>
<th th:text="|상주 ${total.pl_sangju}개소 ${total.pl_sangju_total}명|"></th>
<th th:text="|비상주 ${total.pl_bsangju}개소 ${total.pl_bsangju_total}명|"></th>
<th th:text="|폐쇄 ${total.pl_closure}개소 ${total.pl_closure_total}명|"></th>
</tr> </tr>
<tr> <tr>
<th>근무방법</th> <th>근무방법</th>
@ -60,7 +115,11 @@
<th>비고</th> <th>비고</th>
</thead> </thead>
<tbody> <tbody>
<tr th:each="pi:${partInfoList}"> <tr class="partInfoTr" th:each="pi:${partInfoList}">
<th:block>
<input type="hidden" class="piSeq" th:value="${pi.piSeq}">
<input type="hidden" class="verNo" th:value="${pi.versionNo}">
</th:block>
<td th:text="${pi.mgtOrgan}"></td> <td th:text="${pi.mgtOrgan}"></td>
<td th:text="${pi.landPolice}"></td> <td th:text="${pi.landPolice}"></td>
<td th:text="${pi.mpWorkType}"></td> <td th:text="${pi.mpWorkType}"></td>
@ -69,12 +128,14 @@
<td th:text="${pi.plWorkType}"></td> <td th:text="${pi.plWorkType}"></td>
<td th:text="${pi.plPeopleCnt}"></td> <td th:text="${pi.plPeopleCnt}"></td>
<td th:text="${pi.plDescription}"></td> <td th:text="${pi.plDescription}"></td>
<td th:text="${pi.piManagerName}"></td> <td th:text="${pi.terminalNm}"></td>
<td th:text="${pi.rentType}"></td> <td th:text="${pi.piManagerName}"></td>
<td th:text="${pi.rentPrice}" th:if="${pi.rentType eq 'Y'}"></td> <td th:text="${pi.rentPrice}" th:if="${pi.rentType eq 'Y'}"></td>
<td th:text="${pi.rentType}" th:if="${pi.rentType eq 'N'}"></td> <td th:text="${pi.rentType}" th:if="${pi.rentType eq 'N'}"></td>
<td th:if="${#strings.isEmpty(pi.rentType)}"></td>
<td th:text="${pi.utilityPrice}" th:if="${pi.utilityType eq 'Y'}"></td> <td th:text="${pi.utilityPrice}" th:if="${pi.utilityType eq 'Y'}"></td>
<td th:text="${pi.utilityType}" th:if="${pi.utilityType eq 'N'}"></td> <td th:text="${pi.utilityType}" th:if="${pi.utilityType eq 'N'}"></td>
<td th:if="${#strings.isEmpty(pi.utilityType)}"></td>
<td th:text="${#temporals.format(pi.wrtDt, 'yyyy-MM-dd')}"></td> <td th:text="${#temporals.format(pi.wrtDt, 'yyyy-MM-dd')}"></td>
</tr> </tr>
</tbody> </tbody>
@ -135,5 +196,6 @@
</div> </div>
</div> </div>
</html> </html>

View File

@ -0,0 +1,139 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
<ul class="nav nav-tabs" id="userTab" role="tablist">
<li class="nav-item" role="presentation">
<button class="nav-link active" id="accessTab" data-bs-toggle="tab" data-bs-target="#accessTabPanel" type="button" role="tab" aria-controls="accessTabPanel" aria-selected="true">현황상세</button>
</li>
<li class="nav-item" role="presentation">
<button class="nav-link" id="approvalTab" data-bs-toggle="tab" data-bs-target="#approvalTabPanel" type="button" role="tab" aria-controls="approvalTabPanel" aria-selected="false">수정이력</button>
</li>
</ul>
<form id="partInfoSave" method="post">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<div class="mb-2 row">
<label for="ogCd" class="col-sm-2 col-form-label text-center">해경서</label>
<div class="col-sm-3">
<select class="form-select form-select-sm" id="mgtOrgan" name="mgtOrgan">
<option value="">선택</option>
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq partInfo.mgtOrgan}"></option>
</th:block>
</th:block>
</select>
</div>
<label for="ofcCd" class="col-sm-2 col-form-label text-center">육경서</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="landPolice" name="landPolice" th:value="${partInfo.landPolice}" placeholder="직접입력">
</div>
</div>
<div class="mb-2 row">
<label for="ogCd" class="col-sm-2 col-form-label text-center">담당자</label>
<div class="col-sm-3">
<select class="form-select form-select-sm" id="piUserSeq" name="piUserSeq">
<option value="">-선택-</option>
<th:block th:each="info:${managerList}">
<option th:value="${info.user_seq}" th:text="${info.user_name}" th:selected="${info.user_seq eq partInfo.piUserSeq}"></option>
</th:block>
</select>
</div>
</div>
<br><br>
<h6>해경</h6>
<div class="mb-3 row">
<label for="ogCd" class="col-sm-2 col-form-label text-center">근무방법</label>
<div class="col-sm-2">
<select class="form-select form-select-sm" name="mpWorkType">
<option value="">선택</option>
<th:block th:each="commonCode:${session.commonCode.get('PIS')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq partInfo.mpWorkType}"></option>
</th:block>
</select>
</div>
<label for="ofcCd" class="col-sm-2 col-form-label text-center">인원수</label>
<div class="col-sm-2">
<input type="number" class="form-control" id="mpPeopleCnt" name="mpPeopleCnt" th:value="${partInfo.mpPeopleCnt}">
</div>
<label for="ofcCd" class="col-sm-1 col-form-label text-center">비고</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="mpDescription" name="mpDescription" th:value="${partInfo.mpDescription}">
</div>
</div>
<h6>육경</h6>
<div class="mb-3 row">
<label for="ogCd" class="col-sm-2 col-form-label text-center">근무방법</label>
<div class="col-sm-2">
<select class="form-select form-select-sm" name="plWorkType">
<option value="">선택</option>
<th:block th:each="commonCode:${session.commonCode.get('PIS')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}" th:selected="${commonCode.itemCd eq partInfo.plWorkType}"></option>
</th:block>
</select>
</div>
<label for="ofcCd" class="col-sm-2 col-form-label text-center">인원수</label>
<div class="col-sm-2">
<input type="number" class="form-control" id="plPeopleCnt" name="plPeopleCnt" th:value="${partInfo.plPeopleCnt}">
</div>
<label for="ofcCd" class="col-sm-1 col-form-label text-center">비고</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="plDescription" name="plDescription" th:value="${partInfo.plDescription}">
</div>
</div>
<br><br>
<div class="mb-3 row">
<label for="ogCd" class="col-sm-2 col-form-label text-center">터미널명</label>
<div class="col-sm-2">
<input type="text" class="form-control" id="terminalNm" name="terminalNm" th:value="${partInfo.terminalNm}" placeholder="직접입력">
</div>
</div>
<div class="mb-3 row">
<label for="ofcCd" class="col-sm-2 col-form-label text-center">임차료</label>
<div class="col-sm-2">
<select class="form-select form-select-sm" id="mRentType" name="rentType">
<option value="">선택</option>
<option value="N" th:selected="${'N' eq partInfo.rentType}">무상</option>
<option value="Y" th:selected="${'Y' eq partInfo.rentType}">유상</option>
</select>
</div>
<div class="col-sm-3">
<input type="number" class="form-control" id="mRentPrice" name="rentPrice" th:value="${partInfo.rentPrice}" placeholder="직접입력">
</div>
</div>
<div class="mb-3 row">
<label for="ofcCd" class="col-sm-2 col-form-label text-center">공공요금</label>
<div class="col-sm-2">
<select class="form-select form-select-sm" id="mUtilityType" name="utilityType">
<option value="">선택</option>
<option value="N" th:selected="${'N' eq partInfo.utilityType}">무상</option>
<option value="Y" th:selected="${'Y' eq partInfo.utilityType}">유상</option>
</select>
</div>
<div class="col-sm-3">
<input type="number" class="form-control" id="mUtilityPrice" name="utilityPrice" th:value="${partInfo.utilityPrice}" placeholder="직접입력">
</div>
</div>
<div class="row mb-3">
<label for="fileInputer" class="col-sm-2 col-form-label text-center">업로드 자료</label>
<div class="col-sm-10" style="min-height: 70px;">
<div class="w-100 h-100 border border-info rounded text-center" id="uploadDiv">
<br>파일을 업로드 해주세요.
</div>
</div>
<input type="file" class="d-none" id="fileInputer" multiple>
</div>
</form>
</div>
<div class="modal-footer justify-content-between">
<div class="col-auto">
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">닫기</button>
<button type="button" class="btn btn-primary" id="savePartInfo">수정</button>
</div>
</div>
</html>