fix : 관리자 구독서비스 수정
This commit is contained in:
@@ -24,5 +24,7 @@ public interface BOSubsvcMapper {
|
||||
List<DataMap> selectBOMngrSrchSubsvcGnrList(BOSubsvcVO vo);
|
||||
/** 관리자 구독서비스 선택 삭제*/
|
||||
int deleteBOMngrSubsvc(BOSubsvcVO vo);
|
||||
/** 관리자 구독서비스 수정*/
|
||||
int updateBOMngrSubsvc(BOSubsvcVO vo);
|
||||
|
||||
}
|
||||
|
||||
@@ -82,6 +82,9 @@ public class BOSubsvcService {
|
||||
return dataList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 관리자 구독서비스 선택 삭제(여러건 삭제)
|
||||
* */
|
||||
public String deleteBOMngrSubsvc(BOSubsvcVO vo) {
|
||||
String message = "fail";
|
||||
int result = mapper.deleteBOMngrSubsvc(vo);
|
||||
@@ -91,4 +94,17 @@ public class BOSubsvcService {
|
||||
return message;
|
||||
}
|
||||
|
||||
/**
|
||||
* 관리자 구독서비스 수정
|
||||
* */
|
||||
public String updateBOMngrSubsvc(BOSubsvcVO vo) {
|
||||
String message = "fail";
|
||||
int result = mapper.updateBOMngrSubsvc(vo);
|
||||
if (result > 0) {
|
||||
message = "success";
|
||||
}
|
||||
return message;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -5,6 +5,7 @@ import com.wb.domainserver.common.mvc.tags.ui.pagination.PaginationInfo;
|
||||
import com.wb.domainserver.common.prop.PaginationProperties;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.service.BOMaComncdService;
|
||||
import com.wb.domainserver.domain.admin.sys.comncd.vo.BOMaComncdVO;
|
||||
import com.wb.domainserver.domain.gcone.common.service.BOCommonService;
|
||||
import com.wb.domainserver.domain.gcone.goods.cmnuse.vo.BOCmnuseVO;
|
||||
import com.wb.domainserver.domain.gcone.goods.goods.vo.BOGoodsVO;
|
||||
import com.wb.domainserver.domain.gcone.goods.goodsinfo.vo.BOGoodsInfoVO;
|
||||
@@ -22,7 +23,10 @@ import com.wb.domainserver.security.authorization.annotation.Policy;
|
||||
import com.wb.domainserver.util.communicate.SendToResrc;
|
||||
import com.wb.domainserver.util.communicate.ValidateResultConverter;
|
||||
import com.wb.domainserver.util.dataaccess.DataMap;
|
||||
import com.wb.domainserver.util.file.service.FileStorageService;
|
||||
import com.wb.domainserver.util.file.vo.FileVo;
|
||||
import io.micrometer.common.util.StringUtils;
|
||||
import jakarta.servlet.http.HttpServletRequest;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.MediaType;
|
||||
@@ -35,6 +39,7 @@ import org.springframework.web.bind.annotation.CookieValue;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMethod;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
@@ -70,10 +75,15 @@ public class SubsvcController {
|
||||
/** 공통 메시지 처리를 위한 메시지 객체 */
|
||||
@Autowired
|
||||
private GconeMessageSource gconeMessageSource;
|
||||
/** 파일 업로드 */
|
||||
@Autowired
|
||||
private FileStorageService filestore;
|
||||
|
||||
@Autowired
|
||||
private BOSubsvcService service;
|
||||
@Autowired
|
||||
private BOCommonService commonService;
|
||||
@Autowired
|
||||
private BOMaComncdService boMaComncdService;
|
||||
@Autowired
|
||||
private PaginationProperties paginationProperties;
|
||||
@@ -155,6 +165,55 @@ public class SubsvcController {
|
||||
return "mngr/goods/subsvc/SubsvcU";
|
||||
}
|
||||
|
||||
/**
|
||||
* 상품 수정(상품이미지)
|
||||
* @param vo
|
||||
* @param request
|
||||
* @return
|
||||
*/
|
||||
@Policy(AuthPolicy.RESTRICTED)
|
||||
@RequestMapping(value = "/updateSubsvc", method = RequestMethod.POST, produces = MediaType.APPLICATION_JSON_VALUE)
|
||||
public ResponseEntity<WnbtResponse> updateSubsvc(BOSubsvcVO vo, HttpServletRequest request, @CookieValue(value = "authSopmalCd") String authSopmalCd) {
|
||||
vo.setSopmalCd(authSopmalCd);
|
||||
AnonymousUser user = MemberJwtContextHolder.getMemberInfo();
|
||||
vo.setUpdusr(user.getUserInnb());
|
||||
if ("01".equals(user.getSysDvCd())) {
|
||||
vo.setSopmalCd(user.getSopmalCd());
|
||||
}
|
||||
|
||||
//파일 업로드 관련 START
|
||||
List<HashMap<String, Object>> uploadFileMap = new ArrayList<HashMap<String, Object>>();
|
||||
|
||||
request.setAttribute("shopCd", vo.getSopmalCd());
|
||||
request.setAttribute("pathGubun", "GDIG"); //이미지구분코드 - 상품
|
||||
|
||||
try {
|
||||
/*파일 업로드 후 경로 추출하여 vo에 셋팅*/
|
||||
uploadFileMap = filestore.fileUpload(request);
|
||||
if(uploadFileMap.size() == 1){
|
||||
FileVo thumbNail = (FileVo) uploadFileMap.get(0).get("thumbNail");
|
||||
vo.setImg(thumbNail.getFilePath() + File.separator + thumbNail.getFileName());
|
||||
}
|
||||
} catch (WnbtRestException wre) {
|
||||
log.error(wre.getMessage(), wre);
|
||||
throw new WnbtRestException("파일 업로드에 실패했습니다." + wre.getMessage());
|
||||
} catch (Exception e) {
|
||||
log.error(e.getMessage(), e);
|
||||
throw new WnbtRestException("파일 업로드에 실패했습니다." + e.getMessage());
|
||||
}
|
||||
//파일 업로드 관련 END
|
||||
|
||||
Map<String, Object> message = new HashMap<>();
|
||||
String result = service.updateBOMngrSubsvc(vo);
|
||||
message.put("message",result);
|
||||
|
||||
return ResponseEntity.ok(
|
||||
WnbtResponse.builder()
|
||||
.resBody(new WnbtResponseBody(message))
|
||||
.build()
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* 구독서비스 목록 조회 리스트
|
||||
* @param vo
|
||||
|
||||
@@ -175,5 +175,34 @@
|
||||
</otherwise>
|
||||
</choose>
|
||||
</update>
|
||||
<!--선택된 구독서비스 수정-->
|
||||
<update id="updateBOMngrSubsvc" parameterType="com.wb.domainserver.domain.gcone.goods.subsvc.vo.BOSubsvcVO">
|
||||
UPDATE GC_SUBSVC
|
||||
SET SOPMAL_CD = #{sopmalCd}
|
||||
, SUBSVC_NM = #{subsvcNm}
|
||||
, SUB_PD = #{subPd}
|
||||
, SUBSVC_GNR_NM = #{subsvcGnrNm}
|
||||
, DLVY_CNT = REPLACE(#{dlvyCnt},',','')
|
||||
, DLVY_CYCLE = #{dlvyCycle}
|
||||
, SUBSVC_CT = REPLACE(#{subsvcCt},',','')
|
||||
, TME_DLVY_AMT = REPLACE(#{tmeDlvyAmt},',','')
|
||||
, CNSMRPRIC = REPLACE(#{cnsmrpric},',','')
|
||||
, INVNTRY_QY = REPLACE(#{invntryQy},',','')
|
||||
, INVNTRY_POLICY_CD = #{invntryPolicyCd}
|
||||
, AVLINV_LMTT_QY = #{avlinvLmttQy}
|
||||
, SUBSVC_STTUS_CD = #{subsvcSttusCd}
|
||||
, EXPSR_DV_CD = #{expsrDvCd}
|
||||
, EXPSR_BGN_DT = #{expsrBgnDt}
|
||||
, EXPSR_END_DT = #{expsrEndDt}
|
||||
, SUBSVC_DC = #{subsvcDc}
|
||||
, MBL_SUBSVC_DC = #{mblSubsvcDc}
|
||||
, MBL_SUBSVC_DC_PC_SAME_AT = #{mblSubsvcDcPcSameAt}
|
||||
<if test="@com.wb.domainserver.util.dataaccess.MybaitsUtil@isNotEmpty(img)">
|
||||
, IMG = #{img}
|
||||
</if>
|
||||
, UPDUSR = #{updusr}
|
||||
, UPDT_DT = NOW()
|
||||
WHERE SUBSVC_INNB = #{subsvcInnb}
|
||||
</update>
|
||||
|
||||
</mapper>
|
||||
|
||||
@@ -53,6 +53,8 @@
|
||||
$('[name="subsvcCt"]').on('change', fn_cal_selpric);
|
||||
$('[name="tmeDlvyAmt"]').on('change', fn_cal_selpric);
|
||||
|
||||
$('#invntryQy').on('change', fn_cal_availQt)
|
||||
|
||||
});
|
||||
|
||||
//숫자 인풋 포커스시 0 제거
|
||||
@@ -281,16 +283,23 @@
|
||||
$(obj).parent('div.file-preview').parent('div.file-preview__container').remove()
|
||||
}
|
||||
|
||||
/*자동계산*/
|
||||
/*실판매가 자동계산*/
|
||||
const fn_cal_selpric = function(){
|
||||
var dlvyCnt = $('#dlvyCnt'); //배송횟수
|
||||
var subsvcCt = $('#subsvcCt'); //구독료
|
||||
var tmeDlvyAmt = $('#tmeDlvyAmt'); //1회 배송비
|
||||
var selpric = $('#selpric'); //1회 배송비
|
||||
console.log("dlvyCnt.val()",Number(dlvyCnt.val())," tmeDlvyAmt.val()",Number(tmeDlvyAmt.val().replace(/,/g, '')),"subsvcCt.val()",subsvcCt.val().replace(/,/g, ''));
|
||||
selpric.val(((Number(dlvyCnt.val().replace(/,/g, '')) * Number(tmeDlvyAmt.val().replace(/,/g, ''))) + Number(subsvcCt.val().replace(/,/g, ''))).toLocaleString());
|
||||
}
|
||||
|
||||
/*가용재고 자동계산*/
|
||||
const fn_cal_availQt = function(){
|
||||
var invntryQy = $('#invntryQy');
|
||||
var usefulInvntryQy = $('#usefulInvntryQy');
|
||||
var availQt = $('#availQt');
|
||||
availQt.val(Number(invntryQy.val().replace(/,/g, '')) - Number(usefulInvntryQy.val().replace(/,/g, '')));
|
||||
}
|
||||
|
||||
/** 제약조건 체크 */
|
||||
const validate = function(){
|
||||
var retVal = true;
|
||||
@@ -301,7 +310,7 @@
|
||||
// 텍스트 입력 내용중 필수 항목 체크
|
||||
$(':text[required]').each(function () {
|
||||
if($(this).hasClass('number')){
|
||||
if ($(this).val().trim() == '0') {
|
||||
if ($(this).val().trim() == '' || $(this).val().trim() == '0') {
|
||||
alert($(this).prop('title')+"은(는) 필수입니다");
|
||||
$(this).focus();
|
||||
retVal = false;
|
||||
@@ -397,6 +406,7 @@
|
||||
return true;
|
||||
}
|
||||
|
||||
/*수정하기*/
|
||||
const fn_updateSubsvc = function (){
|
||||
if(!validate()){
|
||||
return false;
|
||||
@@ -452,10 +462,11 @@
|
||||
</h2>
|
||||
<div class="page-title__btn-container">
|
||||
<button onclick="fn_select_list()" class="btn outline"><spring:message code="button.list"/></button>
|
||||
<button onclick="fn_updateSubsvc();return false;" class="btn primary"><spring:message code="button.save"/></button>
|
||||
<button onclick="fn_updateSubsvc();return false;" class="btn primary"><spring:message code="button.update"/></button>
|
||||
</div>
|
||||
</div>
|
||||
<form id="subsvcForm" method="post" action="" enctype="multipart/form-data">
|
||||
<input type="hidden" id="subsvcInnb" name="subsvcInnb" value="${resultMap.subsvcDtl.subsvcInnb}">
|
||||
<input type="hidden" id="sopmalCd" name="sopmalCd" value="${resultMap.paramVO.sopmalCd}">
|
||||
<input type="hidden" id="srchSelSubsvcNm" name="srchSelSubsvcNm" value="${resultMap.paramVO.srchSelSubsvcNm}">
|
||||
<input type="hidden" id="srchSubsvcNm" name="srchSubsvcNm" value="${resultMap.paramVO.srchSubsvcNm}">
|
||||
@@ -471,6 +482,7 @@
|
||||
<input type="hidden" id="delImg" name="delImg" value="">
|
||||
<input type="hidden" id="expsrBgnDt" name="expsrBgnDt" value="${resultMap.subsvcDtl.expsrBgnDt}">
|
||||
<input type="hidden" id="expsrEndDt" name="expsrEndDt" value="${resultMap.subsvcDtl.expsrBgnDt}">
|
||||
<input type="hidden" id="usefulInvntryQy" name="usefulInvntryQy" value="${resultMap.subsvcDtl.usefulInvntryQy}">
|
||||
<spring:eval expression="@environment.getProperty('spring.servlet.multipart.max-file-size')" var="maxFileSize"/>
|
||||
<spring:eval expression="@environment.getProperty('mngrfo.common.fileupload.extensions.images')" var="acceptFileExtensions"/>
|
||||
<spring:eval expression="@environment.getProperty('mngrfo.common.fileupload.cdnurl')" var="cdnurl"/>
|
||||
@@ -604,6 +616,20 @@
|
||||
<col>
|
||||
</colgroup>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>재고<span class="red-7">*</span></th>
|
||||
<td>
|
||||
<div class="td-inner">
|
||||
<input class="input-text sm number text-right" type="text" title="재고" id="invntryQy" name="invntryQy" maxlength="11" value="${resultMap.subsvcDtl.invntryQy}" required>
|
||||
</div>
|
||||
</td>
|
||||
<th>가용재고</th>
|
||||
<td>
|
||||
<div class="td-inner">
|
||||
<input class="input-text sm number text-right" type="text" title="가용재고" id="availQt" maxlength="11" value="${resultMap.subsvcDtl.availQt}" readonly>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>판매 상태</th>
|
||||
<td colspan="2">
|
||||
@@ -645,14 +671,14 @@
|
||||
<th>노출 기간</th>
|
||||
<td>
|
||||
<div class="td-inner">
|
||||
<input type="text" id="expsrBgnDt_dt" class="datepicker" title="시작 날짜 선택" autocomplete="off" value="${fn:split(resultMap.subsvcDtl.expsrBgnDt,'T')[0]}" disabled>
|
||||
<input type="text" id="expsrBgnDt_dt" class="datepicker" title="시작 날짜 선택" autocomplete="off" value="${fn:split(resultMap.subsvcDtl.expsrBgnDt,' ')[0]}" disabled>
|
||||
<div class="timepicker-container">
|
||||
<input type="text" class="bs-timepicker" id="expsrBgnDt_time" title="시작 시간 설정" value="${fn:split(fn:split(resultMap.subsvcDtl.expsrBgnDt,'T')[1], ':')[0]}:${fn:split(fn:split(resultMap.subsvcDtl.expsrBgnDt,'T')[1], ':')[1]}" disabled>
|
||||
<input type="text" class="bs-timepicker" id="expsrBgnDt_time" title="시작 시간 설정" value="${fn:split(fn:split(resultMap.subsvcDtl.expsrBgnDt,' ')[1], ':')[0]}:${fn:split(fn:split(resultMap.subsvcDtl.expsrBgnDt,' ')[1], ':')[1]}" disabled>
|
||||
</div>
|
||||
<span class="tilde">~</span>
|
||||
<input type="text" id="expsrEndDt_dt" class="datepicker" title="종료 날짜 선택" autocomplete="off" value="${fn:split(resultMap.subsvcDtl.expsrEndDt,'T')[0]}" disabled>
|
||||
<input type="text" id="expsrEndDt_dt" class="datepicker" title="종료 날짜 선택" autocomplete="off" value="${fn:split(resultMap.subsvcDtl.expsrEndDt,' ')[0]}" disabled>
|
||||
<div class="timepicker-container">
|
||||
<input type="text" class="bs-timepicker" id="expsrEndDt_time" title="종료 시간 설정" value="${fn:split(fn:split(resultMap.subsvcDtl.expsrEndDt,'T')[1], ':')[0]}:${fn:split(fn:split(resultMap.subsvcDtl.expsrEndDt,'T')[1], ':')[1]}" disabled>
|
||||
<input type="text" class="bs-timepicker" id="expsrEndDt_time" title="종료 시간 설정" value="${fn:split(fn:split(resultMap.subsvcDtl.expsrEndDt,' ')[1], ':')[0]}:${fn:split(fn:split(resultMap.subsvcDtl.expsrEndDt,' ')[1], ':')[1]}" disabled>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
|
||||
Reference in New Issue
Block a user