admin_chrg 수정,삭제부분

This commit is contained in:
2023-03-27 16:56:25 +09:00
parent 0629923f29
commit bcc10f0947
13 changed files with 589 additions and 61 deletions

View File

@@ -1039,6 +1039,25 @@ public class CustMgtService {
return new ChrgListResDto(ApiResponseCode.SUCCESS, chrgListRes);
}
/**
* date : 2023. 3. 15.
* auth : won
* desc : 충전관리 상세 조회
* @param ChrgDetailReqDto
* @return ChrgDetailResDto
*/
public ChrgDetailResDto chrgDetail(@Valid ChrgDetailReqDto chrgDetailReqDto) {
CustMgtMapper custMgtMapper = sqlSessionSlave.getMapper(CustMgtMapper.class);
ChrgDetail chrgDetail = custMgtMapper.selectChrgDetail(chrgDetailReqDto);
if (chrgDetail == null) {
return new ChrgDetailResDto(ApiResponseCode.CM_NOT_FOUND);
}
// 성공 응답.
return new ChrgDetailResDto(ApiResponseCode.SUCCESS, chrgDetail);
}
/**
* * date : 2023. 3. 15.
@@ -1088,7 +1107,7 @@ public class CustMgtService {
chrgInfo.setChrgDiv(insertChrgReqDto.getChrdDiv());
String StrYm = insertChrgReqDto.getStrtYm().replace("-", "").substring(0, 6);
chrgInfo.setStrtYm(StrYm);
String EndYm = insertChrgReqDto.getEndYm().substring(0, 6);
String EndYm = insertChrgReqDto.getEndYm().replace("-", "").substring(0, 6);
chrgInfo.setEndYm(EndYm);
chrgInfo.setChrgAmt(insertChrgReqDto.getChrgAmt());
chrgInfo.setRegId(regId); //로그인 ID
@@ -1114,21 +1133,21 @@ public class CustMgtService {
custMgtMapper.updateChrg(updateChrgReqDto);
// 2. 새 정보 insert
String chrgSeq = custMgtMapper.getChrgSeq();
String chrgSeq = custMgtMapper.getChrgSeq();
int userSeq = custMgtMapper.selectUserSeq(updateChrgReqDto.getUserId());
Object principal = SecurityContextHolder.getContext().getAuthentication().getPrincipal();
UserDetails userDetails = (UserDetails) principal;
String regId = userDetails.getUsername();
logger.debug("insertChrgReqDto= {}", updateChrgReqDto);
logger.debug("updateChrgReqDto= {}", updateChrgReqDto);
ChrgInfo chrgInfo = new ChrgInfo();
chrgInfo.setChrgSeq(chrgSeq);
chrgInfo.setUserSeq(userSeq);
chrgInfo.setChrgDiv(updateChrgReqDto.getChrdDiv());
String StrYm = updateChrgReqDto.getStrtYm().substring(0, 6);
String StrYm = updateChrgReqDto.getStrtYm().replace("-", "").substring(0, 6);
chrgInfo.setStrtYm(StrYm);
String EndYm = updateChrgReqDto.getEndYm().substring(0, 6);
String EndYm = updateChrgReqDto.getEndYm().replace("-", "").substring(0, 6);
chrgInfo.setEndYm(EndYm);
chrgInfo.setChrgAmt(updateChrgReqDto.getChrgAmt());
chrgInfo.setRegId(regId); //로그인 ID
@@ -1152,25 +1171,7 @@ public class CustMgtService {
return new DeleteChrgResDto(ApiResponseCode.SUCCESS);
}
/**
* date : 2023. 3. 15.
* auth : won
* desc : 충전관리 상세 조회
* @param ChrgDetailReqDto
* @return ChrgDetailResDto
*/
public ChrgDetailResDto chrgDetail(@Valid ChrgDetailReqDto chrgDetailReqDto) {
CustMgtMapper custMgtMapper = sqlSessionSlave.getMapper(CustMgtMapper.class);
ChrgDetail chrgDetail = custMgtMapper.selectChrgDetail(chrgDetailReqDto);
if (chrgDetail == null) {
return new ChrgDetailResDto(ApiResponseCode.CM_NOT_FOUND);
}
// 성공 응답.
return new ChrgDetailResDto(ApiResponseCode.SUCCESS, chrgDetail);
}
/* 2023-03-07 add request 부분
* date : 2023. 1. 1.

View File

@@ -0,0 +1,30 @@
package kr.co.uplus.ez.api.custMgt.dto;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class ChrgDetail implements Serializable{
@ApiModelProperty(example = "고객사명", name = "고객사명", dataType = "String")
private String custNm;
@ApiModelProperty(example = "고객명", name = "고객명", dataType = "String")
private String userId;
@ApiModelProperty(example = "충전구분", name = "충전구분", dataType = "String")
private String chrgDiv;
@ApiModelProperty(example = "충전시작일", name = "충전시작일", dataType = "String")
private String strtYm;
@ApiModelProperty(example = "충전종료일", name = "충전종료일", dataType = "String")
private String endYm;
@ApiModelProperty(example = "충전금액", name = "충전금액", dataType = "String")
private String chrgAmt;
@ApiModelProperty(example = "사용여부", name = "사용여부", dataType = "String")
private String useYn;
@ApiModelProperty(example = "사업자명", name = "사업자명", dataType = "String")
private String bizrNo;
@ApiModelProperty(example = "충전seq", name = "충전seq", dataType = "String")
private String chrgSeq;
}

View File

@@ -0,0 +1,14 @@
package kr.co.uplus.ez.api.custMgt.dto;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class ChrgDetailReqDto implements Serializable{
@ApiModelProperty(example = "충전seq", name = "충전seq", dataType = "String")
private String chrgSeq;
}

View File

@@ -0,0 +1,33 @@
package kr.co.uplus.ez.api.custMgt.dto;
import java.io.Serializable;
import io.swagger.annotations.ApiModelProperty;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ResponseMessage;
import lombok.Data;
@SuppressWarnings("serial")
@Data
public class ChrgDetailResDto extends ResponseMessage implements Serializable{
@ApiModelProperty(example = "데이터")
private ChrgDetail data;
public ChrgDetailResDto() {
this.retCode = ApiResponseCode.SUCCESS.getResultCode();
this.retMsg = ApiResponseCode.SUCCESS.getResultMsg();
}
public ChrgDetailResDto(ApiResponseCode returnStr) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
}
public ChrgDetailResDto(ApiResponseCode returnStr, ChrgDetail data) {
this.retCode = returnStr.getResultCode();
this.retMsg = returnStr.getResultMsg();
this.data = data;
}
}

View File

@@ -28,5 +28,7 @@ public class ChrgList implements Serializable{
private String bizrNo;
@ApiModelProperty(example = "충전기간", name = "충전기간", dataType = "String")
private String chrgDate;
@ApiModelProperty(example = "충전seq", name = "충전seq", dataType = "String")
private String chrgSeq;
}

View File

@@ -11,5 +11,7 @@ public class DeleteChrgReqDto implements Serializable{
@ApiModelProperty(example = "사용여부", name = "사용여부", dataType = "String")
private String useYn;
@ApiModelProperty(example = "충전seq", name = "충전seq", dataType = "String")
private String chrgSeq;
}

View File

@@ -25,5 +25,7 @@ public class UpdateChrgReqDto implements Serializable{
private String useYn;
@ApiModelProperty(example = "사업자명", name = "사업자명", dataType = "String")
private String bizrNo;
@ApiModelProperty(example = "충전seq", name = "충전seq", dataType = "String")
private String chrgSeq;
}

View File

@@ -1148,10 +1148,6 @@
<select id="selectChrgList" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgListReqDto" resultType="kr.co.uplus.ez.api.custMgt.dto.ChrgList">
SELECT
@ROWNUM := @ROWNUM + 1 AS NO
,A.*
FROM (
SELECT
@ROWNUM := @ROWNUM + 1 AS NO
, eci.CUST_NM
, esu.USER_ID
, ecm.CHRG_DIV
@@ -1160,6 +1156,7 @@
, ecm.CHRG_AMT
, ecm.USE_YN
, eci.BIZRNO
, ecm.CHRG_SEQ
FROM hubez_admin.EZ_CHARGE_MNG ecm
INNER JOIN hubez_common.EZ_SVC_USER esu ON esu.USER_SEQ = ecm.USER_SEQ
@@ -1167,10 +1164,10 @@
WHERE 1 = 1
AND ecm.USE_YN ='Y'
<if test="startDt != null and startDt != ''">
AND ecm.STRT_YM <![CDATA[ >= ]]> STR_TO_DATE(concat(REPLACE(#{startDt}, '-', '' ),'000000') , '%Y%m')
AND (ecm.STRT_YM <![CDATA[ >= ]]> STR_TO_DATE(concat(REPLACE(#{startDt}, '-', '' ),'000000') , '%Y%m')
</if>
<if test="endDt != null and endDt != ''">
OR ecm.END_YM <![CDATA[ <= ]]> STR_TO_DATE(concat(REPLACE(#{endDt}, '-', '' ),'235959'), '%Y%m')
OR ecm.END_YM <![CDATA[ <= ]]> STR_TO_DATE(concat(REPLACE(#{endDt}, '-', '' ),'235959'), '%Y%m'))
</if>
<if test="searchType1 != null and searchType1 != ''">
<if test="searchType1 == '01' and searchText1 != null and searchText1 != ''">
@@ -1183,13 +1180,28 @@
AND UPPER(esu.USER_ID) LIKE UPPER(CONCAT('%', #{searchText1}, '%'))
</if>
</if>
ORDER BY esu.USER_ID DESC) A ,
( SELECT @ROWNUM := #{page} ) AS R
ORDER BY ecm.CHRG_SEQ DESC
</select>
<!-- 충전관리 상세 조회 -->
<select id="selectChrgDetail" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgDetailReqDto" resultType="kr.co.uplus.ez.api.custMgt.dto.ChrgDetail">
SELECT
eci.CUST_NM
, esu.USER_ID
, ecm.CHRG_DIV
, ecm.STRT_YM
, ecm.END_YM
, ecm.CHRG_AMT
, ecm.USE_YN
, eci.BIZRNO
, ecm.CHRG_SEQ
FROM hubez_admin.EZ_CHARGE_MNG ecm
INNER JOIN hubez_common.EZ_SVC_USER esu ON esu.USER_SEQ = ecm.USER_SEQ
INNER JOIN hubez_common.EZ_CUST_INFO eci ON eci.CUST_SEQ = esu.CUST_SEQ
WHERE 1 = 1
AND ecm.USE_YN ='Y'
AND ecm.CHRG_SEQ = #{chrgSeq}
ORDER BY ecm.CHRG_SEQ DESC
</select>
<!-- 이용자 충전번호 조회(채번) -->
@@ -1228,10 +1240,11 @@
</insert>
<update id="updateChrg" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgInfo">
hubez_admin.EZ_CHARGE_MNG
set
ecm.USE_YN ='N'
WHERE USER_SEQ = (SELECT USER_SEQ FROM hubez_common.EZ_SVC_USER WHERE USER_ID = #{userId})
UPDATE
hubez_admin.EZ_CHARGE_MNG ecm
set
ecm.USE_YN ='N'
WHERE ecm.CHRG_SEQ = #{chrgSeq}
</update>
<insert id="addChrg" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgInfo">
@@ -1247,27 +1260,27 @@
, REG_DT
, CHG_ID
, CHG_DT
)
) VALUES(
#{chrgSeq}
, #{userSeq}
, 'Y'
, #{startDt}
, #{endDt}
, 'E'
, #{strtYm}
, #{endYm}
, #{chrgAmt}
, 'Y'
, #{regId}
, NOW()
, #{regId}
, NOW()
)
)
</insert>
<update id="deleteChrg" parameterType="kr.co.uplus.ez.api.custMgt.dto.ChrgInfo">
UPDATE
hubez_admin.EZ_CHARGE_MNG
hubez_admin.EZ_CHARGE_MNG ecm
set
ecm.USE_YN ='N'
WHERE USER_SEQ = (SELECT USER_SEQ FROM hubez_common.EZ_SVC_USER WHERE USER_ID = #{userId})
WHERE ecm.CHRG_SEQ = #{chrgSeq}
</update>