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

@@ -132,6 +132,7 @@ public interface CustMgtMapper {
void addChrg(ChrgInfo chrgInfo);
/**충전관리 삭제 */
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.utils.DateUtils;
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.StringUtils;
import org.mybatis.spring.SqlSessionTemplate;
@@ -1116,12 +1118,13 @@ public class CustMgtService {
UserDetails userDetails = (UserDetails) principal;
String regId = userDetails.getUsername();
logger.debug("insertChrgReqDto= {}", insertChrgReqDto);
// logger.debug("insertChrgReqDto= {}", insertChrgReqDto);
ChrgInfo chrgInfo = new ChrgInfo();
chrgInfo.setChrgSeq(chrgSeq);
chrgInfo.setUserSeq(userSeq);
chrgInfo.setChrgDiv(insertChrgReqDto.getChrdDiv());
chrgInfo.setChrgDiv(insertChrgReqDto.getChrgDiv());
String StrYm = insertChrgReqDto.getStrtYm().replace("-", "").substring(0, 6);
chrgInfo.setStrtYm(StrYm);
String EndYm = insertChrgReqDto.getEndYm().replace("-", "").substring(0, 6);
@@ -1132,6 +1135,48 @@ public class CustMgtService {
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);
}

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")
private String userId;
@ApiModelProperty(example = "충전구분", name = "충전구분", dataType = "String")
private String chrdDiv;
private String chrgDiv;
@ApiModelProperty(example = "충전시작일", name = "충전시작일", dataType = "String")
private String strtYm;
@ApiModelProperty(example = "충전종료일", name = "충전종료일", dataType = "String")

View File

@@ -1297,7 +1297,7 @@
) VALUES(
#{chrgSeq}
, #{userSeq}
, 'E'
, #{chrgDiv}
, #{strtYm}
, #{endYm}
, #{chrgAmt}
@@ -1309,6 +1309,20 @@
)
</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
hubez_admin.EZ_CHARGE_MNG ecm