|
|
|
@ -1,41 +1,32 @@
|
|
|
|
|
package cokr.xit.adds.biz.nims.service.bean;
|
|
|
|
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
import java.util.concurrent.CopyOnWriteArrayList;
|
|
|
|
|
|
|
|
|
|
import javax.validation.Validation;
|
|
|
|
|
import javax.validation.Validator;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
import org.springframework.web.multipart.MultipartFile;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.adds.biz.nims.dao.BizNimsMapper;
|
|
|
|
|
import cokr.xit.adds.biz.nims.model.BizNimsDto;
|
|
|
|
|
import cokr.xit.adds.biz.nims.model.BizNimsRequest;
|
|
|
|
|
import cokr.xit.adds.biz.nims.model.BizNimsResponse;
|
|
|
|
|
import cokr.xit.adds.biz.nims.service.BizNimsService;
|
|
|
|
|
import cokr.xit.adds.core.Constants;
|
|
|
|
|
import cokr.xit.adds.core.Constants.RPT_TY_CD;
|
|
|
|
|
import cokr.xit.adds.core.model.ApiBaseResponse;
|
|
|
|
|
import cokr.xit.adds.core.spring.exception.ApiCustomException;
|
|
|
|
|
import cokr.xit.adds.core.util.ApiUtil;
|
|
|
|
|
import cokr.xit.adds.inf.nims.model.NimsApiDto;
|
|
|
|
|
import cokr.xit.adds.inf.nims.model.NimsApiDto.BsshInfoSt;
|
|
|
|
|
import cokr.xit.adds.inf.nims.model.NimsApiRequest;
|
|
|
|
|
import cokr.xit.adds.inf.nims.model.NimsApiRequest.BsshInfoReq;
|
|
|
|
|
import cokr.xit.adds.inf.nims.model.NimsApiResult;
|
|
|
|
|
import cokr.xit.adds.inf.nims.service.InfNimsService;
|
|
|
|
|
import cokr.xit.base.file.FileInfo;
|
|
|
|
|
import cokr.xit.base.file.service.FileService;
|
|
|
|
|
import cokr.xit.base.file.web.FileInfoFactory;
|
|
|
|
|
import cokr.xit.foundation.component.AbstractServiceBean;
|
|
|
|
|
import lombok.RequiredArgsConstructor;
|
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
import java.util.*;
|
|
|
|
|
import java.util.concurrent.*;
|
|
|
|
|
|
|
|
|
|
import javax.validation.*;
|
|
|
|
|
|
|
|
|
|
import org.apache.commons.lang3.*;
|
|
|
|
|
import org.springframework.stereotype.*;
|
|
|
|
|
import org.springframework.web.multipart.*;
|
|
|
|
|
|
|
|
|
|
import cokr.xit.adds.biz.nims.dao.*;
|
|
|
|
|
import cokr.xit.adds.biz.nims.model.*;
|
|
|
|
|
import cokr.xit.adds.biz.nims.service.*;
|
|
|
|
|
import cokr.xit.adds.core.*;
|
|
|
|
|
import cokr.xit.adds.core.Constants.*;
|
|
|
|
|
import cokr.xit.adds.core.model.*;
|
|
|
|
|
import cokr.xit.adds.core.spring.exception.*;
|
|
|
|
|
import cokr.xit.adds.core.util.*;
|
|
|
|
|
import cokr.xit.adds.inf.nims.model.*;
|
|
|
|
|
import cokr.xit.adds.inf.nims.model.NimsApiDto.*;
|
|
|
|
|
import cokr.xit.adds.inf.nims.model.NimsApiRequest.*;
|
|
|
|
|
import cokr.xit.adds.inf.nims.service.*;
|
|
|
|
|
import cokr.xit.base.file.*;
|
|
|
|
|
import cokr.xit.base.file.service.*;
|
|
|
|
|
import cokr.xit.base.file.web.*;
|
|
|
|
|
import cokr.xit.foundation.component.*;
|
|
|
|
|
import lombok.*;
|
|
|
|
|
import lombok.extern.slf4j.*;
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <pre>
|
|
|
|
@ -86,10 +77,12 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
|
|
|
|
|
|
|
|
|
|
// DB 조회
|
|
|
|
|
List<BsshInfoSt> list = new ArrayList<>();
|
|
|
|
|
if("N".equals(reqDto.getDbSkipYn())) {
|
|
|
|
|
list = bizNimsMapper.selectBsshInfos(reqDto);
|
|
|
|
|
if (!isEmpty(list)) return list;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// FIXME: API 적용 - db 조회 skip
|
|
|
|
|
// if("N".equals(reqDto.getDbSkipYn())) {
|
|
|
|
|
// list = bizNimsMapper.selectBsshInfos(reqDto);
|
|
|
|
|
// if (!isEmpty(list)) return list;
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if(isEmpty(reqDto.getK())){
|
|
|
|
|
reqDto.setK(getApiInfInfo(reqDto.getUserId()).get("apiKey"));
|
|
|
|
@ -107,16 +100,23 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
|
|
|
|
|
if (isEmpty(curList))
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
for (BsshInfoSt d : curList) {
|
|
|
|
|
d.setRgtr(reqDto.getUserId());
|
|
|
|
|
bizNimsMapper.mergeBsshInfoSt(d);
|
|
|
|
|
// 대표자 검색조건이 있는 경우
|
|
|
|
|
if (isRprsntvNm && !isEmpty(d.getRprsntvNm()) && d.getRprsntvNm().contains(reqDto.getRprsntvNm())) {
|
|
|
|
|
list.add(d);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
// FIXME: API 적용 - db 저장 skip
|
|
|
|
|
// for (BsshInfoSt d : curList) {
|
|
|
|
|
// d.setRgtr(reqDto.getUserId());
|
|
|
|
|
// bizNimsMapper.mergeBsshInfoSt(d);
|
|
|
|
|
// // 대표자 검색조건이 있는 경우
|
|
|
|
|
// if (isRprsntvNm && !isEmpty(d.getRprsntvNm()) && d.getRprsntvNm().contains(reqDto.getRprsntvNm())) {
|
|
|
|
|
// list.add(d);
|
|
|
|
|
// }
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
if (!isRprsntvNm){
|
|
|
|
|
list.addAll(curList);
|
|
|
|
|
}else{
|
|
|
|
|
list.addAll(
|
|
|
|
|
curList.stream()
|
|
|
|
|
.filter(d -> !isEmpty(d.getRprsntvNm()) && d.getRprsntvNm().contains(reqDto.getRprsntvNm()))
|
|
|
|
|
.toList());
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if(rslt.isEndYn()) break;
|
|
|
|
@ -150,7 +150,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
|
|
|
|
|
List<NimsApiDto.ProductInfoKd> list = new ArrayList<>();
|
|
|
|
|
|
|
|
|
|
////////////////////////////////////////////////////////////////////////////////////////
|
|
|
|
|
// TODO: API 적용후 DB 조회 skip 처리
|
|
|
|
|
// FIXME: 신규 API 적용 - DB 조회 skip 처리
|
|
|
|
|
// if("N".equals(reqDto.getDbSkipYn())) {
|
|
|
|
|
// list = bizNimsMapper.selectProductInfos(reqDto);
|
|
|
|
|
// if (!isEmpty(list)){
|
|
|
|
@ -180,10 +180,11 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
|
|
|
|
|
|
|
|
|
|
if(isEmpty(curList)) break;
|
|
|
|
|
|
|
|
|
|
for (NimsApiDto.ProductInfoKd d : curList) {
|
|
|
|
|
d.setRgtr(reqDto.getUserId());
|
|
|
|
|
bizNimsMapper.mergeProductInfoKd(d);
|
|
|
|
|
}
|
|
|
|
|
// FIXME: 신규 API 적용 - 조회 결과 저장 skip
|
|
|
|
|
// for (NimsApiDto.ProductInfoKd d : curList) {
|
|
|
|
|
// d.setRgtr(reqDto.getUserId());
|
|
|
|
|
// bizNimsMapper.mergeProductInfoKd(d);
|
|
|
|
|
// }
|
|
|
|
|
|
|
|
|
|
// 제조 번호, 일련번호, 유효기간 정보 목록 추가
|
|
|
|
|
if(isMnfSeqInfo) productInfoaddMnfSeqs(curList, reqDto.getBc(), reqDto.getK());
|
|
|
|
@ -283,7 +284,7 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
|
|
|
|
|
* </pre>
|
|
|
|
|
*/
|
|
|
|
|
@Override
|
|
|
|
|
public BizNimsRequest.DsuseMgtReceiptReq saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq reqDto, final List<BizNimsDto.DsuseMgtDtl> dtls, final List<MultipartFile> files) {
|
|
|
|
|
public BizNimsRequest.DsuseMgtReceiptReq saveDsuseMgtReceipt(final BizNimsRequest.DsuseMgtReceiptReq reqDto, final List<BizNimsDto.DsuseMgtDtl> dtls, final List<MultipartFile> files, final NimsApiDto.BsshInfoSt bsshInfoSt, final List<NimsApiDto.ProductInfoKdSaveDTO> prdList) {
|
|
|
|
|
ApiUtil.validate(reqDto, null, validator);
|
|
|
|
|
if(reqDto.getRndDtlRptCnt() != dtls.size()) throw ApiCustomException.create("폐기물 보고수 오류[폐기물 갯수 확인]");
|
|
|
|
|
ApiUtil.validate(dtls, null, validator);
|
|
|
|
@ -291,6 +292,16 @@ public class BizNimsServiceBean extends AbstractServiceBean implements BizNimsSe
|
|
|
|
|
|
|
|
|
|
if(files.size() != dtls.size()) throw ApiCustomException.create("폐기물 파일 갯수 오류[파일 갯수 확인]");
|
|
|
|
|
|
|
|
|
|
// FIXME: 신규 API 적용 - 취급자 및 제품 정보 저장
|
|
|
|
|
bsshInfoSt.setRgtr(reqDto.getUserId());
|
|
|
|
|
bizNimsMapper.mergeBsshInfoSt(bsshInfoSt);
|
|
|
|
|
prdList.forEach(
|
|
|
|
|
d -> {
|
|
|
|
|
d.setRgtr(reqDto.getUserId());
|
|
|
|
|
bizNimsMapper.mergeProductInfoKd(d);
|
|
|
|
|
}
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
if(isEmpty(reqDto.getDscdmngId())) {
|
|
|
|
|
|
|
|
|
|
if (bizNimsMapper.insertDsuseMgtReceipt(reqDto) == 1) {
|
|
|
|
|