템플릿 반려 팝업 작업

This commit is contained in:
kubo8
2023-02-10 09:32:18 +09:00
parent 9cb127f869
commit fdcd63de44
8 changed files with 153 additions and 2 deletions

View File

@@ -27,8 +27,13 @@ const getExcelHeader = category => {
});
};
const tmpltRejectList = (params) => {
return httpClient.post('/api/v1/bo/channelMgt/tmpltRejectList', params);
}
export default {
getCommCode,
tmpltListExcel,
getExcelHeader,
tmpltRejectList
}

View File

@@ -65,6 +65,7 @@
></custom-grid>
<common-modal ref="commmonModal"></common-modal>
<TmpltRejectViewPop ref="TmpltRejectViewPop" />
</div>
</div>
</div>
@@ -76,8 +77,38 @@ import channelMgtApi from '../service/channelMgtApi';
import xlsx from '@/common/excel';
import moment from 'moment';
import commonModal from '@/components/modal/commonModal';
import TmpltRejectViewPop from '../components/TmpltRejectViewPop';
import api from '@/service/api';
class CustomATagRenderer {
constructor(props) {
this.props = props;
if(props.colValue == "반려"){
const el = document.createElement('a');
el.href = 'javascript:void(0);';
el.className = 'btn_text';
el.innerText = String(props.colValue);
this.el = el;
}else{
const el = document.createElement('p');
el.className = 'btn_text';
el.innerText = String(props.colValue);
this.el = el;
}
}
getElement() {
return this.el;
}
addEvent(selEl) {
selEl.addEventListener('click', () => {
const { callback } = this.props['cgrido' + this.props.colName].options;
callback(this.props);
});
}
}
export default {
name: 'temltList',
data() {
@@ -128,7 +159,18 @@ export default {
// { name: 'tmpltCd', header: '템플릿코드', align: 'center', width: '12%' },
{ name: 'tmpltNm', header: '템플릿명', align: 'center', width: '16%' },
{ name: 'tmpltType', header: '템플릿 유형', align: 'center', width: '6%' },
{ name: 'stat', header: '상태', align: 'center', width: '7%' },
{
name: 'stat',
header: '상태',
align: 'center',
width: '7%',
renderer: {
type: CustomATagRenderer,
options: {
callback: this.tmpltRejectViewPopOpen,
},
},
},
{ name: 'sendProfile', header: '발신프로필', align: 'center', width: '28%' },
{ name: 'userInfo', header: '등록ID(이름)', align: 'center', width: '10%' },
{ name: 'lastChgDt', header: '마지막 수정일', width: '7%', cls: 'td_line' },
@@ -147,6 +189,7 @@ export default {
customGrid: customGrid,
channelMgtApi,
commonModal,
TmpltRejectViewPop
},
created() {
this.getExcelHeader();
@@ -268,6 +311,11 @@ export default {
return String.fromCharCode(s.match(/\d+/gm)[0]);
});
},
tmpltRejectViewPopOpen(props) {
if(props.stat == "반려"){
this.$refs.TmpltRejectViewPop.tmpltRejectViewPopOpen(props.sndrprofKey, props.tmpltKey);
}
}
},
beforeRouteLeave(to, from, next) {

View File

@@ -81,4 +81,25 @@ public class ChannelMgtController {
return channelService.tmpltListExcel(tmpltListExcelReqDto, userId);
}
/**
* date : 2022. 4. 25.
* auth : ckr
* desc : 알림톡 템플릿 목록 조회
* @param tmpltListReqDto
* @return
* @
*/
@ApiOperation(value = "tmpltRejectList", notes = "알림톡 템플릿 반려 목록 조회")
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
@RequestMapping(value = "tmpltRejectList", method = { RequestMethod.POST })
@ResponseBody
public TmpltListResDto tmpltRejectList(@RequestBody @Valid TmpltListReqDto tmpltListReqDto, BindingResult bindingResult) {
if (validComponents.validParameter(bindingResult)) {
return new TmpltListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
}
return channelService.tmpltRejectList(tmpltListReqDto);
}
}

View File

@@ -1,17 +1,25 @@
package kr.co.uplus.ez.api.channelMgt;
import kr.co.uplus.ez.api.channelMgt.dto.*;
import kr.co.uplus.ez.common.components.WebClientRequestService;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.Const;
import kr.co.uplus.ez.common.data.Paging;
import org.json.simple.JSONArray;
import org.json.simple.JSONObject;
import org.mybatis.spring.SqlSessionTemplate;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class ChannelMgtService {
@@ -26,6 +34,15 @@ public class ChannelMgtService {
@Qualifier("sqlSessionTemplateDb2")
private SqlSessionTemplate sqlSessionSlave;
@Autowired
WebClientRequestService clientRequestService;
@Value("${hubeasy-api.domain:http://localhost:7070/}")
String apiDomain;
@Value("${hubeasy-api.url.alTolkTemplet:api/v1/kko/template/get}")
String apiUrlAlTolkTemplet;
/**
* date : 2022. 4. 25.
* auth : ckr
@@ -82,4 +99,47 @@ public class ChannelMgtService {
return new TmpltListExcelResDto(ApiResponseCode.SUCCESS, tmpltListRes);
}
/**
* desc : 알림톡 템플릿 반려 목록 조회
* @param tmpltListReqDto
* @return
*/
@SuppressWarnings("unchecked")
public TmpltListResDto tmpltRejectList(TmpltListReqDto tmpltListReqDto) {
RjtTmpltListRes tmpltListRes = new RjtTmpltListRes();
Map<Object, Object> apiResultMap = null;
List<Map<Object,Object>> rjtDataListMap = null;
JSONObject jsonObject = new JSONObject();
String callUrl = apiDomain + apiUrlAlTolkTemplet;
jsonObject.put("senderKey", tmpltListReqDto.getSndrprofKey());
jsonObject.put("templateKey", tmpltListReqDto.getTmpltKey());
try {
apiResultMap = (Map<Object, Object>) clientRequestService.callBySyncPost(callUrl, jsonObject);
if("0000".equals(apiResultMap.get("retCode"))) {
Map<Object, Object> dataMap = (Map<Object, Object>) apiResultMap.get("data");
Map<Object, Object> dataTempMap = (Map<Object, Object>) dataMap.get("list");
if(dataTempMap.get("comments") != null && !"".equals(dataTempMap.get("comments"))) {
rjtDataListMap = (List<Map<Object, Object>>) dataTempMap.get("comments");
tmpltListRes.setList(rjtDataListMap);
}
return new TmpltListResDto(ApiResponseCode.SUCCESS, tmpltListRes);
}else {
return new TmpltListResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
} catch (Exception e) {
// TODO: handle exception
e.printStackTrace();
}
return new TmpltListResDto(ApiResponseCode.SUCCESS, tmpltListRes);
}
}

View File

@@ -31,4 +31,9 @@ public class TmpltInfo implements Serializable {
private String sendProfile;
@ApiModelProperty(example = "20220320", name = "최종수정일자", dataType = "String")
private String lastChgDt;
@ApiModelProperty(example = "da17d231bbf13f83174a36a4bb0353476ae012b3", name = "발신프로필_키", dataType = "String")
private String sndrprofKey;
@ApiModelProperty(example = "TPizuOloiF", name = "템플릿_키", dataType = "String")
private String tmpltKey;
}

View File

@@ -28,4 +28,9 @@ public class TmpltListReqDto implements Serializable {
private String channelAuthMenuNo;
@ApiModelProperty(example = "test", name = "사용자아이디", dataType = "int")
private String userId;
@ApiModelProperty(example = "da17d231bbf13f83174a36a4bb0353476ae012b3", name = "발신프로필_키", dataType = "String")
private String sndrprofKey;
@ApiModelProperty(example = "TPizuOloiF", name = "템플릿_키", dataType = "String")
private String tmpltKey;
}

View File

@@ -14,6 +14,7 @@ public class TmpltListResDto extends ResponseMessage implements Serializable {
// 데이터.
private TmpltListRes data;
private RjtTmpltListRes rjtData;
public TmpltListResDto() {
this.retCode = ApiResponseCode.SUCCESS.getResultCode();
@@ -30,4 +31,9 @@ public class TmpltListResDto extends ResponseMessage implements Serializable {
this.retMsg = returnStr.getResultMsg();
this.data = data;
}
public TmpltListResDto(ApiResponseCode returnStr, RjtTmpltListRes rjtData) {
this.retCode = returnStr.getResultCode();
this.rjtData = rjtData;
}
}

View File

@@ -30,6 +30,7 @@ public class WebClientRequestService {
public Object callBySyncPost(String uri, Object param) {
Date startTime = new Date();
Object result = webClient.post().uri(uri).bodyValue(param).retrieve().bodyToMono(Object.class).block();
log.info("callBySyncPost duration Time : {}", (new Date().getTime() - startTime.getTime()) / 1000f);
log.debug("callBySyncPost duration Time : {}", (new Date().getTime() - startTime.getTime()) / 1000f);
return result;
}