admin_chrg 등록 수정

This commit is contained in:
2023-04-04 13:17:48 +09:00
parent 7fa6f0bf78
commit 19872e3661
6 changed files with 117 additions and 11 deletions

View File

@@ -65,13 +65,13 @@
value="01" value="01"
id="popup_radio5" id="popup_radio5"
v-model="nmineeDivCd" v-model="nmineeDivCd"
@change="changeNmineDiv($event)"
/> />
<label for="popup_radio5">소멸금액</label> <label for="popup_radio5">소멸금액</label>
<input <input
type="number" type="number"
placeholder="소멸 충전 금액 입력" placeholder="소멸 충전 금액 입력"
v-model="chrgAmtE" v-model="chrgAmtE"
v-bind:disabled ="nmineeDivCd=='02'"
/> />
<input <input
type="radio" type="radio"
@@ -79,15 +79,14 @@
value="02" value="02"
id="popup_radio6" id="popup_radio6"
v-model="nmineeDivCd" v-model="nmineeDivCd"
@change="changeNmineDiv($event)"
/> />
<label for="popup_radio6">이월금액</label> <label for="popup_radio6">이월금액</label>
<input <input
class="search-box" class="search-box"
type="number" type="number"
placeholder="이월 충전 금액 입력" placeholder="이월 충전 금액 입력"
disabled
v-model="chrgAmtC" v-model="chrgAmtC"
v-bind:disabled ="nmineeDivCd=='01'"
/> />
</div> </div>
</td> </td>
@@ -137,9 +136,9 @@ export default {
endMonth: '', endMonth: '',
nmineeDivCd: '01', nmineeDivCd: '01',
chrgAmtE: '', chrgAmtE: '0',
chrgAmtC: '', chrgAmtC: '0',
charDiv: '',
userId: '', userId: '',
custNm: '', custNm: '',
userSttusCd: '', userSttusCd: '',
@@ -174,10 +173,15 @@ export default {
}, },
// 모달 끄기 // 모달 끄기
insertChrgClose() { insertChrgClose() {
this.formReset();
var dimmed = document.getElementsByClassName('insertChrgModal'); var dimmed = document.getElementsByClassName('insertChrgModal');
for (var i = 0; i < dimmed.length; i++) { for (var i = 0; i < dimmed.length; i++) {
dimmed[i].style.display = 'none'; dimmed[i].style.display = 'none';
} }
},
formReset() {
Object.assign(this.$data, this.$options.data());
}, },
searchIdPop(){ searchIdPop(){
this.$refs.userListPop.UserListPopOpen(); this.$refs.userListPop.UserListPopOpen();
@@ -271,12 +275,29 @@ export default {
this.endDate = initEndDate; this.endDate = initEndDate;
}, },
saveChrg(){ saveChrg(){
var chrgAmt =0;
if (this.nmineeDivCd =='01') {
this.chrgDiv = 'E';
chrgAmt = this.chrgAmtE
}else{
this.chrgDiv='C';
chrgAmt = this.chrgAmtC
}
if (chrgAmt<=0) {
this.row.title = '경고';
this.row.msg1 = '충전금을 입력해주세요.';
this.$parent.alertInsert(this.row);
return false;
}
let param = { let param = {
userId : this.userId, userId : this.userId,
strtYm : this.startDate, strtYm : this.startDate,
endYm : this.endDate, endYm : this.endDate,
chrgAmt : this.chrgAmtE, chrgDiv : this.chrgDiv,
chrgAmt : chrgAmt,
} }
custMgtApi.insertChrg(param).then((respose)=> { custMgtApi.insertChrg(param).then((respose)=> {

View File

@@ -132,6 +132,7 @@ public interface CustMgtMapper {
void addChrg(ChrgInfo chrgInfo); void addChrg(ChrgInfo chrgInfo);
/**충전관리 삭제 */ /**충전관리 삭제 */
void deleteChrg(DeleteChrgReqDto deleteChrgReqDto); void deleteChrg(DeleteChrgReqDto deleteChrgReqDto);
int updateChrgAmt(ChrgAmtDto chrgAmtDto);

View File

@@ -5,6 +5,8 @@ import kr.co.uplus.ez.common.components.HubeasyApiComponents;
import kr.co.uplus.ez.common.data.*; import kr.co.uplus.ez.common.data.*;
import kr.co.uplus.ez.common.utils.DateUtils; import kr.co.uplus.ez.common.utils.DateUtils;
import kr.co.uplus.ez.common.utils.EncryptionUtil; import kr.co.uplus.ez.common.utils.EncryptionUtil;
import kr.co.uplus.ez.common.utils.TextUtils;
import org.apache.commons.lang3.RandomStringUtils; import org.apache.commons.lang3.RandomStringUtils;
import org.apache.commons.lang3.StringUtils; import org.apache.commons.lang3.StringUtils;
import org.mybatis.spring.SqlSessionTemplate; import org.mybatis.spring.SqlSessionTemplate;
@@ -1116,12 +1118,13 @@ public class CustMgtService {
UserDetails userDetails = (UserDetails) principal; UserDetails userDetails = (UserDetails) principal;
String regId = userDetails.getUsername(); String regId = userDetails.getUsername();
logger.debug("insertChrgReqDto= {}", insertChrgReqDto); // logger.debug("insertChrgReqDto= {}", insertChrgReqDto);
ChrgInfo chrgInfo = new ChrgInfo(); ChrgInfo chrgInfo = new ChrgInfo();
chrgInfo.setChrgSeq(chrgSeq); chrgInfo.setChrgSeq(chrgSeq);
chrgInfo.setUserSeq(userSeq); chrgInfo.setUserSeq(userSeq);
chrgInfo.setChrgDiv(insertChrgReqDto.getChrdDiv()); chrgInfo.setChrgDiv(insertChrgReqDto.getChrgDiv());
String StrYm = insertChrgReqDto.getStrtYm().replace("-", "").substring(0, 6); String StrYm = insertChrgReqDto.getStrtYm().replace("-", "").substring(0, 6);
chrgInfo.setStrtYm(StrYm); chrgInfo.setStrtYm(StrYm);
String EndYm = insertChrgReqDto.getEndYm().replace("-", "").substring(0, 6); String EndYm = insertChrgReqDto.getEndYm().replace("-", "").substring(0, 6);
@@ -1132,6 +1135,48 @@ public class CustMgtService {
custMgtMapper.insertChrgInfo(chrgInfo); custMgtMapper.insertChrgInfo(chrgInfo);
Date now = new Date();
String presentYm = DateUtils.dateToStr(now, "yyyyMM");
ChrgAmtDto chrgAmtDto = new ChrgAmtDto();
if (presentYm.equals(StrYm)) {
int resultcnt = 0;
// logger.debug("presentYm= {}", presentYm);
if ("E".equals(insertChrgReqDto.getChrgDiv())) {
//소멸 충전금 업데이트
chrgAmtDto.setUserSeq(userSeq);
chrgAmtDto.setLmtYm(chrgInfo.getStrtYm());
chrgAmtDto.setExtcChrgAmt(chrgInfo.getChrgAmt());
chrgAmtDto.setCfwdChrgAmt("0");
resultcnt = custMgtMapper.updateChrgAmt(chrgAmtDto);
}else if ("C".equals(insertChrgReqDto.getChrgDiv())) {
//이월 충전금 업데이트
chrgAmtDto.setUserSeq(userSeq);
chrgAmtDto.setLmtYm(chrgInfo.getStrtYm());
chrgAmtDto.setCfwdChrgAmt(chrgInfo.getChrgAmt());
chrgAmtDto.setExtcChrgAmt("0");
resultcnt = custMgtMapper.updateChrgAmt(chrgAmtDto);
}
//insert 및 update 성공시 resultCnt 0이상의 정수값이 return됨
//update성공시
if (resultcnt>0) {
// String clientKey = DateUtils.date2strYMDHMS() + "AD" + RandomStringUtils.randomAlphanumeric(8);
// SendMsgDto sendMsgDto = new SendMsgDto();
// sendMsgDto.setClientKey(clientKey);
// sendMsgDto.setMsg("[LG U+ 메시지허브이지]\n"
// + " " + insertChrgReqDto.getChrgAmt() + " 입니다.");
}
}
// EXTC_CHRG_AMT 소멸 충전금
// CFWD_CHRG_AMT 이월 충전금
return new InsertChrgResDto(ApiResponseCode.SUCCESS); return new InsertChrgResDto(ApiResponseCode.SUCCESS);
} }

View File

@@ -0,0 +1,25 @@
package kr.co.uplus.ez.api.custMgt.dto;
import java.io.Serializable;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class ChrgAmtDto implements Serializable{
/** 충전 SEQUENCE */
private String chrgSeq;
/** 유저 SEQUENCE */
private int userSeq;
/** 한도년월 */
private String lmtYm;
/** 충전 시작년월 */
private String strtYm;
/** 충전구분 */
private String chrgDiv;
/** 소멸 충전금 */
private String extcChrgAmt;
/** 이월 충전금 */
private String cfwdChrgAmt;
}

View File

@@ -19,7 +19,7 @@ public class InsertChrgReqDto implements Serializable{
@ApiModelProperty(example = "고객명", name = "고객명", dataType = "String") @ApiModelProperty(example = "고객명", name = "고객명", dataType = "String")
private String userId; private String userId;
@ApiModelProperty(example = "충전구분", name = "충전구분", dataType = "String") @ApiModelProperty(example = "충전구분", name = "충전구분", dataType = "String")
private String chrdDiv; private String chrgDiv;
@ApiModelProperty(example = "충전시작일", name = "충전시작일", dataType = "String") @ApiModelProperty(example = "충전시작일", name = "충전시작일", dataType = "String")
private String strtYm; private String strtYm;
@ApiModelProperty(example = "충전종료일", name = "충전종료일", dataType = "String") @ApiModelProperty(example = "충전종료일", name = "충전종료일", dataType = "String")

View File

@@ -1297,7 +1297,7 @@
) VALUES( ) VALUES(
#{chrgSeq} #{chrgSeq}
, #{userSeq} , #{userSeq}
, 'E' , #{chrgDiv}
, #{strtYm} , #{strtYm}
, #{endYm} , #{endYm}
, #{chrgAmt} , #{chrgAmt}
@@ -1309,6 +1309,20 @@
) )
</insert> </insert>
<update id="updateChrgAmt" parameterType= "kr.co.uplus.ez.api.custMgt.dto.ChrgAmtDto">
UPDATE
hubez_admin.EZ_USER_LMT eul
set
eul.MRT_LMT_AMT = eul.MRT_LMT_AMT + #{extcChrgAmt}+ #{cfwdChrgAmt}
,eul.EXTC_CHRG_AMT = eul.EXTC_CHRG_AMT + #{extcChrgAmt}
,eul.EXTC_CHRG_BLNC = eul.EXTC_CHRG_BLNC + #{extcChrgAmt}
,eul.CFWD_CHRG_AMT = eul.CFWD_CHRG_AMT+ #{cfwdChrgAmt}
,eul.CFWD_CHRG_BLNC = eul.CFWD_CHRG_BLNC+ #{cfwdChrgAmt}
WHERE eul.USER_SEQ = #{userSeq}
AND eul.LMT_YM =#{lmtYm}
</update>
<update id="updateChrg" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgInfo"> <update id="updateChrg" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgInfo">
UPDATE UPDATE
hubez_admin.EZ_CHARGE_MNG ecm hubez_admin.EZ_CHARGE_MNG ecm