소스 정리

main
mjkhan21 10 months ago
parent eea5d35102
commit f6174ea206

@ -27,4 +27,9 @@ public interface CrdnInstMapper extends AbstractMapper {
* @return
*/
int insertCrdnAddition(Crdn crdn);
default boolean insert(Crdn crdn) {
return insertCrdn(crdn) == 1
&& insertCrdnAddition(crdn) == 1;
}
}

@ -23,18 +23,34 @@ public interface ExmptnVhclMapper extends AbstractMapper {
*/
DataObject selectExemptionVehicleInfo(String exemptionVehicleId);
default boolean insert(ExmptnVhcl exmptnVhcl) {
return insertExemptionVehicleInfo(exmptnVhcl) == 1
&& insertExemptionVehicleHistory(exmptnVhcl) == 1;
}
/** .
* @param exmptnVhcl
* return
*/
int insertExemptionVehicleInfo(ExmptnVhcl exmptnVhcl);
default boolean update(ExmptnVhcl exmptnVhcl) {
return updateExemptionVehicleInfo(exmptnVhcl) == 1
&& insertExemptionVehicleHistory(exmptnVhcl) == 1;
}
/** .
* @param exmptnVhcl
* return
*/
int updateExemptionVehicleInfo(ExmptnVhcl exmptnVhcl);
default boolean delete(ExmptnVhcl exmptnVhcl) {
exmptnVhcl.setRemovedBy(currentUser().getId());
return deleteExemptionVehicleInfo(exmptnVhcl) == 1
&& insertExemptionVehicleHistory(exmptnVhcl) == 1;
}
/** .
* @param exmptnVhcl
* return

@ -5,13 +5,11 @@ import java.nio.file.Files;
import java.nio.file.Path;
import java.nio.file.Paths;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import java.util.stream.Stream;
import javax.annotation.Resource;
@ -70,7 +68,7 @@ public class CrdnBean extends AbstractBean {
crdn.setAdvntceAmt(basicAmt[1]);
//단속팀 정보 갱신
if(!isEmpty(crdn.getTeamId())) {
if (!isEmpty(crdn.getTeamId())) {
DataObject teamInfo = crdnTeamMapper.selectTeamInfo(crdn.getTeamId());
Team team = new Team();
@ -87,8 +85,8 @@ public class CrdnBean extends AbstractBean {
}
//상태코드 설정
if(isEmpty(crdn.getCrdnSttsCd())){ //상태코드가 없을경우
if("Y".equals(crdn.getCvlcptLinkYn())) { //민원연계자료일 경우
if (isEmpty(crdn.getCrdnSttsCd())){ //상태코드가 없을경우
if ("Y".equals(crdn.getCvlcptLinkYn())) { //민원연계자료일 경우
crdn.setCrdnSttsCd("01"); //초기상태
} else { //민원연계자료가 아닐 경우
crdn.setCrdnSttsCd(isEmpty(crdn.getRtpyrId()) ? "01" : "21"); // 01: 초기상태 21: 납부자등록완료
@ -97,14 +95,14 @@ public class CrdnBean extends AbstractBean {
}
//단속 대장 등록
boolean result = this.createLedger(crdn);
boolean result = createLedger(crdn);
if (!result)
throw new RuntimeException("단속자료 등록 중 단속자료 등록에 실패하였습니다.");
String today = new SimpleDateFormat("yyyyMMdd").format(new Date());
String taskDtlId = crdn.getCrdnId();
if(crdn.getCrdnSttsCd().equals("83")) {
if (crdn.getCrdnSttsCd().equals("83")) {
// 부과제외(TB_LEVY_EXCL) 대장 등록
LevyExcl excl01 = new LevyExcl();
excl01.setCrdnId(crdn.getCrdnId());
@ -135,7 +133,7 @@ public class CrdnBean extends AbstractBean {
throw new RuntimeException("단속자료 등록 중 단속상태 이력 등록에 실패하였습니다.");
//단속납부자이력(TB_CRDN_PAYER_HSTRY) 대장 등록
if(!isEmpty(crdn.getRtpyrId())) {
if (!isEmpty(crdn.getRtpyrId())) {
CrdnPayerAddrHstry crdnPayerAddrHstry = new CrdnPayerAddrHstry();
crdnPayerAddrHstry.setCrdnId(crdn.getCrdnId());
crdnPayerAddrHstry.setRtpyrId(crdn.getRtpyrId());
@ -143,15 +141,15 @@ public class CrdnBean extends AbstractBean {
// 단속 대장의 납부자ID 수정 및 단속 납부자 이력(TB_CRDN_PAYER_HSTRY) 대장에 등록한다.
int affected = crdnPayerAddrHstryBean.createCrdnPayerAddrHstry(crdnPayerAddrHstry);
if(affected != 1)
if (affected != 1)
throw new RuntimeException("단속자료 등록 중 단속 납부자주소 이력 등록에 실패하였습니다.");
}
//파일 등록
if(!isEmpty(fileInfoList)) {
if (!isEmpty(fileInfoList)) {
fileInfoList.forEach(fileInfo -> fileInfo.setInfoType(Crdn.INF_TYPE).setInfoKey(crdn.getCrdnId()));
int affected = fileBean.create(fileInfoList);
if(affected == 0)
if (affected == 0)
throw new RuntimeException("단속자료 등록 중 파일 등록에 실패하였습니다.");
}
@ -166,8 +164,7 @@ public class CrdnBean extends AbstractBean {
* </ul>
*/
public boolean createLedger(Crdn crdn) {
return crdnInstMapper.insertCrdn(crdn) == 1
&& crdnInstMapper.insertCrdnAddition(crdn) == 1;
return crdnInstMapper.insert(crdn);
}
/** .
@ -178,14 +175,11 @@ public class CrdnBean extends AbstractBean {
* </ul>
*/
public boolean remove(String... crdnIds) {
if (isEmpty(crdnIds)) return false;
Map<String, Object> paramMap = new HashMap<String, Object>();
List<String> crdnIdList = Arrays.asList(crdnIds);
paramMap.put("crdnIds", crdnIdList);
paramMap.put("removedBy", UserInfo.current().getId());
return crdnUpdtMapper.deleteCrdn(paramMap) >= 1;
return !isEmpty(crdnIds)
&& crdnUpdtMapper.deleteCrdn(new DataObject()
.set("crdnIds", crdnIds)
.set("removedBy", UserInfo.current().getId())
) >= 1;
}
/** .
@ -330,24 +324,18 @@ public class CrdnBean extends AbstractBean {
* @return
*/
public boolean removeEquipmentLinkFile(String workPath, String fileName) {
boolean saved = false;
try {
Stream<Path> walk = Files.walk(Paths.get(workPath));
List<String> deleteFilePaths = new ArrayList<String>();
try (Stream<Path> walk = Files.walk(Paths.get(workPath));) {
List<String> deleteFilePaths = walk.filter(Files::isRegularFile)
.filter(p -> p.toFile().getName().equalsIgnoreCase(fileName))
.map(item -> item.toFile().getPath())
.toList();
walk.filter(Files::isRegularFile)
.filter(p -> p.toFile().getName().equalsIgnoreCase(fileName))
.collect(Collectors.toList())
.forEach(item -> deleteFilePaths.add(item.toFile().getPath()));
for(String deleteFilePath : deleteFilePaths) {
saved = (new File(deleteFilePath)).delete();
}
boolean saved = false;
for (String deleteFilePath : deleteFilePaths)
saved = new File(deleteFilePath).delete();
//빈 디렉토리 삭제
CmmnUtil.deleteEmptyDir(new File(workPath), false);
walk.close();
return saved;
} catch (Exception e) {

@ -47,25 +47,11 @@ public class CrdnStngBean extends AbstractBean {
* @return
*/
public int getBalance(String state, int advntceAmt, int ffnlgAmt, int minusAmt, int adtnAmt, int rcvmtAmt) {
if (toInt(state) < toInt("51")) {
return advntceAmt - rcvmtAmt - minusAmt;
} else if (state.equals("71")
|| state.equals("72")
|| state.equals("73")
|| state.equals("74")
|| state.equals("75")
|| state.equals("76")
|| state.equals("80")
|| state.equals("81")
|| state.equals("82")
|| state.equals("83")
|| state.equals("84")
|| state.equals("85")
) {
return 0;
} else {
return ffnlgAmt - rcvmtAmt - minusAmt + adtnAmt;
}
return toInt(state) < toInt("51") ? advntceAmt - rcvmtAmt - minusAmt :
switch (state) {
case "71", "72", "73", "74", "75", "76", "80", "81", "82", "83", "84", "85" -> 0;
default -> ffnlgAmt - rcvmtAmt - minusAmt + adtnAmt;
};
}
/** .
@ -84,13 +70,8 @@ public class CrdnStngBean extends AbstractBean {
int len = vhrno.length();
if (len >= 7) {
String fifthFromLast = vhrno.substring(len-5, len-4);
if (fifthFromLast.equals("하")
|| fifthFromLast.equals("허")
|| fifthFromLast.equals("호")
|| fifthFromLast.equals("후")) {
if ("하허호후".contains(fifthFromLast))
return true;
}
}
return false;
@ -131,17 +112,14 @@ public class CrdnStngBean extends AbstractBean {
if (!isEmpty(getHeavyEquipmentCarkind(vhrno)))
return "중기";
if (vhrno.contains("외교"))
return "외교";
if (vhrno.contains("준외"))
return "준외";
if (vhrno.contains("영사"))
return "영사";
if (vhrno.contains("준영"))
return "준영";
if (vhrno.contains("국기") || vhrno.contains("협정") || vhrno.contains("대표") || vhrno.contains("외빈"))
return "국제";
for (String str: new String[] {"외교", "준외", "영사", "준영"}) {
if (vhrno.contains(str))
return str;
}
for (String str: new String[] {"국기", "협정", "대표", "외빈"}) {
if (vhrno.contains(str))
return "국제";
}
if (vhrno.substring(0,1).equals("임"))
return "임시";
@ -283,22 +261,12 @@ public class CrdnStngBean extends AbstractBean {
DataObject teamInfo = crdnTeamMapper.selectTeamInfoByName(team);
if (teamInfo != null) {
boolean differ = false;
if (!ifEmpty(team.getCrdnSeCd(), () -> "").equals(teamInfo.string("CRDN_SE_CD"))) {
differ = true;
}
if (!ifEmpty(team.getTeamer1(), () -> "").equals(teamInfo.string("TEAMER_1"))) {
differ = true;
}
if (!ifEmpty(team.getTeamer2(), () -> "").equals(teamInfo.string("TEAMER_2"))) {
differ = true;
}
if (!ifEmpty(team.getTeamer3(), () -> "").equals(teamInfo.string("TEAMER_3"))) {
differ = true;
}
if (!ifEmpty(team.getTeamer4(), () -> "").equals(teamInfo.string("TEAMER_4"))) {
differ = true;
}
boolean differ =
!equals(team.getCrdnSeCd(), teamInfo.string("CRDN_SE_CD"))
|| !equals(team.getTeamer1(), teamInfo.string("TEAMER_1"))
|| !equals(team.getTeamer2(), teamInfo.string("TEAMER_2"))
|| !equals(team.getTeamer3(), teamInfo.string("TEAMER_3"))
|| !equals(team.getTeamer4(), teamInfo.string("TEAMER_4"));
if (differ) {
Team del = new Team();
@ -352,11 +320,7 @@ public class CrdnStngBean extends AbstractBean {
* </ul>
*/
public boolean createExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) {
if (exmptnVhclMapper.insertExemptionVehicleInfo(exmptnVhcl) != 1) {
return false;
}
return exmptnVhclMapper.insertExemptionVehicleHistory(exmptnVhcl) == 1;
return exmptnVhclMapper.insert(exmptnVhcl);
}
/** .
@ -367,11 +331,7 @@ public class CrdnStngBean extends AbstractBean {
* </ul>
*/
public boolean updateExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) {
if (exmptnVhclMapper.updateExemptionVehicleInfo(exmptnVhcl) != 1) {
return false;
}
return exmptnVhclMapper.insertExemptionVehicleHistory(exmptnVhcl) == 1;
return exmptnVhclMapper.update(exmptnVhcl);
}
/** .
@ -382,12 +342,7 @@ public class CrdnStngBean extends AbstractBean {
* </ul>
*/
public boolean removeExemptionVehicleInfo(ExmptnVhcl exmptnVhcl) {
exmptnVhcl.setRemovedBy(currentUser().getId());
if (exmptnVhclMapper.deleteExemptionVehicleInfo(exmptnVhcl) != 1) {
return false;
}
return exmptnVhclMapper.insertExemptionVehicleHistory(exmptnVhcl) == 1;
return exmptnVhclMapper.delete(exmptnVhcl);
}
public List<DataObject> getExemptionVehicleHistoryList(String exmptnVhclId) {

@ -96,24 +96,28 @@ public class CrdnReRegBean extends AbstractBean {
DataObject crdnInfo = crdnReRegMapper.selectCrdnInfo(crdnReReg.getBfrCrdnId());
// 단속 ID로 파일(TB_FILE) 정보 조회
List<DataObject> crdnFileList = fileBean.getFileList(new FileQuery().setInfoType(CrdnReReg.INF_TYPE)
.setInfoKeys(crdnReReg.getBfrCrdnId()));
List<DataObject> crdnFileList = fileBean.getFileList(
new FileQuery()
.setInfoType(CrdnReReg.INF_TYPE)
.setInfoKeys(crdnReReg.getBfrCrdnId())
);
// 재등록 단속 파일 정보(TB_FILE)
List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
if (!crdnFileList.isEmpty() && crdnFileList.size() > 0) {
if (!isEmpty(crdnFileList)) {
List<File> files = new ArrayList<>();
for (int iLoop = 0; iLoop < crdnFileList.size(); iLoop++) {
files.add(new File(crdnFileList.get(iLoop).string("FILE_PATH")));
for (int i = 0; i < crdnFileList.size(); i++) {
DataObject row = crdnFileList.get(i);
files.add(new File(row.string("FILE_PATH")));
}
fileInfoList = new FileInfoFactory().createFileInfos(null, files);
// 원본 파일명
for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) {
fileInfoList.get(iLoop).setName(crdnFileList.get(iLoop).string("FILE_NM"));
for (int i = 0; i < fileInfoList.size(); i++) {
fileInfoList.get(i).setName(crdnFileList.get(i).string("FILE_NM"));
}
}
@ -167,20 +171,17 @@ public class CrdnReRegBean extends AbstractBean {
// 단속 대장 입력
boolean rtnScs = crdnBean.create(null, crdn, fileInfoList);
if (!rtnScs) {
if (!rtnScs)
throw new RuntimeException("재부과 등록 중 단속대장 등록에 실패하였습니다."); // 예외를 발생시켜서 DB Rollback
}
// 재부과 대장 등록
crdnReReg.setCrdnId(crdn.getCrdnId());
crdnReReg.setCrdnRegSeCd("03");
int rtnNocs = crdnReRegMapper.insertCrdnReReg(crdnReReg);
if (rtnNocs != 1) {
if (rtnNocs != 1)
throw new RuntimeException("재부과 대장 등록에 실패하였습니다."); // 예외를 발생시켜서 DB Rollback
}
return "[S] 작업이 정상 처리 되었습니다.";
}
}
}

@ -14,6 +14,8 @@ import org.springframework.web.servlet.ModelAndView;
import cokr.xit.base.code.CommonCode;
import cokr.xit.base.web.ApplicationController;
import cokr.xit.fims.FimsConf;
import cokr.xit.fims.crdn.CrdnQuery;
import cokr.xit.fims.crdn.service.CrdnStngService;
import cokr.xit.fims.payer.Payer;
import cokr.xit.fims.payer.PayerQuery;
import cokr.xit.fims.payer.service.PayerService;
@ -54,6 +56,8 @@ public class PayerController extends ApplicationController {
/**납부자 서비스*/
@Resource(name = "payerService")
private PayerService payerService;
@Resource(name = "crdnStngService")
private CrdnStngService crdnStngService;
/** (payer/payer-main) .
* {@link #getPayerList(PayerQuery) } .
@ -120,29 +124,39 @@ public class PayerController extends ApplicationController {
public ModelAndView getVehicleOwner(HttpServletRequest hreq) {
Payer payer = null;
String sggCd = ifEmpty(hreq.getParameter("sggCd"), currentUser()::getOrgID);
String levy_stdde = hreq.getParameter("levy_stdde");
String vhrno = hreq.getParameter("vhrno");
String vin = hreq.getParameter("vin");
//행공센 연계 여부
if(ifEmpty(FimsConf.get().getPublicInfoCarYn(),() -> "Y").equals("Y")) {
BasicInfoExtRequest req = new BasicInfoExtRequest();
req.setInqire_se_code(hreq.getParameter("inqire_se_code"));
req.setLevy_stdde(hreq.getParameter("levy_stdde"));
req.setVhrno(hreq.getParameter("vhrno"));
req.setVin(hreq.getParameter("vin"));
req.setLevy_stdde(levy_stdde);
req.setVhrno(vhrno);
req.setVin(vin);
payer = payerService.findVehicleOwner(req);
} else {
BasicInfoRequest req = new BasicInfoRequest();
req.setSggCd(hreq.getParameter("sggCd"));
req.setSggCd(sggCd);
req.setInqire_se_code(hreq.getParameter("inqire_se_code"));
req.setLevy_stdde(hreq.getParameter("levy_stdde"));
req.setLevy_stdde(levy_stdde);
req.setOwner_mber_no(hreq.getParameter("owner_mber_no"));
req.setVhrno(hreq.getParameter("vhrno"));
req.setVin(hreq.getParameter("vin"));
req.setVhrno(vhrno);
req.setVin(vin);
payer = payerService.findVehicleOwner(req);
}
boolean found = payer != null;
boolean found = payer != null,
exempted = found && !crdnStngService.getExemptionVehicleList(new CrdnQuery()
.setVhrno(vhrno)
.setCrdnYmd(levy_stdde)
.setSggCd(sggCd)
).isEmpty(); // 면제차량 여부
return new ModelAndView("jsonView")
.addObject("found", found)
.addObject("exempted", exempted)
.addObject("rtpyrId", found ? payer.getRtpyrId() : null)
.addObject("addrSn", found ? payer.getAddrSn() : null)
.addObject("vehicle", found ? payer.getVehicleInfo() : null);

@ -233,8 +233,8 @@ public class SndngBean extends AbstractBean {
throw new RuntimeException("계고장 발송 등록 작업에 실패하였습니다."); // 예외를 발생시켜서 DB Rollback
// 발송 상세(TB_SNDNG_DTL) 대장을 등록한다.
for (int iLoop = 0; iLoop < trgtList.size(); iLoop++) {
String rtnMsg = createWrngSndngDtl(sndng, trgtList.get(iLoop).string("CRDN_ID"));
for (int i = 0; i < trgtList.size(); i++) {
String rtnMsg = createWrngSndngDtl(sndng, trgtList.get(i).string("CRDN_ID"));
if (!rtnMsg.contains("[S]")) // 오류가 발생하였으면 종료..
throw new RuntimeException(rtnMsg.replace("[F]", "")); // 예외를 발생시켜서 DB Rollback
}

Loading…
Cancel
Save