복사 등록 기능 추가

main
이범준 1 year ago
parent 7e77c228f0
commit 591ddd2ad4

@ -97,4 +97,16 @@ public interface CrdnCvlcptMapper extends AbstractMapper {
*/
DataObject selectCvlcptAnsWordsInfo(Map<String, Object> params);
/** .
* @param params
* @return
*/
int insertCrdnFromSelect(DataObject params);
/** .
* @param params
* @return
*/
int insertCrdnAdditionFromSelect(DataObject params);
}

@ -50,5 +50,11 @@ public interface CrdnCvlcptService {
*/
boolean updateCvlcptPrcsSe(Map<String, Object> nonQueryRequest, CrdnCvlcpt crdnCvlcpt, Crdn crdn, List<FileInfo> newFileInfoList);
/** .
* @param crdnId ID
* @return
*/
boolean copyCvlcptCrdnInfo(String crdnId);
}

@ -106,4 +106,26 @@ public class CrdnCvlcptBean extends AbstractComponent {
return crdnCvlcptMapper.selectCvlcptAnsWordsInfo(params);
}
/** .
* @param crdnId ID
* @return ID
*/
public String insertCrdnFromSelect(String crdnId) {
//Crdn crdn = new Crdn();
DataObject params = new DataObject();
UserInfo userInfo = currentUser();
params.set("currentUser", userInfo);
params.set("crdnId", crdnId);
if(crdnCvlcptMapper.insertCrdnFromSelect(params) != 1) {
throw new RuntimeException("단속민원 복사 등록 중 단속대장 등록에 실패하였습니다.");
}
if(crdnCvlcptMapper.insertCrdnAdditionFromSelect(params) != 1) {
throw new RuntimeException("단속민원 복사 등록 중 단속대장 등록에 실패하였습니다.");
}
return (String)params.get("newCrdnId");
}
}

@ -15,8 +15,10 @@ import org.springframework.stereotype.Service;
import org.springframework.util.ResourceUtils;
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.bean.FileBean;
import cokr.xit.base.file.web.FileInfoFactory;
import cokr.xit.fims.cmmn.CmmnUtil;
import cokr.xit.fims.cmmn.CrdnPayerHstry;
import cokr.xit.fims.cmmn.CrdnSttsHstry;
@ -478,5 +480,41 @@ public class CrdnCvlcptServiceBean extends AbstractServiceBean implements CrdnCv
return saved;
}
@Override
public boolean copyCvlcptCrdnInfo(String crdnId) {
FileQuery fileQuery = new FileQuery().setInfoType(Crdn.INF_TYPE).setInfoKeys(crdnId);
List<DataObject> orgnlCrdnFileList = fileBean.getFileList(fileQuery);
String newCrdnId = crdnCvlcptBean.insertCrdnFromSelect(crdnId);
if(ifEmpty(newCrdnId, () -> "").equals("")) {
throw new RuntimeException("단속민원 복사 등록 중 단속대장 등록에 실패하였습니다.");
}
if (!orgnlCrdnFileList.isEmpty() && orgnlCrdnFileList.size() > 0) {
List<FileInfo> fileInfoList = new ArrayList<FileInfo>();
List<File> files = new ArrayList<>();
for (int iLoop = 0; iLoop < orgnlCrdnFileList.size(); iLoop++) {
files.add(new File(orgnlCrdnFileList.get(iLoop).string("FILE_PATH")));
}
Relation relation = new Relation();
relation.setInfoType(Crdn.INF_TYPE);
relation.setInfoKey(newCrdnId);
fileInfoList = new FileInfoFactory().createFileInfos(relation, files);
for (int iLoop = 0; iLoop < fileInfoList.size(); iLoop++) {
fileInfoList.get(iLoop).setName(orgnlCrdnFileList.get(iLoop).string("FILE_NM"));
}
int effected = fileBean.create(fileInfoList);
if(effected == 0) {
throw new RuntimeException("단속민원 복사 등록 중 파일복사에 실패하였습니다.");
}
}
return true;
}
}

@ -305,7 +305,7 @@ public class Cvlc01Controller extends ApplicationController {
boolean saved = false;
//TODO:민원정보,단속정보 복사
saved = crdnCvlcptService.copyCvlcptCrdnInfo(crdnId);
return new ModelAndView("jsonView")
.addObject("saved", saved);

@ -482,4 +482,142 @@ SELECT A.ANS_WORDS_ID
WHERE CRDN_ID = #{crdn.crdnId} /* 단속 ID */
</update>
<insert id="insertCrdnFromSelect" parameterType="map">
/* 단속정보 복사(crdnCvlcptMapper.insertCrdnFromSelect) */
<selectKey resultType="string" keyProperty="newCrdnId" keyColumn="NEW_ID" order="BEFORE">
SELECT
CONCAT(DATE_FORMAT(CURRENT_DATE, '%Y'), LPAD(CAST(IFNULL(MAX(SUBSTRING(CRDN_ID,5)) + 1, 1) AS INT), 16, '0'))
AS NEW_ID
FROM TB_CRDN
</selectKey>
INSERT
INTO TB_CRDN (
CRDN_ID
, BFR_CRDN_ID
, CRDN_REG_SE_CD
, CRDN_STTS_CD
, OPNN_SBMSN_YN
, DEL_YN
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
, SGG_CD
, TASK_SE_CD
, CRDN_INPT_SE_CD
, CVLCPT_LINK_YN
, LINK_TBL_NM
, LINK_ID
, RTPYR_ID
, CRDN_YMD
, CRDN_TM
, VHRNO
, CRDN_STDG_NM
, CRDN_ROAD_NM
, CRDN_PLC
, VLTN_ID
, GPS_X
, GPS_Y
, ATCH_FILE_CNT
, VIN
, VHCL_NM
, VHCL_COLOR
, FFNLG_AMT
, FFNLG_RDUCT_RT
, LEVY_AMT
, ADVNTCE_LEVY_AMT
, ETC_CN
)
SELECT #{newCrdnId}
, #{crdnId}
, '04'
, '01'
, 'N'
, 'N'
, <include refid="utility.now" /> <!-- 등록 일시 -->
, #{currentUser.id} <!-- 등록자 -->
, <include refid="utility.now" /> <!-- 수정 일시 -->
, #{currentUser.id} <!-- 수정자 -->
, SGG_CD
, TASK_SE_CD
, CRDN_INPT_SE_CD
, CVLCPT_LINK_YN
, LINK_TBL_NM
, LINK_ID
, RTPYR_ID
, CRDN_YMD
, CRDN_TM
, VHRNO
, CRDN_STDG_NM
, CRDN_ROAD_NM
, CRDN_PLC
, VLTN_ID
, GPS_X
, GPS_Y
, ATCH_FILE_CNT
, VIN
, VHCL_NM
, VHCL_COLOR
, FFNLG_AMT
, FFNLG_RDUCT_RT
, LEVY_AMT
, ADVNTCE_LEVY_AMT
, ETC_CN
FROM TB_CRDN
WHERE CRDN_ID = #{crdnId}
</insert>
<insert id="insertCrdnAdditionFromSelect" parameterType="map">
/* 단속 부가정보 복사(crdnCvlcptMapper.insertCrdnAdditionFromSelect) */
INSERT
INTO TB_CRDN_ADI (
CRDN_ID
, CRDN_SE_CD
, TEAM_ID
, DTL_CRDN_PLC
, CRDN_SPAREA_CD
, CRDN_BGNG_TM
, CRDN_END_TM
, CRDN_SN
, MOSC_X
, MOSC_Y
, TOWNG_YN
, USE_FUEL_CD
, FFNLG_CARMDL_CD
, PARKNG_PSBLTY_RSLT_CD
, VLTN_NMTM
, OVTIME_YN
, OVTIME_PRTTN_YN
, DEL_YN
, REG_DT <!-- 등록 일시 -->
, RGTR <!-- 등록자 -->
, MDFCN_DT <!-- 수정 일시 -->
, MDFR <!-- 수정자 -->
)
SELECT #{newCrdnId}
, CRDN_SE_CD
, TEAM_ID
, DTL_CRDN_PLC
, CRDN_SPAREA_CD
, CRDN_BGNG_TM
, CRDN_END_TM
, CRDN_SN
, MOSC_X
, MOSC_Y
, TOWNG_YN
, USE_FUEL_CD
, FFNLG_CARMDL_CD
, PARKNG_PSBLTY_RSLT_CD
, VLTN_NMTM
, OVTIME_YN
, OVTIME_PRTTN_YN
, DEL_YN
, <include refid="utility.now" /> <!-- 등록 일시 -->
, #{currentUser.id} <!-- 등록자 -->
, <include refid="utility.now" /> <!-- 수정 일시 -->
, #{currentUser.id} <!-- 수정자 -->
FROM TB_CRDN_ADI
WHERE CRDN_ID = #{crdnId}
</insert>
</mapper>

@ -697,7 +697,11 @@ $(document).ready(function(){
ajax.get({
url : $P.crdnControl.urls.create,
data : { crdnId : crdnId },
success : resp => { }
success : resp => {
if (resp.saved) {
dialog.alert("복사 자료가 생성되었습니다.");
}
}
});

Loading…
Cancel
Save