선원현황 작업중.

master
최강석 2023-07-12 18:24:17 +09:00
parent 739d573307
commit 206636f854
10 changed files with 167 additions and 50 deletions

View File

@ -257,10 +257,10 @@ public class UnlawfulFishingController {
AccessConfig accessConfig = authMgtService.selectAccessConfigList(loginUser.getUserSeq(), "/unlawfulFishing/illegalShipSailor").get(0);
mav.addObject("menuKey", accessConfig.getMenuKey());
mav.addObject("accessAuth", accessConfig.getAccessAuth());
List<CrackdownStatusDTO> csDTOList = new ArrayList<>();
mav.addObject("sailorList", csDTOList);
params.setQueryInfo();
mav.addObject("sailorList", unlawfulFishingService.selectIllegalShipSailorList(params));
params.setContentCnt(unlawfulFishingService.selectIllegalShipSailorListCnt(params));
params.setPaginationInfo();
mav.addObject("searchParams", params);
return mav;
}
@ -270,6 +270,20 @@ public class UnlawfulFishingController {
return new ModelAndView("faStatistics/unlawfulFishing/illegalShipSailor/issAddModal");
}
@PostMapping("/saveIllegalShipSailorList")
@ResponseBody
public void saveIllegalShipSailorList(@AuthenticationPrincipal UserInfo loginUser, @RequestBody List<IllegalShipSailor> sailorList){
for(IllegalShipSailor sailor : sailorList){
sailor.setWrtOrgan(loginUser.getOgCd());
sailor.setWrtPart(loginUser.getOfcCd());
sailor.setWrtUserSeq(loginUser.getUserSeq());
sailor.setWrtUserGrd(loginUser.getTitleCd());
sailor.setWrtUserNm(loginUser.getUserNm());
sailor.setWrtDt(LocalDateTime.now());
}
unlawfulFishingService.saveIllegalShipSailorList(sailorList);
}
@GetMapping("/issEditModal")
public ModelAndView illegalShipSailorEditModal(@AuthenticationPrincipal UserInfo loginUser, IllegalShipSailor illegalShipSailor){
ModelAndView mav = new ModelAndView("faStatistics/unlawfulFishing/illegalShipSailor/issEditModal");

View File

@ -4,6 +4,7 @@ import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.UnlawfulFishingPar
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.crackdownStatus.CrackdownInfo;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.IllegalShipInfo;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.processResult.ShipProcessInfo;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailor;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@ -24,4 +25,8 @@ public interface UnlawfulFishingMapper {
List<ShipProcessInfo> selectShipProcessInfoList(UnlawfulFishingParam params);
Integer selectShipProcessInfoListCnt(UnlawfulFishingParam params);
List<IllegalShipSailor> selectIllegalShipSailorList(UnlawfulFishingParam params);
Integer selectIllegalShipSailorListCnt(UnlawfulFishingParam params);
}

View File

@ -35,30 +35,7 @@ public class IllegalShipSailor extends SailorBaseEntity {
private String status;
@Transient
@DateTimeFormat(pattern = "yyyy-MM-dd")
private LocalDateTime updDt;
@Transient
private Integer cdsKey;
@Transient
private CrackdownStatus crackdownStatus;
@Transient
private FishingBoat fishingBoat;
@Transient
private List<FishingBoat> fishingBoatList;
@Transient
private List<Violation> violationList;
@Transient
private String year;
@Transient
private String crackdownPolice;
@Transient
private String crackdownBoat;
private String caseNum;
@Transient
private String boatNameKr;
@Transient
private LocalDateTime napoDt;
@Transient
private List<SailorFile> fileList;
}

View File

@ -7,8 +7,8 @@ import java.util.List;
import java.util.Optional;
public interface IllegalShipSailorHistoryRepository extends JpaRepository<IllegalShipSailorHistory, IllegalShipSailorHistory.IllegalShipSailorHistoryId> {
Optional<IllegalShipSailorHistory> findTopBySailorKeyOrderByVersionNoDesc(Integer sailorKey);
List<IllegalShipSailorHistory> findBySailorKey(Integer sailorKey);
Optional<IllegalShipSailorHistory> findTopBySailorKeyOrderByVersionNoDesc(Integer sailorKey);
List<IllegalShipSailorHistory> findBySailorKey(Integer sailorKey);
IllegalShipSailorHistory findByVersionNoAndSailorKey(Integer versionNo, Integer sailorKey);
}

View File

@ -8,6 +8,7 @@ import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.fishingBoat.Illega
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.processResult.ShipProcessInfo;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.processResult.ShipProcessInfoHistory;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailor;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.IllegalShipSailorHistory;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.model.sailor.Sailor;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.mapper.UnlawfulFishingMapper;
import com.dbnt.faisp.main.faStatistics.unlawfulFishing.repository.*;
@ -241,4 +242,25 @@ public class UnlawfulFishingService {
public Integer selectShipProcessInfoListCnt(UnlawfulFishingParam params) {
return unlawfulFishingMapper.selectShipProcessInfoListCnt(params);
}
@Transactional
public void saveIllegalShipSailorList(List<IllegalShipSailor> sailorList) {
issRepository.saveAll(sailorList);
List<IllegalShipSailorHistory> historyList = new ArrayList<>();
for(IllegalShipSailor info: sailorList){
IllegalShipSailorHistory history = new IllegalShipSailorHistory();
BeanUtils.copyProperties(info, history);
history.setVersionNo(1);
historyList.add(history);
}
isshRepository.saveAll(historyList);
}
public List<IllegalShipSailor> selectIllegalShipSailorList(UnlawfulFishingParam params) {
return unlawfulFishingMapper.selectIllegalShipSailorList(params);
}
public Integer selectIllegalShipSailorListCnt(UnlawfulFishingParam params) {
return unlawfulFishingMapper.selectIllegalShipSailorListCnt(params);
}
}

View File

@ -199,4 +199,39 @@
<sql id="selectShipProcessInfoListWhere">
where a.status &lt;> 'DST008'
</sql>
<select id="selectIllegalShipSailorList" resultType="IllegalShipSailor" parameterType="UnlawfulFishingParam">
select iss.sailor_key ,
isi.fb_key ,
isi.boat_name_kr ,
ci.case_num ,
iss.sailor_name_kr ,
iss.birthdate ,
iss.position ,
iss.career ,
iss.similar_criminal_history ,
iss.heterogeneous_criminal_history ,
iss.arrest_history ,
iss.wrt_organ ,
iss.wrt_part ,
iss.wrt_user_grd ,
iss.wrt_user_nm ,
iss.wrt_dt
from illegal_ship_sailor iss
inner join illegal_ship_info isi on iss.fb_key = isi.fb_key
inner join crackdown_info ci on isi.cds_key = ci.cds_key
<include refid="selectIllegalShipSailorListWhere"></include>
</select>
<select id="selectIllegalShipSailorListCnt" resultType="int" parameterType="UnlawfulFishingParam">
select count(*)
from illegal_ship_sailor iss
inner join illegal_ship_info isi on iss.fb_key = isi.fb_key
inner join crackdown_info ci on isi.cds_key = ci.cds_key
<include refid="selectIllegalShipSailorListWhere"></include>
</select>
<sql id="selectIllegalShipSailorListWhere">
where iss.status &lt;> 'DST008'
</sql>
</mapper>

View File

@ -21,6 +21,7 @@ $(document).on('click', '#addSailorTab', function (){
$(liButton).attr("aria-controls", "sailor"+sailorCnt+"TabPanel");
const newTabContentHtml = $("#sailorTabEmptyDiv").children().clone();
newTabContentHtml[0].className = newTabContentHtml[0].className+" sailorInfo";
newTabContentHtml[0].id = "sailor"+sailorCnt+"TabPanel";
$(newTabContentHtml).attr("aria-labelledby", "sailor"+sailorCnt+"Tab");
@ -44,7 +45,48 @@ $(document).on('click', '.deleteTab', function (){
})
$(document).on('click', '.saveEditInfoBtn', function (){
if(confirm("저장하시겠습니까?")){
const sailorList = [];
const fbKey = $("#fbKey").val()
const status = $(this).data("data-status")
$.each($(".sailorInfo"), function (idx, sailor){
const sailorDiv = $(sailor);
sailorList.push({
fbKey: fbKey,
status: status,
sailorNameKr: sailorDiv.find(".sailorNameKr").val(),
sailorNameCn: sailorDiv.find(".sailorNameCn").val(),
birthdate: sailorDiv.find(".birthdate").val(),
residence: sailorDiv.find(".residence").val(),
education: sailorDiv.find(".education").val(),
position: sailorDiv.find(".position").val(),
career: sailorDiv.find(".career").val(),
similarCriminalHistory: sailorDiv.find(".similarCriminalHistory").val(),
heterogeneousCriminalHistory: sailorDiv.find(".heterogeneousCriminalHistory").val(),
monthlyWages: sailorDiv.find(".monthlyWages").val(),
arrestHistory: sailorDiv.find(".arrestHistory").val(),
criminalHistoryDetail: sailorDiv.find(".criminalHistoryDetail").val(),
note: sailorDiv.find(".note").val()
})
});
$.ajax({
type: 'POST',
url: '/unlawfulFishing/saveIllegalShipSailorList',
data: JSON.stringify(sailorList),
contentType: 'application/json',
dataType:"html",
beforeSend: function (xhr){
xhr.setRequestHeader($("[name='_csrf_header']").val(), $("[name='_csrf']").val());
},
success: function(html){
alert("저장되었습니다.")
location.reload()
},
error:function(e){
ajaxErrorAction(e);
}
});
}
})
function getIssAddModal(){

View File

@ -104,30 +104,52 @@
<tr class="table-secondary">
<th>순번</th>
<th>사건번호</th>
<th>MMSI.NO</th>
<th>나포일시</th>
<th>나포장소</th>
<th>사건담당경찰서</th>
<th>사건담당경찰관</th>
<th>단속경찰서</th>
<th>단속함정</th>
<th>침범유형</th>
<th>NLL침범여부</th>
<th>압송여부</th>
<th>어선명</th>
<th>선원명</th>
<th>생년월일</th>
<th>선박직책</th>
<th>승선경력</th>
<th>동종범죄경력</th>
<th>이종범죄경력</th>
<th>검거이력</th>
<th>작성자</th>
<th>작성일시</th>
</tr>
</thead>
<tbody class="table-group-divider align-middle">
<th:block th:each="dto,cnt:${crackdownInfoList}">
<tr class="crackdownStatusTr" th:data-cdskey="${dto.cdsKey}" data-modaltype="viewOnly">
<td th:text="${cnt.count}"></td>
<td th:text="${#temporals.format(dto.napoDt, 'yyyy-MM-dd HH:mm')}"></td>
<th:block th:each="sailor,cnt:${sailorList}">
<tr class="sailorTr" th:data-sailorkey="${sailor.sailorKey}">
<td th:text="${searchParams.contentCnt-(20*(searchParams.pageIndex-1))-cnt.index}"></td>
<td th:text="${sailor.caseNum}"></td>
<td th:text="${sailor.boatNameKr}"></td>
<td th:text="${sailor.sailorNameKr}"></td>
<td th:text="${sailor.birthdate}"></td>
<td>
<div th:if="${!#strings.isEmpty(dto.napoSeaPointLon) and !#strings.isEmpty(dto.napoSeaPointLon)}" th:text="${#strings.concat(dto.napoSeaPointLon, ' ~ ', dto.napoSeaPointLat)}"></div>
<div th:if="${!#strings.isEmpty(dto.napoSeaPointLon) or !#strings.isEmpty(dto.napoSeaPointLon)}" th:text="${#strings.concat(dto.napoSeaPointLon, dto.napoSeaPointLat)}"></div>
<div th:text="${dto.napoSeaPointDetail}"></div>
<th:block th:each="code:${session.commonCode.get('POS')}">
<th:block th:if="${code.itemCd eq sailor.position}" th:text="${code.itemValue}"></th:block>
</th:block>
</td>
<td>
<th:block th:each="code:${session.commonCode.get('BE')}">
<th:block th:if="${code.itemCd eq sailor.career}" th:text="${code.itemValue}"></th:block>
</th:block>
</td>
<td th:text="${sailor.similarCriminalHistory}"></td>
<td th:text="${sailor.heterogeneousCriminalHistory}"></td>
<td th:text="${sailor.arrestHistory}"></td>
<td>
<th:block th:each="code:${session.commonCode.get('OG')}">
<th:block th:if="${code.itemCd eq sailor.wrtOrgan}" th:text="${code.itemValue}"></th:block>
</th:block>
<th:block th:each="code:${session.commonCode.get(sailor.wrtOrgan)}">
<th:block th:if="${code.itemCd eq sailor.wrtPart}" th:text="${code.itemValue}"></th:block>
</th:block>
<th:block th:each="code:${session.commonCode.get('JT')}">
<th:block th:if="${code.itemCd eq sailor.wrtUserGrd}" th:text="${code.itemValue}"></th:block>
</th:block>
<th:block th:text="${sailor.wrtUserNm}"></th:block>
</td>
<td th:text="${#temporals.format(sailor.wrtDt, 'yyyy-MM-dd HH:mm')}"></td>
</tr>
</th:block>
</tbody>

View File

@ -150,7 +150,7 @@
</li>
</div>
<div class="d-none" id="sailorTabEmptyDiv">
<div class="tab-pane sailorInfo fade p-2" role="tabpanel" tabindex="0">
<div class="tab-pane fade p-2" role="tabpanel" tabindex="0">
<div class="row justify-content-end mb-1">
<input type="button" class="btn btn-sm btn-danger col-1 mx-2 deleteTab" value="삭제">
</div>

View File

@ -120,7 +120,7 @@
<tbody class="table-group-divider align-middle">
<th:block th:each="spi,cnt:${shipProcessInfoList}">
<tr class="spiTr" th:data-prkey="${spi.prKey}">
<td th:text="${cnt.count}"></td>
<td th:text="${searchParams.contentCnt-(20*(searchParams.pageIndex-1))-cnt.index}"></td>
<td th:text="${spi.caseNum}"></td>
<td th:text="${spi.boatNameKr}"></td>
<td th:text="${#temporals.format(spi.napoDt, 'yyyy-MM-dd HH:mm')}"></td>