Merge branch 'main' of http://211.119.124.110:3000/xit-app/adds-fo.git into main
commit
36603d74fe
@ -1,248 +0,0 @@
|
|||||||
package cokr.xit.adds;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.Random;
|
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
|
||||||
|
|
||||||
import org.egovframe.rte.fdl.string.EgovStringUtil;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
import org.springframework.web.servlet.ModelAndView;
|
|
||||||
|
|
||||||
import cokr.xit.adds.cmmn.hwp.format.DisposeProcessDetails;
|
|
||||||
import cokr.xit.adds.cmmn.hwp.format.DisposeResultReport;
|
|
||||||
import cokr.xit.applib.Print;
|
|
||||||
import cokr.xit.applib.PrintOption;
|
|
||||||
import cokr.xit.base.file.FileInfo;
|
|
||||||
import cokr.xit.base.file.FileInfo.Relation;
|
|
||||||
import cokr.xit.base.file.service.FileQuery;
|
|
||||||
import cokr.xit.base.file.service.FileService;
|
|
||||||
import cokr.xit.foundation.data.DataObject;
|
|
||||||
import cokr.xit.foundation.web.AbstractController;
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
@RequestMapping(value="/doc")
|
|
||||||
public class DocController extends AbstractController {
|
|
||||||
|
|
||||||
@Resource(name="fileService")
|
|
||||||
FileService fileService;
|
|
||||||
|
|
||||||
@RequestMapping(value="/makeDisposeResultReportHwp.do")
|
|
||||||
public ModelAndView makeDisposeResultReportHwp(String dscdmngId) {
|
|
||||||
|
|
||||||
ModelAndView mav = new ModelAndView();
|
|
||||||
mav.setViewName("jsonView");
|
|
||||||
|
|
||||||
if(dscdmngId == null || dscdmngId.equals("")) {
|
|
||||||
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//출력일시,출력작업자
|
|
||||||
Print print = new Print();
|
|
||||||
print.setPrintRequestUserInfo(currentUser());
|
|
||||||
|
|
||||||
//개인정보표시여부,기관장 등
|
|
||||||
PrintOption printOption = new PrintOption();
|
|
||||||
Map<String,String> globalVariable = new HashMap<String,String>();
|
|
||||||
printOption.setGlobalVariable(globalVariable);
|
|
||||||
|
|
||||||
//상품 사진 갯수 체크
|
|
||||||
List<DataObject> totalProduct = fileService.getFileList(
|
|
||||||
new FileQuery().setInfoKeys(dscdmngId).setInfoType("100")
|
|
||||||
);
|
|
||||||
int totalProductCnt = 0;
|
|
||||||
if(totalProduct != null && !totalProduct.isEmpty()) {
|
|
||||||
totalProductCnt = totalProduct.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//샘플 데이터 생성
|
|
||||||
List<DataObject> dataobjectList = this.makeSample(dscdmngId,totalProductCnt);
|
|
||||||
|
|
||||||
for(DataObject data : dataobjectList) {
|
|
||||||
String infKey = data.string("dscdmngId");
|
|
||||||
String subType = data.string("dscdmngSn");
|
|
||||||
|
|
||||||
List<DataObject> fileinfo = fileService.getFileList(
|
|
||||||
new FileQuery().setInfoKeys(infKey).setInfoType("100").setBy("SUB_TYPE").setTerm(subType)
|
|
||||||
);
|
|
||||||
if(fileinfo == null || fileinfo.isEmpty()) {
|
|
||||||
data.put("filePath", "");
|
|
||||||
} else {
|
|
||||||
data.put("filePath", fileinfo.get(0).string("FILE_PATH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DisposeResultReport form = new DisposeResultReport(print, printOption, dataobjectList);
|
|
||||||
String resultFilePath = form.makeFile().andGetPath();
|
|
||||||
|
|
||||||
File file = new File(resultFilePath);
|
|
||||||
Relation rel = new Relation().setInfoType("200").setSubType("01").setInfoKey(dscdmngId);
|
|
||||||
FileInfo fileInfo = new FileInfo.Factory().create(rel, file);
|
|
||||||
fileInfo.setName(print.getFormatKorName()+".hwp");
|
|
||||||
int effected= fileService.create(fileInfo);
|
|
||||||
String fileId = fileInfo.getId();
|
|
||||||
file.delete();
|
|
||||||
|
|
||||||
mav.addObject("fileId",fileId);
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@RequestMapping(value="/makeDisposeProcessDetailsHwp.do")
|
|
||||||
public ModelAndView makeDisposeProcessDetailsHwp(String dscdmngId) {
|
|
||||||
|
|
||||||
ModelAndView mav = new ModelAndView();
|
|
||||||
mav.setViewName("jsonView");
|
|
||||||
|
|
||||||
if(dscdmngId == null || dscdmngId.equals("")) {
|
|
||||||
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
//출력일시,출력작업자
|
|
||||||
Print print = new Print();
|
|
||||||
print.setPrintRequestUserInfo(currentUser());
|
|
||||||
|
|
||||||
//개인정보표시여부,기관장 등
|
|
||||||
PrintOption printOption = new PrintOption();
|
|
||||||
Map<String,String> globalVariable = new HashMap<String,String>();
|
|
||||||
printOption.setGlobalVariable(globalVariable);
|
|
||||||
|
|
||||||
//폐기증거사진
|
|
||||||
List<DataObject> dsuseimgs = fileService.getFileList(
|
|
||||||
new FileQuery().setInfoType("110").setInfoKeys(dscdmngId)
|
|
||||||
);
|
|
||||||
List<String> dataobjectList2 = new ArrayList<>();
|
|
||||||
for(DataObject dsuseimg : dsuseimgs) {
|
|
||||||
dataobjectList2.add(dsuseimg.string("FILE_PATH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
//상품사진갯수 체크
|
|
||||||
List<DataObject> totalProduct = fileService.getFileList(
|
|
||||||
new FileQuery().setInfoKeys(dscdmngId).setInfoType("100").setOrderBy("SUB_TYPE")
|
|
||||||
);
|
|
||||||
int totalProductCnt = 0;
|
|
||||||
if(totalProduct != null && !totalProduct.isEmpty()) {
|
|
||||||
totalProductCnt = totalProduct.size();
|
|
||||||
}
|
|
||||||
|
|
||||||
//샘플 데이터 생성
|
|
||||||
List<DataObject> dataobjectList = this.makeSample(dscdmngId,totalProductCnt);
|
|
||||||
|
|
||||||
for(DataObject data : dataobjectList) {
|
|
||||||
String infKey = data.string("dscdmngId");
|
|
||||||
String subType = data.string("dscdmngSn");
|
|
||||||
|
|
||||||
List<DataObject> fileinfo = fileService.getFileList(
|
|
||||||
new FileQuery().setInfoKeys(infKey).setInfoType("100").setBy("SUB_TYPE").setTerm(subType)
|
|
||||||
);
|
|
||||||
if(fileinfo == null || fileinfo.isEmpty()) {
|
|
||||||
data.put("filePath", "");
|
|
||||||
} else {
|
|
||||||
data.put("filePath", fileinfo.get(0).string("FILE_PATH"));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
DisposeProcessDetails form = new DisposeProcessDetails(print, printOption, dataobjectList, dataobjectList2);
|
|
||||||
String resultFilePath = form.makeFile().andGetPath();
|
|
||||||
|
|
||||||
File file = new File(resultFilePath);
|
|
||||||
Relation rel = new Relation().setInfoType("200").setSubType("02").setInfoKey(dscdmngId);
|
|
||||||
FileInfo fileInfo = new FileInfo.Factory().create(rel, file);
|
|
||||||
fileInfo.setName(print.getFormatKorName()+".hwp");
|
|
||||||
int effected= fileService.create(fileInfo);
|
|
||||||
String fileId = fileInfo.getId();
|
|
||||||
file.delete();
|
|
||||||
|
|
||||||
mav.addObject("fileId",fileId);
|
|
||||||
return mav;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public List<DataObject> makeSample(String dscdmngId, int totalProductCnt){
|
|
||||||
List<DataObject> dataobjectList = new ArrayList<DataObject>();
|
|
||||||
|
|
||||||
for(int i=0; i<totalProductCnt; i++) {
|
|
||||||
|
|
||||||
DataObject newObj = this.getRandomObj();
|
|
||||||
newObj.set("dscdmngId", dscdmngId);
|
|
||||||
newObj.set("dscdmngSn", EgovStringUtil.lPad(""+(i+1), 3, '0'));
|
|
||||||
|
|
||||||
dataobjectList.add(newObj);
|
|
||||||
}
|
|
||||||
return dataobjectList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataObject getRandomObj() {
|
|
||||||
|
|
||||||
DataObject[] items = {
|
|
||||||
new DataObject()
|
|
||||||
.set("bsshNm", "메디칼약국")
|
|
||||||
.set("indutyNm", "마약류취급소매업자")
|
|
||||||
.set("bsshCd", "D04343033")
|
|
||||||
.set("dsuseDe", "20240501")
|
|
||||||
.set("dsuseSeCdNm", "공무원임회") //ADDS03
|
|
||||||
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
|
|
||||||
.set("dsuseLoc", "수지구보건소 검사실")
|
|
||||||
.set("dsuseMthCdNm", "가수분해") //ADDS05
|
|
||||||
.set("nrcdSeNm", "마약")
|
|
||||||
.set("prductNm", "자낙스정0.5mg")
|
|
||||||
.set("prductCd", "08806489012648")
|
|
||||||
.set("minDistbQy", "30")
|
|
||||||
.set("stdPackngStleNm", "정")
|
|
||||||
.set("mnfNo", "FJ6892")
|
|
||||||
.set("prdValidDe", "20240323")
|
|
||||||
.set("pceQy", "2")
|
|
||||||
.set("pceCoUnitNm", "정"),
|
|
||||||
new DataObject()
|
|
||||||
.set("bsshNm", "메디칼약국")
|
|
||||||
.set("indutyNm", "마약류취급소매업자")
|
|
||||||
.set("bsshCd", "D04343033")
|
|
||||||
.set("dsuseDe", "20240501")
|
|
||||||
.set("dsuseSeCdNm", "공무원임회") //ADDS03
|
|
||||||
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
|
|
||||||
.set("dsuseLoc", "수지구보건소 검사실")
|
|
||||||
.set("dsuseMthCdNm", "가수분해") //ADDS05
|
|
||||||
.set("nrcdSeNm", "마약")
|
|
||||||
.set("prductNm", "아쿠아폴주")
|
|
||||||
.set("prductCd", "08806489012648")
|
|
||||||
.set("minDistbQy", "30")
|
|
||||||
.set("stdPackngStleNm", "정")
|
|
||||||
.set("mnfNo", "FJ6892")
|
|
||||||
.set("prdValidDe", "20240323")
|
|
||||||
.set("pceQy", "2")
|
|
||||||
.set("pceCoUnitNm", "정"),
|
|
||||||
new DataObject()
|
|
||||||
.set("bsshNm", "메디칼약국")
|
|
||||||
.set("indutyNm", "마약류취급소매업자")
|
|
||||||
.set("bsshCd", "D04343033")
|
|
||||||
.set("dsuseDe", "20240501")
|
|
||||||
.set("dsuseSeCdNm", "공무원임회") //ADDS03
|
|
||||||
.set("dsusePrvCdNm", "유효기간경과") //ADDS04
|
|
||||||
.set("dsuseLoc", "수지구보건소 검사실")
|
|
||||||
.set("dsuseMthCdNm", "가수분해") //ADDS05
|
|
||||||
.set("nrcdSeNm", "마약")
|
|
||||||
.set("prductNm", "베리콜시럽")
|
|
||||||
.set("prductCd", "08806489012648")
|
|
||||||
.set("minDistbQy", "30")
|
|
||||||
.set("stdPackngStleNm", "정")
|
|
||||||
.set("mnfNo", "FJ6892")
|
|
||||||
.set("prdValidDe", "20240323")
|
|
||||||
.set("pceQy", "2")
|
|
||||||
.set("pceCoUnitNm", "정")
|
|
||||||
};
|
|
||||||
Random rand = new Random();
|
|
||||||
return items[rand.nextInt(3)];
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
Binary file not shown.
Loading…
Reference in New Issue