강석 최 2022-10-05 10:05:38 +09:00
commit 00c2f04f63
12 changed files with 662 additions and 58 deletions

View File

@ -5,6 +5,8 @@ import com.dbnt.faisp.authMgt.service.AuthMgtService;
import com.dbnt.faisp.fipTarget.model.PartInfo;
import com.dbnt.faisp.fipTarget.service.FipTargetService;
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.util.ParamMap;
import com.dbnt.faisp.util.Utils;
@ -31,29 +33,35 @@ public class FipTargetController {
private final OrganConfigService organConfigService;
private final AuthMgtService authMgtService;
private final FipTargetService fipTargetSevice;
private final FipTargetService fipTargetService;
// 외사분실운영현황 시작
@GetMapping("/partInfoList")
public ModelAndView partInfoList(@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo, HttpServletResponse response) {
ModelAndView mav = new ModelAndView("fipTarget/partInfoList");
partInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
//엑셀다운
if(partInfo.getExcel() != null && partInfo.getExcel().equals("Y")){
ParamMap header = fipTargetSevice.selectWorkTypeTotal(partInfo);
ParamMap header = fipTargetService.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[] headerNames2 = null;
if(header != null) {
headerNames2 = new String[] { "", "", "상주 "+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")+"명"
, "", "", "", "", "" };
}else {
headerNames2 = new String[] { "", "", "상주 0개소 0명","비상주 0개소 0명","폐쇄 0개소 0명","상주 0개소 0명","비상주 0개소 0명","폐쇄 0개소 0명", "", "", "", "", "" };
}
String[] headerNames3 = { "", "", "근무방법", "명", "비고", "근무방법", "명", "비고", "터미널명", "담당자", "임차료", "공공요금", "최종수정일" };
String[] columnType = { "String", "String", "String", "int", "String", "String", "int", "String", "String", "String", "int","int", "String"};
String[] columnType = { "String", "String", "String", "int", "String", "String", "int", "String", "String", "String", "String","String", "String"};
String sheetName = "외사 분실 현황";
String excelFileName = "외사 분실 현황";
List<PartInfo> partInfoList= fipTargetSevice.selectPartInfoList(partInfo);
List<PartInfo> partInfoList= fipTargetService.selectPartInfoList(partInfo);
try {
Utils.partInfolistToExcel(partInfoList, response, headers, headerNames,headerNames2,headerNames3, columnType, sheetName, excelFileName);
@ -67,9 +75,9 @@ public class FipTargetController {
mav.addObject("accessAuth", accessAuth);
partInfo.setDownOrganCdList(loginUser.getDownOrganCdList());
partInfo.setQueryInfo();
mav.addObject("total", fipTargetSevice.selectWorkTypeTotal(partInfo));
mav.addObject("partInfoList", fipTargetSevice.selectPartInfoList(partInfo));
partInfo.setContentCnt(fipTargetSevice.selectPartInfoListCnt(partInfo));
mav.addObject("total", fipTargetService.selectWorkTypeTotal(partInfo));
mav.addObject("partInfoList", fipTargetService.selectPartInfoList(partInfo));
partInfo.setContentCnt(fipTargetService.selectPartInfoListCnt(partInfo));
partInfo.setPaginationInfo();
mav.addObject("mgtOrganList", loginUser.getDownOrganCdList());
mav.addObject("searchParams", partInfo);
@ -89,7 +97,7 @@ public class FipTargetController {
ModelAndView mav = new ModelAndView("fipTarget/partInfoSelecBox");
ParamMap param = new ParamMap();
param.put("downOrganCdList", organConfigService.selectDownOrganListWhereUserOgCd(ogCd));
mav.addObject("managerList", fipTargetSevice.selectPartInfoManagerList(param));
mav.addObject("managerList", fipTargetService.selectPartInfoManagerList(param));
return mav;
}
@ -101,22 +109,58 @@ public class FipTargetController {
partInfo.setWrtUserSeq(loginUser.getUserSeq());
partInfo.setWrtOrgan(loginUser.getOgCd());
partInfo.setWrtDt(LocalDateTime.now());
fipTargetSevice.savePartInfo(partInfo);
fipTargetService.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);
PartInfo partInfoView = fipTargetService.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("managerList", fipTargetService.selectPartInfoManagerList(param));
partInfoView.setFileList(fipTargetService.selectPartInfoFile(partInfo));
mav.addObject("partInfo", partInfoView);
return mav;
}
@PostMapping("/updatePartInfo")
public int updatePartInfo (@AuthenticationPrincipal UserInfo loginUser,PartInfo partInfo,
MultipartHttpServletRequest request,
@RequestParam(value = "fileSeq", required = false) List < Integer > deleteFileSeq){
partInfo.setMultipartFileList(request.getMultiFileMap().get("uploadFiles"));
partInfo.setWrtUserSeq(loginUser.getUserSeq());
partInfo.setWrtNm(loginUser.getUserId());
partInfo.setWrtPart(loginUser.getOfcCd());
partInfo.setWrtDt(LocalDateTime.now());
fipTargetService.updatePartInfo(partInfo,deleteFileSeq);
return partInfo.getPiSeq();
}
@GetMapping("/PartInfoHistoryPage")
public ModelAndView PartInfoHistoryPage(PartInfo partInfo) {
ModelAndView mav = new ModelAndView("fipTarget/partInfoHistory");
mav.addObject("partInfoList", fipTargetService.selectPartInfoSeq(partInfo));
return mav;
}
@GetMapping("/partInfoHistoryView")
@ResponseBody
public PartInfo partInfoHistoryView(PartInfo partInfo){
PartInfo partInfoHistory = fipTargetService.selectPartInfoHistoryView(partInfo);
partInfoHistory.setFileList(fipTargetService.selectPartInfoFileHistoryView(partInfo));
return partInfoHistory;
}
@PostMapping("/deletePartInfo")
@ResponseBody
public void deletePartInfo(@RequestBody PartInfo partInfo) {
fipTargetService.deletePartInfo(partInfo);
}
//외사분실 운영현황 끝

View File

@ -1,6 +1,7 @@
package com.dbnt.faisp.fipTarget.mapper;
import com.dbnt.faisp.fipTarget.model.PartInfo;
import com.dbnt.faisp.fipTarget.model.PartInfoFile;
import com.dbnt.faisp.util.ParamMap;
import org.apache.ibatis.annotations.Mapper;
@ -20,6 +21,14 @@ public interface FipTargetMapper {
PartInfo selectPartInfo(PartInfo partInfo);
List<PartInfoFile> selectPartInfoFile(PartInfo partInfo);
List<PartInfo> selectPartInfoSeq(PartInfo partInfo);
PartInfo selectPartInfoHistoryView(PartInfo partInfo);
List<PartInfoFile> selectPartInfoFileHistoryView(PartInfo partInfo);

View File

@ -15,6 +15,12 @@ public interface PartInfoFileRepository extends JpaRepository<PartInfoFile, Part
List<PartInfoFile> findByPiSeqAndVersionNoOrderByFileSeqAsc(Integer piSeq, Integer versionNo);
PartInfoFile findTopByPiSeqOrderByFileSeqDesc(Integer piSeq);
PartInfoFile findTopByPiSeqAndVersionNoOrderByFileSeqDesc(Integer piSeq, Integer versionNo);
void deleteByPiSeq(Integer piSeq);

View File

@ -12,6 +12,8 @@ public interface PartInfoRepository extends JpaRepository<PartInfo, PartInfo.Par
PartInfo findFirstByOrderByPiSeqDesc();
void deleteByPiSeq(Integer piSeq);

View File

@ -3,11 +3,16 @@ package com.dbnt.faisp.fipTarget.service;
import com.dbnt.faisp.config.BaseService;
import com.dbnt.faisp.equip.model.Equip;
import com.dbnt.faisp.equip.model.Equip.EquipId;
import com.dbnt.faisp.fipTarget.mapper.FipTargetMapper;
import com.dbnt.faisp.fipTarget.model.PartInfo;
import com.dbnt.faisp.fipTarget.model.PartInfo.PartInfoId;
import com.dbnt.faisp.fipTarget.model.PartInfoFile;
import com.dbnt.faisp.fipTarget.model.PartInfoFile.PartInfoFileId;
import com.dbnt.faisp.fipTarget.repository.PartInfoFileRepository;
import com.dbnt.faisp.fipTarget.repository.PartInfoRepository;
import com.dbnt.faisp.publicBoard.model.PublicFile;
import com.dbnt.faisp.util.ParamMap;
import lombok.RequiredArgsConstructor;
@ -53,15 +58,17 @@ public class FipTargetService extends BaseService {
}
private void saveUploadFiles(Integer piSeq,Integer versionNo, List<MultipartFile> multipartFileList) {
PartInfoFile lastFileInfo = partInfoFileRepository.findTopByPiSeqOrderByFileSeq(piSeq);
PartInfoFile lastFileInfo = partInfoFileRepository.findTopByPiSeqAndVersionNoOrderByFileSeqDesc(piSeq,versionNo);
int fileSeq = lastFileInfo==null?1:(lastFileInfo.getFileSeq()+1);
if(multipartFileList == null || multipartFileList.isEmpty()) {
PartInfoFile fileInfo = new PartInfoFile();
fileInfo.setFileSeq(fileSeq);
fileInfo.setPiSeq(piSeq);
fileInfo.setVersionNo(versionNo);
partInfoFileRepository.save(fileInfo);
if(lastFileInfo == null || lastFileInfo.getOrigNm() == null ) {
PartInfoFile fileInfo = new PartInfoFile();
fileInfo.setFileSeq(fileSeq);
fileInfo.setPiSeq(piSeq);
fileInfo.setVersionNo(versionNo);
partInfoFileRepository.save(fileInfo);
}
} else {
for(MultipartFile file : multipartFileList){
String saveName = UUID.randomUUID().toString();
@ -102,7 +109,94 @@ public class FipTargetService extends BaseService {
}
public List<PartInfoFile> selectPartInfoFile(PartInfo partInfo) {
return partInfoFileRepository.findByPiSeqAndVersionNoOrderByFileSeqAsc(partInfo.getPiSeq(),partInfo.getVersionNo());
return fipTargetMapper.selectPartInfoFile(partInfo);
}
@Transactional
public void updatePartInfo(PartInfo partInfo, List<Integer> deleteFileSeq) {
PartInfo dbPart = partInfoRepository.findById(new PartInfoId(partInfo.getPiSeq(), partInfo.getVersionNo())).orElse(null);
PartInfo partTmp = new PartInfo();
partTmp.setPiSeq(dbPart.getPiSeq());
partTmp.setVersionNo(dbPart.getVersionNo()+1);
partTmp.setMgtOrgan(partInfo.getMgtOrgan());
partTmp.setLandPolice(partInfo.getLandPolice());
partTmp.setPiUserSeq(partInfo.getPiUserSeq());
partTmp.setRentType(partInfo.getRentType());
partTmp.setRentPrice(partInfo.getRentPrice());
partTmp.setUtilityType(partInfo.getUtilityType());
partTmp.setUtilityPrice(partInfo.getUtilityPrice());
partTmp.setTerminalNm(partInfo.getTerminalNm());
partTmp.setMpWorkType(partInfo.getMpWorkType());
partTmp.setMpPeopleCnt(partInfo.getMpPeopleCnt());
partTmp.setMpDescription(partInfo.getMpDescription());
partTmp.setPlWorkType(partInfo.getPlWorkType());
partTmp.setPlPeopleCnt(partInfo.getPlPeopleCnt());
partTmp.setPlDescription(partInfo.getPlDescription());
partTmp.setWrtUserSeq(partInfo.getWrtUserSeq());
partTmp.setWrtNm(partInfo.getWrtNm());
partTmp.setWrtPart(partInfo.getWrtPart());
//첫번째 작성자 관서그대로입력
partTmp.setWrtOrgan(dbPart.getWrtOrgan());
partTmp.setWrtDt(partInfo.getWrtDt());
partInfoRepository.save(partTmp);
//업데이트하는 버전 파일조회
List<PartInfoFile> fileList = partInfoFileRepository.findByPiSeqAndVersionNoOrderByFileSeqAsc(partInfo.getPiSeq(),partInfo.getVersionNo());
if(fileList.get(0).getOrigNm() != null) {
for(PartInfoFile fileInfo : fileList){
PartInfoFile tmpFile = new PartInfoFile();
tmpFile.setFileSeq(fileInfo.getFileSeq());
tmpFile.setPiSeq(fileInfo.getPiSeq());
tmpFile.setVersionNo(partTmp.getVersionNo());
tmpFile.setOrigNm(fileInfo.getOrigNm());
tmpFile.setConvNm(fileInfo.getConvNm());
tmpFile.setFileExtn(fileInfo.getFileExtn());
tmpFile.setFileSize(fileInfo.getFileSize());
tmpFile.setFilePath(fileInfo.getFilePath());
partInfoFileRepository.save(tmpFile);
}
}
//수정시 삭제한 파일삭제
if(deleteFileSeq!=null && deleteFileSeq.size()>0){
deletePartInfoFile(partTmp.getPiSeq(),partTmp.getVersionNo(), deleteFileSeq);
}
//파일업로드
saveUploadFiles(partTmp.getPiSeq(),partTmp.getVersionNo(), partInfo.getMultipartFileList());
}
private void deletePartInfoFile(Integer piSeq,Integer versionNo, List<Integer> deleteFileSeq) {
List<PartInfoFile> partInfoFileList = partInfoFileRepository.findByPiSeqAndVersionNoOrderByFileSeqAsc(piSeq,versionNo);
for(PartInfoFile file: partInfoFileList){
if(deleteFileSeq.contains(file.getFileSeq())){
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
partInfoFileRepository.deleteById(new PartInfoFileId(file.getFileSeq(),piSeq,versionNo));
}
}
}
public List<PartInfo> selectPartInfoSeq(PartInfo partInfo) {
return fipTargetMapper.selectPartInfoSeq(partInfo);
}
public PartInfo selectPartInfoHistoryView(PartInfo partInfo) {
return fipTargetMapper.selectPartInfoHistoryView(partInfo);
}
public List<PartInfoFile> selectPartInfoFileHistoryView(PartInfo partInfo) {
return fipTargetMapper.selectPartInfoFileHistoryView(partInfo);
}
@Transactional
public void deletePartInfo(PartInfo partInfo) {
//파일삭제
List<PartInfoFile> partInfoFileList= selectPartInfoFile(partInfo);
for(PartInfoFile file: partInfoFileList){
if(file.getOrigNm() != null){
deleteStoredFile(new File(file.getFilePath(), file.getConvNm()));
}
}
partInfoFileRepository.deleteByPiSeq(partInfo.getPiSeq());
partInfoRepository.deleteByPiSeq(partInfo.getPiSeq());
}

View File

@ -430,8 +430,16 @@ public class Utils {
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());
if(partInfoList.get(i).getRentType().equals("Y")) {
rowData.set("rent_price", partInfoList.get(i).getRentPrice().toString()+"만");
}else {
rowData.set("rent_price", "무상");
}
if(partInfoList.get(i).getUtilityType().equals("Y")) {
rowData.set("utility_price", partInfoList.get(i).getUtilityPrice().toString()+"만");
}else {
rowData.set("utility_price", "무상");
}
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);

View File

@ -63,7 +63,7 @@
and to_char(wrt_dt, 'YYYY-MM-DD') = #{startDate}
</if>
order by wrt_dt desc
<if test='rowCnt != null and rowCnt != ""'>
<if test='excel != "Y"'>
limit #{rowCnt} offset #{firstIndex}
</if>
</select>
@ -238,5 +238,78 @@
and pi.version_no = b.lastVer
and pi.pi_seq = #{piSeq}
</select>
<select id="selectPartInfoFile" resultType="PartInfoFile" parameterType="PartInfo">
select file_seq,
pif.pi_seq,
version_no,
orig_nm,
conv_nm,
file_extn,
file_size,
file_path
from part_info_file pif,
(select pi_seq,max(version_no) as lastVer
from part_info_file group by pi_seq) b
where pif.pi_seq = b.pi_seq
and pif.version_no = b.lastVer
and pif.pi_seq = #{piSeq}
</select>
<select id="selectPartInfoSeq" resultType="PartInfo" parameterType="PartInfo">
select pi_seq,
version_no,
wrt_nm,
wrt_dt
from part_info
where pi_seq = #{piSeq}
order by version_no desc
</select>
<select id="selectPartInfoHistoryView" resultType="PartInfo" parameterType="PartInfo">
select pi_seq,
version_no,
(select item_value from code_mgt where item_cd = mgt_organ) as mgt_organ,
land_police,
(select item_value from code_mgt where item_cd = mp_work_type) as mp_work_type,
mp_people_cnt,
mp_description,
(select item_value from code_mgt where item_cd = pl_work_type) as 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,
case
when rent_type = 'Y' then '유상'
when rent_type = 'N' then '무상'
else null
end as rent_type,
rent_price,
case
when utility_type = 'Y' then '유상'
when utility_type = 'N' then '무상'
else null
end as utility_type,
utility_price,
wrt_dt
from part_info
where pi_seq = #{piSeq}
and version_no = #{versionNo}
</select>
<select id="selectPartInfoFileHistoryView" resultType="PartInfoFile" parameterType="PartInfo">
select file_seq,
pi_seq,
version_no,
orig_nm,
conv_nm,
file_extn,
file_size,
file_path
from part_info_file
where pi_seq = #{piSeq}
and version_no = #{versionNo}
</select>
</mapper>

View File

@ -59,7 +59,54 @@ $(document).on('change', '#mgtOrgan', function (){
}
});
$(document).on('change', '#mMgtOrgan', function (){
const ogCd = $(this).val();
if(ogCd != ''){
$.ajax({
url: '/target/partInfoSelecBox',
data: {
ogCd,
},
type: 'GET',
dataType:"html",
success: function(html){
$("#mPiUserSeq").empty().append(html);
$("#mPiUserSeq").prop('disabled',false);
},
error:function(){
}
});
}else{
$("#mPiUserSeq").prop('disabled',true);
$("#mPiUserSeq").val('');
}
});
$(document).on('click', '#savePartInfo', function (){
if($('#mgtOrgan').val() == ''){
alert('해경서를 선택해주세요');
$('#mgtOrgan').focus();
return false;
}
if($('#piUserSeq').val() == ''){
alert('담당자를 선택해주세요');
$('#piUserSeq').focus();
return false;
}
if($('#mpWorkType').val() != ''){
if($('#mpPeopleCnt').val() == ''){
alert('해경 인원수를 입력해주세요');
$('#mpPeopleCnt').focus();
return false;
}
}
if($('#plWorkType').val() != ''){
if($('#plPeopleCnt').val() == ''){
alert('육경 인원수를 입력해주세요');
$('#plPeopleCnt').focus();
return false;
}
}
if($("#rentType").val() == 'Y'){
if($("#rentPrice").val() == ''){
alert("임차료를 입력해주세요.");
@ -102,17 +149,14 @@ $(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);
showModal(piSeq);
})
function showModal(piSeq,versionNo,url){
function showModal(piSeq){
$.ajax({
url: url,
url: '/target/updatePartInfoPage',
data: {
piSeq: piSeq,
versionNo: versionNo
piSeq: piSeq
},
type: 'GET',
dataType:"html",
@ -168,5 +212,162 @@ $(document).on('change', '#mUtilityType', function (){
}
});
$(document).on('click', '#updatePartInfo', function (){
if($('#mMgtOrgan').val() == ''){
alert('해경서를 선택해주세요');
$('#mMgtOrgan').focus();
return false;
}
if($('#mPiUserSeq').val() == ''){
alert('담당자를 선택해주세요');
$('#mPiUserSeq').focus();
return false;
}
if($('#mMpWorkType').val() != ''){
if($('#mMpPeopleCnt').val() == ''){
alert('해경 인원수를 입력해주세요');
$('#mMpPeopleCnt').focus();
return false;
}
}
if($('#mPlWorkType').val() != ''){
if($('#mPlPeopleCnt').val() == ''){
alert('육경 인원수를 입력해주세요');
$('#mPlPeopleCnt').focus();
return false;
}
}
if($("#mRentType").val() == 'Y'){
if($("#mRentPrice").val() == ''){
alert("임차료를 입력해주세요.");
$('#mRentPrice').focus();
return false;
}
}
if($("#mUtilityType").val() == 'Y'){
if($("#mUtilityPrice").val() == ''){
alert("공공요금을 입력해주세요.");
$('#mUtilityPrice').focus();
return false;
}
}
if(confirm("수정하시겠습니까?")){
contentFade("in");
const formData = new FormData($("#partInfoUpdate")[0]);
for(const file of files) {
if(!file.isDelete)
formData.append('uploadFiles', file, file.name);
}
$(".text-decoration-line-through").each(function (idx, el){
formData.append('fileSeq', $(el).attr("data-fileseq"));
})
$.ajax({
type : 'POST',
data : formData,
url : "/target/updatePartInfo",
processData: false,
contentType: false,
success : function(result) {
alert("수정되었습니다.");
contentFade("out");
showModal(result);
},
error : function(xhr, status) {
alert("수정에 실패하였습니다.")
contentFade("out");
}
})
}
})
function showHistory(piSeq){
$.ajax({
url: '/target/PartInfoHistoryPage',
data: {
piSeq: piSeq
},
type: 'GET',
dataType:"html",
success: function(html){
$("#partInfoEditModalEditModalContent").empty().append(html);
$("#partInfoEditModal").modal('show');
},
error:function(){
}
});
}
$(document).on('click', '.historyInfoTr', function (){
$(this).find('.hisChk').prop('checked',true)
if($(this).find('.hisChk').prop('checked')){
$('.hisChk').prop('checked',false);
$(this).find('.hisChk').prop('checked',true)
}
$.ajax({
url: '/target/partInfoHistoryView',
data: {
piSeq: Number($(this).find(".piSeq").val()),
versionNo : Number($(this).find(".verNo").val())
},
type: 'GET',
dataType:"json",
success: function(data){
$('#hMgtOrgan').val(data.mgtOrgan);
$('#hLandPolice').val(data.landPolice);
$('#hPiUserSeq').val(data.piManagerName);
$('#hMpWorkType').val(data.mpWorkType);
$('#hMpPeopleCnt').val(data.mpPeopleCnt);
$('#hMpDescription').val(data.mpDescription);
$('#hPlWorkType').val(data.plWorkType);
$('#hPlPeopleCnt').val(data.plPeopleCnt);
$('#hPlDescription').val(data.plDescription);
$('#hTerminalNm').val(data.terminalNm);
$('#hRentType').val(data.rentType);
$('#hRentPrice').val(data.rentPrice);
$('#hUtilityType').val(data.utilityType);
$('#hUtilityPrice').val(data.utilityPrice);
if(data.fileList[0].origNm != null){
$('#historyFile').empty();
for(var i=0;i<data.fileList.length;i++){
$('#historyFile').append(
'<input type="text" class="form-control" value="'+data.fileList[i].origNm+'.'+data.fileList[i].fileExtn+'" readonly>'
);
}
}else{
$('#historyFile').empty().append(
'<input type="text" class="form-control" value="업로드 파일없음." readonly>'
);
}
},
error:function(){
}
});
})
$(document).on('click', '#deletePartInfo', function (){
const piSeq = $('input[name=piSeq]').val();
if(confirm("삭제하시겠습니까?")){
contentFade("in");
$.ajax({
type : 'POST',
url : "/target/deletePartInfo",
data : JSON.stringify({piSeq:piSeq}),
contentType: 'application/json',
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success : function(data) {
alert("삭제 처리되었습니다.");
location.reload();
},
error : function(xhr, status) {
alert("삭제 처리에 실패하였습니다");
}
})
}
})

View File

@ -39,7 +39,7 @@
<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">
<select class="form-select form-select-sm" id="mpWorkType" name="mpWorkType">
<option value="">선택</option>
<th:block th:each="commonCode:${session.commonCode.get('PIS')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
@ -59,7 +59,7 @@
<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">
<select class="form-select form-select-sm" id="plWorkType" name="plWorkType">
<option value="">선택</option>
<th:block th:each="commonCode:${session.commonCode.get('PIS')}">
<option th:value="${commonCode.itemCd}" th:text="${commonCode.itemValue}"></option>
@ -92,7 +92,7 @@
</select>
</div>
<div class="col-sm-3">
<input type="number" class="form-control" id="rentPrice" name="rentPrice" placeholder="직접입력">
<input type="number" class="form-control" id="rentPrice" name="rentPrice" placeholder="단위: 만">
</div>
</div>
<div class="mb-3 row">
@ -105,7 +105,7 @@
</select>
</div>
<div class="col-sm-3">
<input type="number" class="form-control" id="utilityPrice" name="utilityPrice" placeholder="직접입력">
<input type="number" class="form-control" id="utilityPrice" name="utilityPrice" placeholder="단위: 만">
</div>
</div>
<div class="row mb-3">

View File

@ -0,0 +1,147 @@
<!DOCTYPE html>
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
<h5 class="modal-title">외사분실운영 현황</h5>
<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" id="accessTab"
th:onclick="|showModal(${partInfoList[0].piSeq})|"
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 active" id="approvalTab"
th:onclick="|showHistory(${partInfoList[0].piSeq})|"
data-bs-toggle="tab" data-bs-target="#approvalTabPanel"
type="button" role="tab" aria-controls="approvalTabPanel"
aria-selected="false">수정이력</button>
</li>
</ul>
<div class="row justify-content-start">
<div class="col-4">
<div class="card">
<div class="card-body">
<div class="row">
<table class="table table-striped" id="categoryTable">
<thead>
<tr>
<th></th>
<th>작성자</th>
<th>등록일</th>
</tr>
</thead>
<tbody class="overflow-scroll">
<tr class="historyInfoTr" th:each="partInfo:${partInfoList}">
<td><input type="checkbox" class="hisChk"> <input
type="hidden" class="piSeq" th:value="${partInfo.piSeq}">
<input type="hidden" class="verNo"
th:value="${partInfo.versionNo}"></td>
<td th:text="${partInfo.wrtNm}"></td>
<td
th:text="${#temporals.format(partInfo.wrtDt, 'yyyy-MM-dd')}"></td>
</tr>
</tbody>
</table>
</div>
</div>
</div>
</div>
<div class="col-8" id="valueDiv">
<div class="mb-2 row">
<label for="ogCd" class="col-sm-2 col-form-label text-center">해경서</label>
<div class="col-sm-3">
<input type="text" class="form-control" id="hMgtOrgan" readonly>
</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="hLandPolice" readonly>
</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">
<input type="text" class="form-control" id="hPiUserSeq" readonly>
</div>
</div>
<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-3">
<input type="text" class="form-control" id="hMpWorkType" readonly>
</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="hMpPeopleCnt" readonly>
</div>
</div>
<div class="mb-3 row">
<label for="ofcCd" class="col-sm-2 col-form-label text-center">비고</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="hMpDescription"
readonly>
</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-3">
<input type="text" class="form-control" id="hPlWorkType" readonly>
</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="hPlPeopleCnt" readonly>
</div>
</div>
<div class="mb-3 row">
<label for="ofcCd" class="col-sm-2 col-form-label text-center">비고</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="hPlDescription"
readonly>
</div>
</div>
<br>
<div class="mb-3 row">
<label for="ogCd" class="col-sm-2 col-form-label text-center">터미널명</label>
<div class="col-sm-4">
<input type="text" class="form-control" id="hTerminalNm" readonly>
</div>
</div>
<div class="mb-3 row">
<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="hRentType" readonly>
</div>
<div class="col-sm-3">
<input type="number" class="form-control" id="hRentPrice" readonly>
</div>
</div>
<div class="mb-3 row">
<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="hUtilityType" readonly>
</div>
<div class="col-sm-3">
<input type="number" class="form-control" id="hUtilityPrice"
readonly>
</div>
</div>
<div class="mb-3 row">
<label for="ofcCd" class="col-sm-2 col-form-label text-center">업로드파일</label>
<div class="col-sm-8" id="historyFile"></div>
</div>
</div>
</div>
</div>
<div class="modal-footer justify-content-between">
<div class="col-auto">
<button type="button" class="btn btn-secondary"
data-bs-dismiss="modal">닫기</button>
</div>
</div>
</html>

View File

@ -99,12 +99,22 @@
<th rowspan="3">최종수정일</th>
</tr>
<tr>
<th:block th:if="${not #strings.isEmpty(total)}">
<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>
</th:block>
<th:block th:unless="${not #strings.isEmpty(total)}">
<th>상주 0개소 0명</th>
<th>비상주 0개소 0명</th>
<th>폐쇄 0개소 0명</th>
<th>상주 0개소 0명</th>
<th>비상주 0개소 0명</th>
<th>폐쇄 0개소 0명</th>
</th:block>
</tr>
<tr>
<th>근무방법</th>
@ -130,12 +140,10 @@
<td th:text="${pi.plDescription}"></td>
<td th:text="${pi.terminalNm}"></td>
<td th:text="${pi.piManagerName}"></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:if="${#strings.isEmpty(pi.rentType)}"></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:if="${#strings.isEmpty(pi.utilityType)}"></td>
<td th:text="|${pi.rentPrice}만|" th:if="${pi.rentType eq 'Y'}"></td>
<td th:unless="${pi.rentType eq 'Y'}">무상</td>
<td th:text="|${pi.utilityPrice}만|" th:if="${pi.utilityType eq 'Y'}"></td>
<td th:unless="${pi.utilityType eq 'Y'}">무상</td>
<td th:text="${#temporals.format(pi.wrtDt, 'yyyy-MM-dd')}"></td>
</tr>
</tbody>

View File

@ -2,6 +2,7 @@
<html lang="ko" xmlns:th="http://www.thymeleaf.org">
<div class="modal-header">
<h5 class="modal-title">외사분실운영 현황</h5>
<button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button>
</div>
<div class="modal-body">
@ -10,16 +11,18 @@
<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>
<button class="nav-link" id="approvalTab" th:onclick="|showHistory(${partInfo.piSeq})|" 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">
<form id="partInfoUpdate" method="post">
<input type="hidden" name="_csrf_header" th:value="${_csrf.headerName}"/>
<input type="hidden" th:name="${_csrf.parameterName}" th:value="${_csrf.token}"/>
<input type="hidden" name="piSeq" th:value="${partInfo.piSeq}">
<input type="hidden" name="versionNo" th:value="${partInfo.versionNo}">
<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">
<select class="form-select form-select-sm" id="mMgtOrgan" name="mgtOrgan">
<option value="">선택</option>
<th:block th:each="commonCode:${session.commonCode.get('OG')}">
<th:block th:if="${#lists.contains(mgtOrganList, commonCode.itemCd)}">
@ -36,7 +39,7 @@
<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">
<select class="form-select form-select-sm" id="mPiUserSeq" 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>
@ -49,7 +52,7 @@
<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">
<select class="form-select form-select-sm" id="mMpWorkType" 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>
@ -58,7 +61,7 @@
</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}">
<input type="number" class="form-control" id="mMpPeopleCnt" 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">
@ -69,7 +72,7 @@
<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">
<select class="form-select form-select-sm" id="mPlWorkType" 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>
@ -78,7 +81,7 @@
</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}">
<input type="number" class="form-control" id="mPlPeopleCnt" 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">
@ -102,7 +105,7 @@
</select>
</div>
<div class="col-sm-3">
<input type="number" class="form-control" id="mRentPrice" name="rentPrice" th:value="${partInfo.rentPrice}" placeholder="직접입력">
<input type="number" class="form-control" id="mRentPrice" name="rentPrice" th:value="${partInfo.rentPrice}" placeholder="단위: 만">
</div>
</div>
<div class="mb-3 row">
@ -115,14 +118,22 @@
</select>
</div>
<div class="col-sm-3">
<input type="number" class="form-control" id="mUtilityPrice" name="utilityPrice" th:value="${partInfo.utilityPrice}" placeholder="직접입력">
<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">
<th:block th:if="${#strings.isEmpty(partInfo.fileList[0].origNm)}">
<br>파일을 업로드 해주세요.
</th:block>
<th:block th:unless="${#strings.isEmpty(partInfo.fileList[0].origNm)}">
<div class='row-col-6' th:each="infoFile:${partInfo.fileList}">
<span th:data-fileseq="${infoFile.fileSeq}" th:text="|${infoFile.origNm}.${infoFile.fileExtn} ${infoFile.fileSize}|"></span>
<a href='#' class='uploadedFileDelete text-danger text-decoration-none'>삭제</a>
</div>
</th:block>
</div>
</div>
<input type="file" class="d-none" id="fileInputer" multiple>
@ -133,7 +144,8 @@
<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>
<button type="button" class="btn btn-danger" id="deletePartInfo">삭제</button>
<button type="button" class="btn btn-primary" id="updatePartInfo">수정</button>
</div>
</div>
</html>