Compare commits
No commits in common. "e23aea22dfcd814f9512d89d72151547985a6eb9" and "8300b2749aa574e3cf82b9fb972ae2f535b12930" have entirely different histories.
e23aea22df
...
8300b2749a
|
|
@ -1,35 +1,23 @@
|
||||||
package com.dbnt.faisp.config;
|
package com.dbnt.faisp.config;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.faRpt.service.FaRptService;
|
import com.dbnt.faisp.main.faRpt.service.FaRptService;
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.FishingBoatService;
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.SailorService;
|
|
||||||
import com.dbnt.faisp.main.fpiMgt.affair.service.AffairService;
|
import com.dbnt.faisp.main.fpiMgt.affair.service.AffairService;
|
||||||
import com.dbnt.faisp.main.fpiMgt.affairPlan.service.PlanService;
|
import com.dbnt.faisp.main.fpiMgt.affairPlan.service.PlanService;
|
||||||
import com.dbnt.faisp.main.fpiMgt.affairResult.service.ResultService;
|
import com.dbnt.faisp.main.fpiMgt.affairResult.service.ResultService;
|
||||||
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.service.BoardInvestigationService;
|
import com.dbnt.faisp.main.ivsgtMgt.boardInvestigation.service.BoardInvestigationService;
|
||||||
import com.dbnt.faisp.main.publicBoard.service.PublicBoardService;
|
import com.dbnt.faisp.main.publicBoard.service.PublicBoardService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.core.io.FileSystemResource;
|
|
||||||
import org.springframework.core.io.Resource;
|
|
||||||
import org.springframework.http.HttpHeaders;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.http.ResponseEntity;
|
|
||||||
import org.springframework.util.FileCopyUtils;
|
import org.springframework.util.FileCopyUtils;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
import java.io.*;
|
import java.io.*;
|
||||||
import java.net.URLEncoder;
|
import java.net.URLEncoder;
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.nio.file.Paths;
|
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
@RequestMapping("/file")
|
|
||||||
public class FileController {
|
public class FileController {
|
||||||
|
|
||||||
private final FaRptService faRptService;
|
private final FaRptService faRptService;
|
||||||
|
|
@ -38,55 +26,13 @@ public class FileController {
|
||||||
private final AffairService affairService;
|
private final AffairService affairService;
|
||||||
private final ResultService resultService;
|
private final ResultService resultService;
|
||||||
private final BoardInvestigationService boardInvestigationService;
|
private final BoardInvestigationService boardInvestigationService;
|
||||||
private final FishingBoatService fishingBoatService;
|
|
||||||
|
|
||||||
@GetMapping("/fileDisplay")
|
@GetMapping("/file/fileDownload")
|
||||||
public ResponseEntity<Resource> fileDisplay(HttpServletRequest request,
|
|
||||||
HttpServletResponse response,
|
|
||||||
String board,
|
|
||||||
Integer parentKey,
|
|
||||||
Integer fileSeq) {
|
|
||||||
FileInfo fileInfo = getFileInfo(board, parentKey, fileSeq);
|
|
||||||
String pathStr = fileInfo.getSavePath()+fileInfo.getConvNm();
|
|
||||||
Resource resource = new FileSystemResource(pathStr);
|
|
||||||
if(!resource.exists()){
|
|
||||||
return new ResponseEntity<>(HttpStatus.NOT_FOUND);
|
|
||||||
}
|
|
||||||
HttpHeaders header = new HttpHeaders();
|
|
||||||
Path filePath = null;
|
|
||||||
try {
|
|
||||||
filePath = Paths.get(pathStr);
|
|
||||||
header.add("Content-type", Files.probeContentType(filePath));
|
|
||||||
}catch (IOException e){
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
return new ResponseEntity<Resource>(resource, header, HttpStatus.OK);
|
|
||||||
}
|
|
||||||
@GetMapping("/fileDownload")
|
|
||||||
public void fileDownload(HttpServletRequest request,
|
public void fileDownload(HttpServletRequest request,
|
||||||
HttpServletResponse response,
|
HttpServletResponse response,
|
||||||
String board,
|
String board,
|
||||||
Integer parentKey,
|
Integer parentKey,
|
||||||
Integer fileSeq) {
|
Integer fileSeq) {
|
||||||
|
|
||||||
FileInfo fileInfo = getFileInfo(board, parentKey, fileSeq);
|
|
||||||
BufferedInputStream in;
|
|
||||||
BufferedOutputStream out;
|
|
||||||
try {
|
|
||||||
File file = new File(fileInfo.getSavePath(), fileInfo.getConvNm());
|
|
||||||
|
|
||||||
setDisposition(fileInfo.getFullName(), request, response);
|
|
||||||
in = new BufferedInputStream(new FileInputStream(file));
|
|
||||||
out = new BufferedOutputStream(response.getOutputStream());
|
|
||||||
FileCopyUtils.copy(in, out);
|
|
||||||
out.flush();
|
|
||||||
if(out!=null) out.close();
|
|
||||||
if(in!=null )in.close();
|
|
||||||
} catch (IOException e) {
|
|
||||||
e.printStackTrace();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
private FileInfo getFileInfo(String board, Integer parentKey, Integer fileSeq){
|
|
||||||
FileInfo downloadFile = null;
|
FileInfo downloadFile = null;
|
||||||
switch (board){
|
switch (board){
|
||||||
case "faRpt":
|
case "faRpt":
|
||||||
|
|
@ -107,11 +53,23 @@ public class FileController {
|
||||||
case "ivsgt":
|
case "ivsgt":
|
||||||
downloadFile = boardInvestigationService.selectIvsgtFile(parentKey, fileSeq);
|
downloadFile = boardInvestigationService.selectIvsgtFile(parentKey, fileSeq);
|
||||||
break;
|
break;
|
||||||
case "sailor":
|
|
||||||
downloadFile = fishingBoatService.selectSailorFile(parentKey, fileSeq);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
return downloadFile;
|
|
||||||
|
BufferedInputStream in;
|
||||||
|
BufferedOutputStream out;
|
||||||
|
try {
|
||||||
|
File file = new File(downloadFile.getSavePath(), downloadFile.getConvNm());
|
||||||
|
|
||||||
|
setDisposition(downloadFile.getFullName(), request, response);
|
||||||
|
in = new BufferedInputStream(new FileInputStream(file));
|
||||||
|
out = new BufferedOutputStream(response.getOutputStream());
|
||||||
|
FileCopyUtils.copy(in, out);
|
||||||
|
out.flush();
|
||||||
|
if(out!=null) out.close();
|
||||||
|
if(in!=null )in.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
private void setDisposition(String filename, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
||||||
String browser = getBrowser(request);
|
String browser = getBrowser(request);
|
||||||
|
|
|
||||||
|
|
@ -10,8 +10,10 @@ import com.dbnt.faisp.main.faStatistics.crackdownsStatus.service.FishingBoatServ
|
||||||
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
import com.dbnt.faisp.main.userInfo.model.UserInfo;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
import org.springframework.web.servlet.ModelAndView;
|
||||||
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
|
|
@ -94,10 +96,8 @@ public class FishingBoatController {
|
||||||
}
|
}
|
||||||
|
|
||||||
@PostMapping("/saveFishingBoat")
|
@PostMapping("/saveFishingBoat")
|
||||||
public Integer saveFishingBoat(@AuthenticationPrincipal UserInfo loginUser,
|
public Integer saveFishingBoat(@AuthenticationPrincipal UserInfo loginUser, CrackdownStatus crackdownStatus){
|
||||||
CrackdownStatus crackdownStatus,
|
return fishingBoatService.saveCrackdownStatus(crackdownStatus);
|
||||||
MultipartHttpServletRequest request){
|
|
||||||
return fishingBoatService.saveCrackdownStatus(crackdownStatus, request.getMultiFileMap().get("uploadFiles"));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@GetMapping("/checkCaseNum")
|
@GetMapping("/checkCaseNum")
|
||||||
|
|
|
||||||
|
|
@ -1,58 +0,0 @@
|
||||||
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model;
|
|
||||||
|
|
||||||
import com.dbnt.faisp.config.FileInfo;
|
|
||||||
import lombok.*;
|
|
||||||
import org.hibernate.annotations.DynamicInsert;
|
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
|
||||||
|
|
||||||
import javax.persistence.*;
|
|
||||||
import java.io.Serializable;
|
|
||||||
|
|
||||||
@Getter
|
|
||||||
@Setter
|
|
||||||
@Entity
|
|
||||||
@NoArgsConstructor
|
|
||||||
@DynamicInsert
|
|
||||||
@DynamicUpdate
|
|
||||||
@IdClass(CaptinPhotoVersion.CaptinPhotoVersionId.class)
|
|
||||||
@Table(name = "captin_photo_version")
|
|
||||||
public class CaptinPhotoVersion extends FileInfo {
|
|
||||||
@Id
|
|
||||||
@Column(name = "sailor_key")
|
|
||||||
private Integer sailorKey;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "file_seq")
|
|
||||||
private Integer fileSeq;
|
|
||||||
|
|
||||||
@Id
|
|
||||||
@Column(name = "version_no")
|
|
||||||
private Integer versionNo;
|
|
||||||
|
|
||||||
@Column(name = "orig_nm")
|
|
||||||
private String origNm;
|
|
||||||
|
|
||||||
@Column(name = "conv_nm")
|
|
||||||
private String convNm;
|
|
||||||
|
|
||||||
@Column(name = "file_extn")
|
|
||||||
private String fileExtn;
|
|
||||||
|
|
||||||
@Column(name = "file_size")
|
|
||||||
private String fileSize;
|
|
||||||
|
|
||||||
@Column(name = "save_path")
|
|
||||||
private String savePath;
|
|
||||||
|
|
||||||
|
|
||||||
@Embeddable
|
|
||||||
@Data
|
|
||||||
@NoArgsConstructor
|
|
||||||
@AllArgsConstructor
|
|
||||||
public static class CaptinPhotoVersionId implements Serializable {
|
|
||||||
private Integer sailorKey;
|
|
||||||
private Integer fileSeq;
|
|
||||||
private Integer versionNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -1,12 +1,15 @@
|
||||||
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat;
|
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat;
|
||||||
|
|
||||||
|
import com.dbnt.faisp.config.BaseModel;
|
||||||
import lombok.Getter;
|
import lombok.Getter;
|
||||||
import lombok.NoArgsConstructor;
|
import lombok.NoArgsConstructor;
|
||||||
import lombok.Setter;
|
import lombok.Setter;
|
||||||
import org.hibernate.annotations.DynamicInsert;
|
import org.hibernate.annotations.DynamicInsert;
|
||||||
import org.hibernate.annotations.DynamicUpdate;
|
import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
import org.springframework.format.annotation.DateTimeFormat;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,5 @@
|
||||||
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor;
|
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoFile;
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.Violation;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.Violation;
|
||||||
|
|
@ -57,7 +56,4 @@ public class Sailor extends SailorBaseEntity {
|
||||||
private String boatNameKr;
|
private String boatNameKr;
|
||||||
@Transient
|
@Transient
|
||||||
private LocalDateTime napoDt;
|
private LocalDateTime napoDt;
|
||||||
|
|
||||||
@Transient
|
|
||||||
private List<CaptinPhotoFile> fileList;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -83,5 +83,4 @@ public class SailorBaseEntity extends BaseModel {
|
||||||
@Column(name = "wrt_dt")
|
@Column(name = "wrt_dt")
|
||||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm")
|
||||||
private LocalDateTime wrtDt;
|
private LocalDateTime wrtDt;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,5 @@
|
||||||
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor;
|
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor;
|
||||||
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoFile;
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoVersion;
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
|
||||||
import lombok.*;
|
import lombok.*;
|
||||||
|
|
@ -10,7 +8,6 @@ import org.hibernate.annotations.DynamicUpdate;
|
||||||
|
|
||||||
import javax.persistence.*;
|
import javax.persistence.*;
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
@Getter
|
@Getter
|
||||||
@Setter
|
@Setter
|
||||||
|
|
@ -52,7 +49,4 @@ public class SailorVersion extends SailorBaseEntity {
|
||||||
private CrackdownStatus crackdownStatus;
|
private CrackdownStatus crackdownStatus;
|
||||||
@Transient
|
@Transient
|
||||||
private FishingBoat fishingBoat;
|
private FishingBoat fishingBoat;
|
||||||
|
|
||||||
@Transient
|
|
||||||
private List<CaptinPhotoVersion> fileList;
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -3,9 +3,6 @@ package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoFile;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoFile;
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
public interface CaptionPhotoFileRepository extends JpaRepository<CaptinPhotoFile, CaptinPhotoFile.CaptinPhotoFileId> {
|
public interface CaptionPhotoFileRepository extends JpaRepository<CaptinPhotoFile, CaptinPhotoFile.CaptinPhotoFileId> {
|
||||||
|
|
||||||
List<CaptinPhotoFile> findBySailorKeyOrderByFileSeqAsc(Integer sailorKey);
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,8 +0,0 @@
|
||||||
package com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository;
|
|
||||||
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoVersion;
|
|
||||||
import org.springframework.data.jpa.repository.JpaRepository;
|
|
||||||
|
|
||||||
public interface CaptionPhotoVersionRepository extends JpaRepository<CaptinPhotoVersion, CaptinPhotoVersion.CaptinPhotoVersionId> {
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
@ -2,10 +2,7 @@ package com.dbnt.faisp.main.faStatistics.crackdownsStatus.service;
|
||||||
|
|
||||||
|
|
||||||
import com.dbnt.faisp.config.BaseService;
|
import com.dbnt.faisp.config.BaseService;
|
||||||
import com.dbnt.faisp.config.FileInfo;
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper.CrackdownStatusMapper;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.mapper.CrackdownStatusMapper;
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoFile;
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.CaptinPhotoVersion;
|
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatus;
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatusVersion;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.crackdownStatus.CrackdownStatusVersion;
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.fishingBoat.FishingBoat;
|
||||||
|
|
@ -19,16 +16,12 @@ import com.dbnt.faisp.main.faStatistics.crackdownsStatus.model.sailor.SailorVers
|
||||||
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.*;
|
import com.dbnt.faisp.main.faStatistics.crackdownsStatus.repository.*;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
import org.springframework.beans.BeanUtils;
|
import org.springframework.beans.BeanUtils;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
import org.springframework.web.multipart.MultipartFile;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.UUID;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
@RequiredArgsConstructor
|
@RequiredArgsConstructor
|
||||||
|
|
@ -45,8 +38,6 @@ public class FishingBoatService extends BaseService {
|
||||||
private final ProcessResultVersionRepository processResultVersionRepository;
|
private final ProcessResultVersionRepository processResultVersionRepository;
|
||||||
private final SailorRepository sailorRepository;
|
private final SailorRepository sailorRepository;
|
||||||
private final SailorVersionRepository sailorVersionRepository;
|
private final SailorVersionRepository sailorVersionRepository;
|
||||||
private final CaptionPhotoFileRepository captionPhotoFileRepository;
|
|
||||||
private final CaptionPhotoVersionRepository captionPhotoVersionRepository;
|
|
||||||
|
|
||||||
public List<CrackdownStatus> selectFishingBoatList(CrackdownStatus crackdownStatus){
|
public List<CrackdownStatus> selectFishingBoatList(CrackdownStatus crackdownStatus){
|
||||||
return crackdownStatusMapper.selectFishingBoatList(crackdownStatus);
|
return crackdownStatusMapper.selectFishingBoatList(crackdownStatus);
|
||||||
|
|
@ -63,17 +54,14 @@ public class FishingBoatService extends BaseService {
|
||||||
crackdownStatus.setViolationList(violationRepository.findByFbKey(crackdownStatus.getFishingBoat().getFbKey()));
|
crackdownStatus.setViolationList(violationRepository.findByFbKey(crackdownStatus.getFishingBoat().getFbKey()));
|
||||||
crackdownStatus.setSailorList(sailorRepository.findByFbKey(crackdownStatus.getFishingBoat().getFbKey()));
|
crackdownStatus.setSailorList(sailorRepository.findByFbKey(crackdownStatus.getFishingBoat().getFbKey()));
|
||||||
for(Sailor sailor: crackdownStatus.getSailorList()){
|
for(Sailor sailor: crackdownStatus.getSailorList()){
|
||||||
if(sailor.getPosition().equals("POS001")){
|
//첨부파일 ...?
|
||||||
// 선장의 첨부파일 첨부
|
|
||||||
sailor.setFileList(captionPhotoFileRepository.findBySailorKeyOrderByFileSeqAsc(sailor.getSailorKey()));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return crackdownStatus;
|
return crackdownStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Transactional
|
@Transactional
|
||||||
public Integer saveCrackdownStatus(CrackdownStatus crackdownStatus, List<MultipartFile> sailorFiles) {
|
public Integer saveCrackdownStatus(CrackdownStatus crackdownStatus) {
|
||||||
Integer cdsKey, fbKey;
|
Integer cdsKey, fbKey;
|
||||||
if (crackdownStatus.getCdsKey()==null || crackdownStatus.getCdsKey().equals(0)){
|
if (crackdownStatus.getCdsKey()==null || crackdownStatus.getCdsKey().equals(0)){
|
||||||
// 최초 등록시 단속현황, 처리현황, 선원정보를 같이 등록.
|
// 최초 등록시 단속현황, 처리현황, 선원정보를 같이 등록.
|
||||||
|
|
@ -118,25 +106,19 @@ public class FishingBoatService extends BaseService {
|
||||||
processResultVersionRepository.save(processResultVersion);
|
processResultVersionRepository.save(processResultVersion);
|
||||||
// 선원정보, 선원정보버전 저장.
|
// 선원정보, 선원정보버전 저장.
|
||||||
List<Sailor> sailorList = crackdownStatus.getSailorList();
|
List<Sailor> sailorList = crackdownStatus.getSailorList();
|
||||||
|
List<SailorVersion> sailorVersionList = new ArrayList<>();
|
||||||
|
i = 1;
|
||||||
for(Sailor sailor: sailorList){
|
for(Sailor sailor: sailorList){
|
||||||
|
sailor.setSailorKey(i++);
|
||||||
sailor.setFbKey(fbKey);
|
sailor.setFbKey(fbKey);
|
||||||
|
|
||||||
SailorVersion sailorVersion = new SailorVersion();
|
SailorVersion sailorVersion = new SailorVersion();
|
||||||
|
|
||||||
Integer sailorKey = sailorRepository.save(sailor).getSailorKey();
|
|
||||||
|
|
||||||
BeanUtils.copyProperties(sailor, sailorVersion);
|
BeanUtils.copyProperties(sailor, sailorVersion);
|
||||||
sailorVersion.setVersionNo(1);
|
sailorVersion.setVersionNo(1);
|
||||||
sailorVersion.setSailorKey(sailorKey);
|
sailorVersionList.add(sailorVersion);
|
||||||
Integer versionNo = sailorVersionRepository.save(sailorVersion).getVersionNo();
|
|
||||||
if(sailor.getPosition().equals("POS001")){
|
|
||||||
//선장은 사진이 같이 업로드 됨.
|
|
||||||
if(sailorFiles.size()>0) {
|
|
||||||
saveCaptainPhoto(sailorKey, versionNo, sailorFiles);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
sailorRepository.saveAll(sailorList);
|
||||||
|
sailorVersionRepository.saveAll(sailorVersionList);
|
||||||
}else{
|
}else{
|
||||||
// 업데이트시에는 어선정보만 수정.
|
// 업데이트시에는 어선정보만 수정.
|
||||||
cdsKey = crackdownStatus.getCdsKey();
|
cdsKey = crackdownStatus.getCdsKey();
|
||||||
|
|
@ -178,14 +160,8 @@ public class FishingBoatService extends BaseService {
|
||||||
return fishingBoat;
|
return fishingBoat;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FileInfo selectSailorFile(Integer sailorKey, Integer fileSeq) {
|
|
||||||
return captionPhotoFileRepository.findById(new CaptinPhotoFile.CaptinPhotoFileId(sailorKey, fileSeq)).orElse(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
private CrackdownStatus setWriteInfo(CrackdownStatus crackdownStatus){
|
private CrackdownStatus setWriteInfo(CrackdownStatus crackdownStatus){
|
||||||
FishingBoat fishingBoat = crackdownStatus.getFishingBoat();
|
FishingBoat fishingBoat = crackdownStatus.getFishingBoat();
|
||||||
fishingBoat.setWrtDt(LocalDateTime.now());
|
|
||||||
|
|
||||||
crackdownStatus.setWrtOrgan(fishingBoat.getWrtOrgan());
|
crackdownStatus.setWrtOrgan(fishingBoat.getWrtOrgan());
|
||||||
crackdownStatus.setWrtPart(fishingBoat.getWrtPart());
|
crackdownStatus.setWrtPart(fishingBoat.getWrtPart());
|
||||||
crackdownStatus.setWrtUserSeq(fishingBoat.getWrtUserSeq());
|
crackdownStatus.setWrtUserSeq(fishingBoat.getWrtUserSeq());
|
||||||
|
|
@ -210,32 +186,4 @@ public class FishingBoatService extends BaseService {
|
||||||
}
|
}
|
||||||
return crackdownStatus;
|
return crackdownStatus;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Value("${file.dir.sailor}")
|
|
||||||
protected String sailorPath;
|
|
||||||
|
|
||||||
private void saveCaptainPhoto(Integer sailorKey, Integer versionNo, List<MultipartFile> fileList){
|
|
||||||
int fileSeq = 1;
|
|
||||||
for(MultipartFile file : fileList){
|
|
||||||
String saveName = UUID.randomUUID().toString();
|
|
||||||
String path = locationPath+ File.separator+sailorPath+File.separator;
|
|
||||||
saveFile(file, new File(path+File.separator+saveName));
|
|
||||||
|
|
||||||
String originalFilename = file.getOriginalFilename();
|
|
||||||
int extnIdx = originalFilename.lastIndexOf(".");
|
|
||||||
CaptinPhotoFile fileInfo = new CaptinPhotoFile();
|
|
||||||
fileInfo.setSailorKey(sailorKey);
|
|
||||||
fileInfo.setFileSeq(fileSeq++);
|
|
||||||
fileInfo.setOrigNm(originalFilename.substring(0, extnIdx));
|
|
||||||
fileInfo.setFileExtn(originalFilename.substring(extnIdx+1));
|
|
||||||
fileInfo.setConvNm(saveName);
|
|
||||||
fileInfo.setFileSize(calculationSize(file.getSize()));
|
|
||||||
fileInfo.setSavePath(path);
|
|
||||||
CaptinPhotoVersion versionInfo = new CaptinPhotoVersion();
|
|
||||||
BeanUtils.copyProperties(fileInfo, versionInfo);
|
|
||||||
versionInfo.setVersionNo(versionNo);
|
|
||||||
captionPhotoFileRepository.save(fileInfo);
|
|
||||||
captionPhotoVersionRepository.save(versionInfo);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -11,8 +11,6 @@ file.dir=C:\\faispUploadFiles
|
||||||
file.dir.vulnerable=/vulnerable
|
file.dir.vulnerable=/vulnerable
|
||||||
file.dir.part=/part
|
file.dir.part=/part
|
||||||
file.dir.equip=/equip
|
file.dir.equip=/equip
|
||||||
file.dir.sailor=sailor
|
|
||||||
file.dir.affair=affair
|
|
||||||
|
|
||||||
|
|
||||||
#thymeleaf
|
#thymeleaf
|
||||||
|
|
|
||||||
|
|
@ -149,10 +149,10 @@ function setUploadDiv(){
|
||||||
}
|
}
|
||||||
}).on('click', function (e){
|
}).on('click', function (e){
|
||||||
if(e.target.className.indexOf("ileDelete")<0){
|
if(e.target.className.indexOf("ileDelete")<0){
|
||||||
if(e.target.className.indexOf("artInfo")<0){
|
if(e.target.className.indexOf("artInfo")<0){
|
||||||
if(e.target.className.indexOf("artWork")<0){
|
if(e.target.className.indexOf("artWork")<0){
|
||||||
$("#fileInputer").click();
|
$("#fileInputer").click();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,4 @@
|
||||||
let selectedList = [];
|
let selectedList = [];
|
||||||
let fileList = [];
|
|
||||||
$(document).on('click', '#getFishingBoatEditModalBtn', function (){
|
$(document).on('click', '#getFishingBoatEditModalBtn', function (){
|
||||||
getFishingBoatEditModal(null);
|
getFishingBoatEditModal(null);
|
||||||
})
|
})
|
||||||
|
|
@ -136,22 +135,7 @@ $(document).on('change', '.pressurizedTimeTaken', function (){
|
||||||
$(document).on('change', '.warrantReqTake', function (){
|
$(document).on('change', '.warrantReqTake', function (){
|
||||||
$("#warrantReqTake").val($("#warrantReqTakeDate").val()+"일 "+$("#warrantReqTakeTime").val())
|
$("#warrantReqTake").val($("#warrantReqTakeDate").val()+"일 "+$("#warrantReqTakeTime").val())
|
||||||
})
|
})
|
||||||
$(document).on('click', '#captainPhoto', function (){
|
|
||||||
const fileDownloadDiv = $("#fileDownloadDiv")[0]
|
|
||||||
if(fileDownloadDiv.className==="d-none"){
|
|
||||||
fileDownloadDiv.className="";
|
|
||||||
}else{
|
|
||||||
fileDownloadDiv.className="d-none"
|
|
||||||
}
|
|
||||||
})
|
|
||||||
$(document).on('click', '.fileDownLink', function (){
|
|
||||||
const target = $(this)
|
|
||||||
let url = "/file/fileDownload?"
|
|
||||||
url += "board="+target.attr("data-board");
|
|
||||||
url += "&parentKey="+target.attr("data-parentkey");
|
|
||||||
url += "&fileSeq="+target.attr("data-fileseq");
|
|
||||||
window.open(encodeURI(url));
|
|
||||||
})
|
|
||||||
function getFishingBoatEditModal(cdsKey){
|
function getFishingBoatEditModal(cdsKey){
|
||||||
$.ajax({
|
$.ajax({
|
||||||
url: '/faStatistics/fishingBoatEditModal',
|
url: '/faStatistics/fishingBoatEditModal',
|
||||||
|
|
@ -184,8 +168,6 @@ function getFishingBoatEditModal(cdsKey){
|
||||||
$(".crackdownStatusInfo").attr("disabled", "disabled")
|
$(".crackdownStatusInfo").attr("disabled", "disabled")
|
||||||
$(".sailorInfo").attr("disabled", "disabled")
|
$(".sailorInfo").attr("disabled", "disabled")
|
||||||
$(".processResultInfo").attr("disabled", "disabled")
|
$(".processResultInfo").attr("disabled", "disabled")
|
||||||
}else{
|
|
||||||
setUploadDiv();
|
|
||||||
}
|
}
|
||||||
$("#fishingBoatEditModal").modal('show');
|
$("#fishingBoatEditModal").modal('show');
|
||||||
},
|
},
|
||||||
|
|
@ -237,10 +219,6 @@ function saveFishingBoatInfo(saveYn){
|
||||||
$("#saveYn").val(saveYn)
|
$("#saveYn").val(saveYn)
|
||||||
contentFade("in");
|
contentFade("in");
|
||||||
const formData = new FormData($("#fishingBoatEditForm")[0]);
|
const formData = new FormData($("#fishingBoatEditForm")[0]);
|
||||||
for(const file of files) {
|
|
||||||
if(!file.isDelete)
|
|
||||||
formData.append('uploadFiles', file, file.name);
|
|
||||||
}
|
|
||||||
$.each($(".violationCd"), function (idx, input){
|
$.each($(".violationCd"), function (idx, input){
|
||||||
formData.append('violationList['+idx+'].violation', $(input).val());
|
formData.append('violationList['+idx+'].violation', $(input).val());
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -246,25 +246,26 @@
|
||||||
<input type="text" class="form-control form-control-sm sailorInfo" id="note" th:value="${sailor.note}">
|
<input type="text" class="form-control form-control-sm sailorInfo" id="note" th:value="${sailor.note}">
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<th:block th:if="${crackdownStatus.cdsKey eq null}">
|
<div class="row mb-3">
|
||||||
<div class="row mb-3">
|
<label for="fileInputer" class="col-sm-2 col-form-label col-form-label-sm text-center">사진</label>
|
||||||
<label for="fileInputer" class="col-sm-2 col-form-label col-form-label-sm text-center">사진</label>
|
<div class="col-sm-10" style="min-height: 70px;">
|
||||||
<div class="col-sm-10" style="min-height: 70px;">
|
<div class="w-100 h-100 border border-info rounded text-center" id="uploadDiv">
|
||||||
<div class="w-100 h-100 border border-info rounded text-center" id="uploadDiv">
|
<br>사진을 업로드 해주세요.
|
||||||
<th:block th:if="${#arrays.isEmpty(sailor.fileList)}">
|
<!--
|
||||||
<br>사진을 업로드 해주세요.
|
<th:block th:if="${#arrays.isEmpty(affair.fileList)}">
|
||||||
</th:block>
|
<br>파일을 업로드 해주세요.
|
||||||
<th:block th:unless="${#arrays.isEmpty(sailor.fileList)}">
|
</th:block>
|
||||||
<div class='row-col-6' th:each="file:${sailor.fileList}">
|
<th:block th:unless="${#arrays.isEmpty(affair.fileList)}">
|
||||||
<span th:data-fileseq="${file.fileSeq}" th:text="|${file.origNm}.${file.fileExtn} ${file.fileSize}|"></span>
|
<div class='row-col-6' th:each="affairFile:${affair.fileList}">
|
||||||
<a href='#' class='uploadedFileDelete text-danger text-decoration-none'>삭제</a>
|
<span th:data-fileseq="${affairFile.fileSeq}" th:text="|${affairFile.origNm}.${affairFile.fileExtn} ${affairFile.fileSize}|"></span>
|
||||||
</div>
|
<a href='#' class='uploadedFileDelete text-danger text-decoration-none'>삭제</a>
|
||||||
</th:block>
|
</div>
|
||||||
</div>
|
</th:block>
|
||||||
|
-->
|
||||||
</div>
|
</div>
|
||||||
<input type="file" class="d-none sailorInfo" id="fileInputer" multiple>
|
|
||||||
</div>
|
</div>
|
||||||
</th:block>
|
<input type="file" class="d-none sailorInfo" id="fileInputer" multiple>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</th:block>
|
</th:block>
|
||||||
<th:block th:if="${sailor.position eq 'POS004'}">
|
<th:block th:if="${sailor.position eq 'POS004'}">
|
||||||
|
|
|
||||||
|
|
@ -76,33 +76,12 @@
|
||||||
<div class="col-6" id="captainDiv">
|
<div class="col-6" id="captainDiv">
|
||||||
<div class="row border border-secondary">
|
<div class="row border border-secondary">
|
||||||
<label class="col-sm-2 border-end border-secondary col-form-label col-form-label-sm py-2 border-end border-secondary text-center">선장명</label>
|
<label class="col-sm-2 border-end border-secondary col-form-label col-form-label-sm py-2 border-end border-secondary text-center">선장명</label>
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-10">
|
||||||
<div class="input-group w-auto">
|
<div class="input-group w-auto">
|
||||||
<input type="text" class="form-control form-control-sm border-0" readonly th:value="${sailor.sailorNameKr}">
|
<input type="text" class="form-control form-control-sm border-0" readonly th:value="${sailor.sailorNameKr}">
|
||||||
<input type="text" class="form-control form-control-sm border-0" readonly th:value="${sailor.sailorNameCn}">
|
<input type="text" class="form-control form-control-sm border-0" readonly th:value="${sailor.sailorNameCn}">
|
||||||
<input type="text" class="form-control form-control-sm border-0" readonly th:value="${sailor.sailorNamePinyin}">
|
<input type="text" class="form-control form-control-sm border-0" readonly th:value="${sailor.sailorNamePinyin}">
|
||||||
</div>
|
</div>
|
||||||
<th:block th:unless="${#lists.isEmpty(sailor.fileList)}">
|
|
||||||
<div id="fileDownloadDiv" class="d-none">
|
|
||||||
<div class="row justify-content-end">
|
|
||||||
<div class="col-auto">
|
|
||||||
<th:block th:each="file:${sailor.fileList}">
|
|
||||||
<a href="#" class="fileDownLink" data-board="sailor"
|
|
||||||
th:data-parentkey="${file.sailorKey}" th:data-fileseq="${file.fileSeq}" th:text="|${file.origNm}.${file.fileExtn}|"></a>
|
|
||||||
<br>
|
|
||||||
</th:block>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</th:block>
|
|
||||||
</div>
|
|
||||||
<div class="col-sm-2">
|
|
||||||
<th:block th:if="${#lists.isEmpty(sailor.fileList)}">
|
|
||||||
<div>사진 없음</div>
|
|
||||||
</th:block>
|
|
||||||
<th:block th:unless="${#lists.isEmpty(sailor.fileList)}">
|
|
||||||
<img id="captainPhoto" class="w-100" alt="선장 사진" th:src="|/file/fileDisplay?board=sailor&parentKey=${sailor.sailorKey}&fileSeq=1|">
|
|
||||||
</th:block>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="row border border-secondary border-top-0">
|
<div class="row border border-secondary border-top-0">
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue