납부자 아이디 포함한 차적 조회 추가

main
mjkhan21 1 year ago
parent 8555010ae0
commit 5fcc7366b8

@ -174,65 +174,27 @@ public class ImportBean extends AbstractComponent {
BasicInfoRequest req = new BasicInfoRequest(); BasicInfoRequest req = new BasicInfoRequest();
req.setLevy_stdde(crdn.getCrdnYmd()); req.setLevy_stdde(crdn.getCrdnYmd());
req.setVhrno(crdn.getVhrno()); req.setVhrno(crdn.getVhrno());
req.setSggCd(crdn.getSggCd());
return req; return req;
}).toList(); }).toList();
Map<String, BasicInfoResponse> vehicleInfoMap = vehicleInfoBean.getBasicInfo(reqs); Map<String, Payer> payers = payerBean.getVehicleOwners(reqs).stream()
.collect(Collectors.toMap(payer -> payer.getVhrno(), payer -> payer));
crdns.forEach(crdn -> { crdns.forEach(crdn -> {
String vhrno = crdn.getVhrno(); Payer payer = payers.get(crdn.getVhrno());
BasicInfoResponse resp = vehicleInfoMap.get(vhrno); if (payer == null) return;
if (resp == null) return;
BasicInfoResponse.BasicInfo vehicle = payer.getVehicleInfo();
BasicInfoResponse.BasicInfo basicInfo = resp.getBasicInfo(); crdn.setSggCd(payer.getSggCd()); // 시군구 데이터 정리되면 지울 것
Payer payer = getPayer(crdn.getSggCd(), basicInfo); crdn.setRtpyrId(payer.getRtpyrId());
if (payer != null) crdn.setVin(vehicle.getVin());
crdn.setRtpyrId(payer.getRtpyrId()); // TODO: 차적 차량번호 + 소유자 회원번호 == tb_payer.차량번호 + 납부자 번호 -> tb_payer.납부자 id crdn.setVhclNm(vehicle.getCnm());
crdn.setVin(basicInfo.getVin()); crdn.setVhclColor(vehicle.getColor_nm());
crdn.setVhclNm(basicInfo.getCnm()); crdn.setUseFuelCd(vehicle.getUse_fuel_code());
crdn.setVhclColor(basicInfo.getColor_nm()); crdn.setFfnlgCarmdlCd(getCarModel.apply(vehicle.getVhcty_asort_code(), vehicle.getMxmm_ldg()));
crdn.setUseFuelCd(basicInfo.getUse_fuel_code());
crdn.setFfnlgCarmdlCd(getCarModel.apply(basicInfo.getVhcty_asort_code(), basicInfo.getMxmm_ldg()));
}); });
} }
private Payer getPayer(String sggCd, BasicInfoResponse.BasicInfo basicInfo) {
Payer payer = new Payer();
payer.setSggCd(sggCd);
String vhrno = basicInfo.getVhrno();
payer.setVhrno(vhrno);
payer.setRtpyrSeCd(basicInfo.getMber_se_code());
String rtpyrNo = basicInfo.getMber_se_no();
payer.setRtpyrNo(rtpyrNo);
payer.setRtpyrNm(basicInfo.getMber_nm());
payer.setRtpyrTelno(basicInfo.getTelno());
payer.setRoadNmCd(basicInfo.getUse_strnghld_road_nm_code());
payer.setUdgdSeCd(basicInfo.getUsgsrhld_undgrnd_buld_se_code());
String str = basicInfo.getUse_strnghld_buld_main_no();
if (!isEmpty(str))
payer.setBmno(toInt(str));
str = basicInfo.getUse_strnghld_buld_sub_no();
if (!isEmpty(str))
payer.setBsno(toInt(str));
payer.setStdgCd(basicInfo.getUse_strnghld_legaldong_code());
payer.setDongCd(basicInfo.getUse_strnghld_adstrd_code());
payer.setMtnSeCd(basicInfo.getUse_strnghld_mntn());
str = basicInfo.getUse_strnghld_lnbr();
if (!isEmpty(str))
payer.setMno(toInt(str));
str = basicInfo.getUse_strnghld_ho();
if (!isEmpty(str))
payer.setSno(toInt(str));
payer.setDtlAddr(basicInfo.getUse_strnghld_adres_nm());
payer.setWholAddr(basicInfo.getOwner_adres_full());
boolean saved = payerBean.create(payer);
if (saved)
return payer;
return payerBean.getPayer(vhrno, rtpyrNo);
}
public int createCvlcpts(List<Petition> petitions) { public int createCvlcpts(List<Petition> petitions) {
int affected = 0; int affected = 0;
UnaryOperator<String> parseDate = str -> { UnaryOperator<String> parseDate = str -> {

@ -1,6 +1,7 @@
package cokr.xit.fims.payer; package cokr.xit.fims.payer;
import cokr.xit.foundation.AbstractEntity; import cokr.xit.foundation.AbstractEntity;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoResponse;
import lombok.Getter; import lombok.Getter;
import lombok.Setter; import lombok.Setter;
@ -160,4 +161,14 @@ public class Payer extends AbstractEntity {
* *
*/ */
private String rtpyrMblTelno; private String rtpyrMblTelno;
/** 차량 기본정보 */
private BasicInfoResponse.BasicInfo vehicleInfo;
/**"차량번호-납부자번호" .
* @return "차량번호-납부자번호"
*/
public String getKey() {
return String.format("%s-%s", vhrno, rtpyrNo);
}
} }

@ -5,6 +5,7 @@ import java.util.List;
import cokr.xit.fims.payer.Payer; import cokr.xit.fims.payer.Payer;
import cokr.xit.fims.payer.PayerQuery; import cokr.xit.fims.payer.PayerQuery;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoRequest;
/** . /** .
* *
@ -51,5 +52,11 @@ public interface PayerService {
* @param rtpyrIds * @param rtpyrIds
* @return * @return
*/ */
public int remove(String... rtpyrIds); int remove(String... rtpyrIds);
/** () .
* @param req
* @return ()
*/
Payer getVehicleOwner(BasicInfoRequest req);
} }

@ -1,6 +1,8 @@
package cokr.xit.fims.payer.service.bean; package cokr.xit.fims.payer.service.bean;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.stream.Collectors;
import javax.annotation.Resource; import javax.annotation.Resource;
@ -11,8 +13,11 @@ import cokr.xit.fims.payer.PayerQuery;
import cokr.xit.fims.payer.dao.PayerMapper; import cokr.xit.fims.payer.dao.PayerMapper;
import cokr.xit.foundation.AbstractComponent; import cokr.xit.foundation.AbstractComponent;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.interfaces.lvis.service.bean.VehicleInfoBean;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoRequest;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoResponse;
/** Bean /** Bean
* *
* <p> : * <p> :
* *
@ -24,21 +29,23 @@ import cokr.xit.foundation.data.DataObject;
*/ */
@Component("payerBean") @Component("payerBean")
public class PayerBean extends AbstractComponent { public class PayerBean extends AbstractComponent {
/** 납부자 대장 정보 DAO */ /** 납부자 정보 DAO */
@Resource(name = "payerMapper") @Resource(name = "payerMapper")
private PayerMapper payerMapper; private PayerMapper payerMapper;
@Resource(name = "vehicleInfoBean")
private VehicleInfoBean vehicleInfoBean;
/** . /** .
* @param req * @param req
* @return * @return
*/ */
public List<DataObject> getPayerList(PayerQuery req) { public List<DataObject> getPayerList(PayerQuery req) {
return payerMapper.selectPayerList(req); return payerMapper.selectPayerList(req);
} }
/** . /** .
* @param req * @param req
* @return * @return
*/ */
public List<Payer> getPayers(PayerQuery req) { public List<Payer> getPayers(PayerQuery req) {
return payerMapper.selectPayers(req); return payerMapper.selectPayers(req);
@ -50,8 +57,8 @@ public class PayerBean extends AbstractComponent {
return !payers.isEmpty() ? payers.get(0) : null; return !payers.isEmpty() ? payers.get(0) : null;
} }
/** . /** .
* @param payer * @param payer
* @return * @return
* <ul><li> true</li> * <ul><li> true</li>
* <li> false</li> * <li> false</li>
@ -61,8 +68,8 @@ public class PayerBean extends AbstractComponent {
return payerMapper.insert(payer); return payerMapper.insert(payer);
} }
/** . /** .
* @param payer * @param payer
* @return * @return
* <ul><li> true</li> * <ul><li> true</li>
* <li> false</li> * <li> false</li>
@ -72,11 +79,61 @@ public class PayerBean extends AbstractComponent {
return payerMapper.update(payer); return payerMapper.update(payer);
} }
/** . /** .
* @param rtpyrIds * @param rtpyrIds
* @return * @return
*/ */
public int remove(String... rtpyrIds) { public int remove(String... rtpyrIds) {
return payerMapper.delete(rtpyrIds); return payerMapper.delete(rtpyrIds);
} }
public List<Payer> getVehicleOwners(List<BasicInfoRequest> reqs) {
Map<String, BasicInfoResponse> vehicleMap = vehicleInfoBean.getBasicInfo(reqs).stream()
.collect(Collectors.toMap(resp -> resp.getBasicInfo().getKey(), resp -> resp));
return vehicleMap.values().stream()
.map(resp -> getPayer(resp.getBasicInfo()))
.toList();
}
/** , .( / / )
* @param basicInfo
* @return
*/
private Payer getPayer(BasicInfoResponse.BasicInfo basicInfo) {
Payer payer = new Payer();
payer.setSggCd(basicInfo.getSggCd());
String vhrno = basicInfo.getVhrno();
payer.setVhrno(vhrno);
payer.setRtpyrSeCd(basicInfo.getMber_se_code());
String rtpyrNo = basicInfo.getMber_se_no();
payer.setRtpyrNo(rtpyrNo);
payer.setRtpyrNm(basicInfo.getMber_nm());
payer.setRtpyrTelno(basicInfo.getTelno());
payer.setRoadNmCd(basicInfo.getUse_strnghld_road_nm_code());
payer.setUdgdSeCd(basicInfo.getUsgsrhld_undgrnd_buld_se_code());
String str = basicInfo.getUse_strnghld_buld_main_no();
if (!isEmpty(str))
payer.setBmno(toInt(str));
str = basicInfo.getUse_strnghld_buld_sub_no();
if (!isEmpty(str))
payer.setBsno(toInt(str));
payer.setStdgCd(basicInfo.getUse_strnghld_legaldong_code());
payer.setDongCd(basicInfo.getUse_strnghld_adstrd_code());
payer.setMtnSeCd(basicInfo.getUse_strnghld_mntn());
str = basicInfo.getUse_strnghld_lnbr();
if (!isEmpty(str))
payer.setMno(toInt(str));
str = basicInfo.getUse_strnghld_ho();
if (!isEmpty(str))
payer.setSno(toInt(str));
payer.setDtlAddr(basicInfo.getUse_strnghld_adres_nm());
payer.setWholAddr(basicInfo.getOwner_adres_full());
Payer result = create(payer) ? payer : getPayer(vhrno, rtpyrNo);
if (result != null)
result.setVehicleInfo(basicInfo);
return result;
}
} }

@ -11,6 +11,7 @@ import cokr.xit.fims.payer.PayerQuery;
import cokr.xit.fims.payer.service.PayerService; import cokr.xit.fims.payer.service.PayerService;
import cokr.xit.foundation.component.AbstractServiceBean; import cokr.xit.foundation.component.AbstractServiceBean;
import cokr.xit.foundation.data.DataObject; import cokr.xit.foundation.data.DataObject;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoRequest;
/** . /** .
* *
@ -52,4 +53,10 @@ public class PayerServiceBean extends AbstractServiceBean implements PayerServic
public int remove(String... rtpyrIds) { public int remove(String... rtpyrIds) {
return payerBean.remove(rtpyrIds); return payerBean.remove(rtpyrIds);
} }
@Override
public Payer getVehicleOwner(BasicInfoRequest req) {
List<Payer> payers = payerBean.getVehicleOwners(List.of(req));
return !payers.isEmpty() ? payers.get(0) : null;
}
} }

@ -4,6 +4,7 @@ import java.util.List;
import javax.annotation.Resource; import javax.annotation.Resource;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView; import org.springframework.web.servlet.ModelAndView;
@ -12,6 +13,7 @@ import cokr.xit.fims.payer.Payer;
import cokr.xit.fims.payer.PayerQuery; import cokr.xit.fims.payer.PayerQuery;
import cokr.xit.fims.payer.service.PayerService; import cokr.xit.fims.payer.service.PayerService;
import cokr.xit.foundation.web.AbstractController; import cokr.xit.foundation.web.AbstractController;
import cokr.xit.interfaces.lvis.service.reg.BasicInfoRequest;
/** /**
* *
@ -23,6 +25,7 @@ import cokr.xit.foundation.web.AbstractController;
* ================================ * ================================
* </pre> * </pre>
*/ */
@Controller
@RequestMapping(name = "납부자", value = "/payer") @RequestMapping(name = "납부자", value = "/payer")
public class PayerController extends AbstractController { public class PayerController extends AbstractController {
/**납부자 서비스*/ /**납부자 서비스*/
@ -100,4 +103,14 @@ public class PayerController extends AbstractController {
.addObject("affected", affected) .addObject("affected", affected)
.addObject("saved", affected > 0); .addObject("saved", affected > 0);
} }
@PostMapping(name = "차량/납부자 조회", value = "/vehicle.do")
public ModelAndView getVehicleOwner(BasicInfoRequest req) {
Payer payer = payerService.getVehicleOwner(req);
boolean found = payer != null;
return new ModelAndView("jsonView")
.addObject("found", found)
.addObject("rtpyrId", found ? payer.getRtpyrId() : null)
.addObject("vehicle", found ? payer.getVehicleInfo() : null);
}
} }

@ -96,8 +96,9 @@
<include refid="utility.orderBy" /></select> <include refid="utility.orderBy" /></select>
<insert id="insertPayer" parameterType="cokr.xit.fims.payer.Payer">/* 납부자 대장 등록(payerMapper.insertPayer) */ <insert id="insertPayer" parameterType="cokr.xit.fims.payer.Payer">/* 납부자 대장 등록(payerMapper.insertPayer) */
<selectKey keyProperty="rtpyrId" keyColumn="NEW_ID" resultType="string" order="BEFORE"> <selectKey keyProperty="rtpyrId,sggCd" keyColumn="NEW_ID,SGG_CD" resultType="map" order="BEFORE">
SELECT CONCAT(THIS_YEAR, LPAD(IFNULL(SUBSTR(MAX(RTPYR_ID), 5) + 1, 1), 16, '0')) NEW_ID SELECT CONCAT(THIS_YEAR, LPAD(IFNULL(SUBSTR(MAX(RTPYR_ID), 5) + 1, 1), 16, '0')) NEW_ID
, IFNULL(#{sggCd}, '41480') SGG_CD
FROM TB_PAYER A FROM TB_PAYER A
, (SELECT DATE_FORMAT(CURRENT_DATE, '%Y') THIS_YEAR) B , (SELECT DATE_FORMAT(CURRENT_DATE, '%Y') THIS_YEAR) B
WHERE RTPYR_ID LIKE CONCAT(THIS_YEAR, '%')</selectKey> WHERE RTPYR_ID LIKE CONCAT(THIS_YEAR, '%')</selectKey>
@ -138,7 +139,7 @@ INSERT INTO TB_PAYER (
, MDFR <!-- 수정자 --> , MDFR <!-- 수정자 -->
) )
SELECT #{rtpyrId} <!-- 납부자 ID --> SELECT #{rtpyrId} <!-- 납부자 ID -->
, '41480' <!-- #{sggCd} 시군구 코드 --> , #{sggCd} <!-- 시군구 코드 -->
, #{vhrno} <!-- 차량번호 --> , #{vhrno} <!-- 차량번호 -->
, #{rtpyrInptSeCd} <!-- 납부자 입력 구분 코드 --> , #{rtpyrInptSeCd} <!-- 납부자 입력 구분 코드 -->
, #{rtpyrSeCd} <!-- 납부자 구분 코드 --> , #{rtpyrSeCd} <!-- 납부자 구분 코드 -->
@ -177,6 +178,7 @@ SELECT #{rtpyrId} <!-- 납부자 ID -->
FROM TB_PAYER B FROM TB_PAYER B
WHERE VHRNO = #{vhrno} WHERE VHRNO = #{vhrno}
AND RTPYR_NO = #{rtpyrNo} AND RTPYR_NO = #{rtpyrNo}
AND SGG_CD = #{sggCd}
)</insert> )</insert>
<insert id="insertHistory" parameterType="map">/* 납부자 대장 등록(payerMapper.insertHistory) */ <insert id="insertHistory" parameterType="map">/* 납부자 대장 등록(payerMapper.insertHistory) */

Loading…
Cancel
Save