2022-09-20 05:35:50 +00:00
|
|
|
package com.dbnt.faisp.equip;
|
|
|
|
|
|
|
|
|
|
import com.dbnt.faisp.authMgt.service.AuthMgtService;
|
|
|
|
|
import com.dbnt.faisp.equip.model.Equip;
|
|
|
|
|
import com.dbnt.faisp.equip.service.EquipService;
|
|
|
|
|
import com.dbnt.faisp.organMgt.service.OrganConfigService;
|
|
|
|
|
import com.dbnt.faisp.translator.model.Translator;
|
|
|
|
|
import com.dbnt.faisp.translator.model.TranslatorCrr;
|
|
|
|
|
import com.dbnt.faisp.translator.service.TranslatorService;
|
|
|
|
|
import com.dbnt.faisp.userInfo.model.UserInfo;
|
|
|
|
|
import com.dbnt.faisp.util.ParamMap;
|
|
|
|
|
import com.dbnt.faisp.util.Utils;
|
|
|
|
|
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
|
2022-09-26 00:38:58 +00:00
|
|
|
import java.io.BufferedOutputStream;
|
|
|
|
|
import java.io.File;
|
|
|
|
|
import java.io.FileInputStream;
|
2022-09-20 05:35:50 +00:00
|
|
|
import java.io.IOException;
|
2022-09-26 00:38:58 +00:00
|
|
|
import java.io.InputStream;
|
2022-09-20 05:35:50 +00:00
|
|
|
import java.time.LocalDateTime;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
|
|
|
|
import org.springframework.security.core.annotation.AuthenticationPrincipal;
|
|
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|
|
|
|
import org.springframework.web.servlet.ModelAndView;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RestController
|
|
|
|
|
@RequiredArgsConstructor
|
|
|
|
|
@RequestMapping("/equip")
|
|
|
|
|
public class EquipController {
|
|
|
|
|
|
|
|
|
|
private final AuthMgtService authMgtService;
|
|
|
|
|
private final TranslatorService translatorSevice;
|
|
|
|
|
private final OrganConfigService organConfigService;
|
|
|
|
|
private final EquipService equipService;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/equipStatus")
|
2022-09-20 08:56:48 +00:00
|
|
|
public ModelAndView equipStatus(Equip equip) {
|
2022-09-20 05:35:50 +00:00
|
|
|
ModelAndView mav = new ModelAndView("equip/equipStatus");
|
2022-09-20 08:56:48 +00:00
|
|
|
mav.addObject("equipList", equipService.selectEquipStatus(equip));
|
2022-09-20 05:35:50 +00:00
|
|
|
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/equipEditModal")
|
|
|
|
|
public ModelAndView equipEditModal() {
|
|
|
|
|
ModelAndView mav = new ModelAndView("equip/equipEditModal");
|
|
|
|
|
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@GetMapping("/equipTypeSelecBox")
|
|
|
|
|
public ModelAndView equipTypeSelecBox(String equType) {
|
|
|
|
|
System.out.println("@@"+equType);
|
|
|
|
|
ModelAndView mav = new ModelAndView("equip/equipTypeSelecBox");
|
|
|
|
|
mav.addObject("equType", equType);
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/saveEquip")
|
|
|
|
|
public void saveEquip(@AuthenticationPrincipal UserInfo loginUser,Equip equip, MultipartHttpServletRequest request){
|
|
|
|
|
equip.setWrtNm(loginUser.getUserId());
|
|
|
|
|
equip.setMgtOrgan(loginUser.getOgCd());
|
|
|
|
|
equip.setWrtOrgan(loginUser.getOgCd());
|
|
|
|
|
equip.setWrtDt(LocalDateTime.now());
|
|
|
|
|
equipService.saveEquip(equip,request);
|
|
|
|
|
}
|
|
|
|
|
|
2022-09-21 08:51:28 +00:00
|
|
|
@GetMapping("/List")
|
|
|
|
|
public ModelAndView equipList(@AuthenticationPrincipal UserInfo loginUser,Equip equip) {
|
|
|
|
|
ModelAndView mav = new ModelAndView("equip/equipList");
|
|
|
|
|
equip.setDownOrganCdList(loginUser.getDownOrganCdList());
|
|
|
|
|
ParamMap equType = equipService.selectEduType(equip);
|
|
|
|
|
mav.addObject("equType", equType.get("equ_type"));
|
|
|
|
|
mav.addObject("detailType", equType.get("detail_type"));
|
|
|
|
|
equip.setQueryInfo();
|
|
|
|
|
mav.addObject("equipList", equipService.selectEquipList(equip));
|
|
|
|
|
equip.setContentCnt(equipService.selectEquipListCnt(equip));
|
|
|
|
|
equip.setPaginationInfo();
|
|
|
|
|
mav.addObject("searchParams", equip);
|
|
|
|
|
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/updatePage")
|
|
|
|
|
public ModelAndView equipUpdatePage(Equip equip) {
|
|
|
|
|
ModelAndView mav = new ModelAndView("equip/equipModifyModal");
|
|
|
|
|
mav.addObject("equInfo", equipService.selectEquipInfo(equip));
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/updateEquip")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public int updateEquip(@AuthenticationPrincipal UserInfo loginUser,Equip equip, MultipartHttpServletRequest request){
|
|
|
|
|
System.out.println("equip@"+equip);
|
|
|
|
|
equip.setWrtNm(loginUser.getUserId());
|
|
|
|
|
equip.setMgtOrgan(loginUser.getOgCd());
|
|
|
|
|
equip.setWrtOrgan(loginUser.getOgCd());
|
|
|
|
|
equip.setWrtDt(LocalDateTime.now());
|
|
|
|
|
int result = equipService.updateEquip(equip,request);
|
|
|
|
|
return result;
|
2022-09-26 00:38:58 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/historyView")
|
|
|
|
|
public ModelAndView historyView(Equip equip) {
|
|
|
|
|
ModelAndView mav = new ModelAndView("equip/equipHistory");
|
|
|
|
|
mav.addObject("equList", equipService.selectHistoryView(equip));
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/HistoryDetail")
|
|
|
|
|
@ResponseBody
|
|
|
|
|
public Equip HistoryDetail(Equip equip){
|
|
|
|
|
return equipService.selectHistoryDetail(equip);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@PostMapping("/epuipDelete")
|
|
|
|
|
public void epuipDelete(@RequestBody List<Equip> equip){
|
|
|
|
|
equipService.equipDelete(equip);
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
@GetMapping("/getEquipImg")
|
|
|
|
|
public void getThumbImage(Equip equip , HttpServletResponse response) throws Exception {
|
|
|
|
|
|
|
|
|
|
Equip dbImg = equipService.selectEquipInfo(equip);
|
|
|
|
|
|
|
|
|
|
String realFile = dbImg.getFilePath()+"/"+ dbImg.getConvNm();
|
|
|
|
|
String fileNm = dbImg.getConvNm();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
BufferedOutputStream out = null;
|
|
|
|
|
InputStream in = null;
|
|
|
|
|
|
|
|
|
|
try {
|
|
|
|
|
response.setContentType("image/jpeg;charset=UTF-8");
|
|
|
|
|
response.setHeader("Content-Disposition", "inline;filename=" + fileNm);
|
|
|
|
|
File file = new File(realFile);
|
|
|
|
|
// File file = new File(realFile + "/" + fileNm);
|
|
|
|
|
if(file.exists()){
|
|
|
|
|
in = new FileInputStream(file);
|
|
|
|
|
out = new BufferedOutputStream(response.getOutputStream());
|
|
|
|
|
int len;
|
|
|
|
|
byte[] buf = new byte[1024];
|
|
|
|
|
while ((len = in.read(buf)) > 0) {
|
|
|
|
|
out.write(buf, 0, len);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
} catch (Exception e) {
|
|
|
|
|
|
|
|
|
|
} finally {
|
|
|
|
|
if(out != null){ out.flush(); }
|
|
|
|
|
if(out != null){ out.close(); }
|
|
|
|
|
if(in != null){ in.close(); }
|
|
|
|
|
}
|
|
|
|
|
}
|
2022-09-21 08:51:28 +00:00
|
|
|
|
2022-09-20 05:35:50 +00:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|