mirror of
http://git.mhez-qa.uplus.co.kr/hubez/hubez-admin.git
synced 2025-12-07 05:39:35 +09:00
공지사항 삭제 기능 추가
This commit is contained in:
@@ -98,16 +98,6 @@
|
|||||||
</div>
|
</div>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
|
||||||
<th style="width: 10%">
|
|
||||||
이미지셋 <br />
|
|
||||||
<button type="button" @click="setImg">이미지추가</button>
|
|
||||||
<button type="button" @click="testImg = ''">이미지클리어</button>
|
|
||||||
</th>
|
|
||||||
<td class="sender" colspan="5">
|
|
||||||
<p v-html="testImg"></p>
|
|
||||||
</td>
|
|
||||||
</tr>
|
|
||||||
</tbody>
|
</tbody>
|
||||||
</table>
|
</table>
|
||||||
</form>
|
</form>
|
||||||
@@ -133,7 +123,6 @@ export default {
|
|||||||
mixins: [utils_mixin, chkPattern2],
|
mixins: [utils_mixin, chkPattern2],
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
testImg: '',
|
|
||||||
props: {},
|
props: {},
|
||||||
row: {},
|
row: {},
|
||||||
rsnType: [],
|
rsnType: [],
|
||||||
@@ -177,11 +166,6 @@ export default {
|
|||||||
ValidationConfirmPopup,
|
ValidationConfirmPopup,
|
||||||
},
|
},
|
||||||
methods: {
|
methods: {
|
||||||
setImg() {
|
|
||||||
///%7Cefs%7Chome%7CsendMessage%7C2022%7C09%7C20%7C10%7C2022092010000168664_1.jpg
|
|
||||||
this.testImg =
|
|
||||||
"<img src='/api/v1/bo/homeMgt/preview/%7Cefs%7Chome%7CsendMessage%7C2022%7C09%7C20%7C10%7C2022092010000168664_1.jpg' />";
|
|
||||||
},
|
|
||||||
handleImageAdded(file, Editor, cursorLocation, resetUploader) {
|
handleImageAdded(file, Editor, cursorLocation, resetUploader) {
|
||||||
var fd = new FormData();
|
var fd = new FormData();
|
||||||
fd.append('files', file);
|
fd.append('files', file);
|
||||||
@@ -189,8 +173,9 @@ export default {
|
|||||||
homeMgtApi
|
homeMgtApi
|
||||||
.getImageUrl(fd)
|
.getImageUrl(fd)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const url = '..' + response.data.data.replaceAll('\\', '/'); // Get url from response
|
const url =
|
||||||
console.log(url);
|
'/api/v1/bo/homeMgt/preview/' +
|
||||||
|
encodeURIComponent(response.data.data.replaceAll('\\', '/').replaceAll('/', '|')); // Get url from response
|
||||||
Editor.insertEmbed(cursorLocation, 'image', url);
|
Editor.insertEmbed(cursorLocation, 'image', url);
|
||||||
resetUploader();
|
resetUploader();
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -188,8 +188,9 @@ export default {
|
|||||||
homeMgtApi
|
homeMgtApi
|
||||||
.getImageUrl(fd)
|
.getImageUrl(fd)
|
||||||
.then((response) => {
|
.then((response) => {
|
||||||
const url = '..' + response.data.data.replaceAll('\\', '/'); // Get url from response
|
const url =
|
||||||
console.log(url);
|
'/api/v1/bo/homeMgt/preview/' +
|
||||||
|
encodeURIComponent(response.data.data.replaceAll('\\', '/').replaceAll('/', '|')); // Get url from response
|
||||||
Editor.insertEmbed(cursorLocation, 'image', url);
|
Editor.insertEmbed(cursorLocation, 'image', url);
|
||||||
resetUploader();
|
resetUploader();
|
||||||
})
|
})
|
||||||
@@ -502,7 +503,6 @@ export default {
|
|||||||
this.row.fileTitle = fileTitle;
|
this.row.fileTitle = fileTitle;
|
||||||
this.row.filePath = filePath;
|
this.row.filePath = filePath;
|
||||||
this.row.fileNm = fileName;
|
this.row.fileNm = fileName;
|
||||||
console.log(this.row);
|
|
||||||
homeMgtApi.fileDownload(this.row);
|
homeMgtApi.fileDownload(this.row);
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|||||||
@@ -15,6 +15,11 @@ const updateNotice = (params) => {
|
|||||||
return httpClient.post('/api/v1/bo/homeMgt/updateNotice', params, { withCredentials: false });
|
return httpClient.post('/api/v1/bo/homeMgt/updateNotice', params, { withCredentials: false });
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// 공지사항 삭제
|
||||||
|
const deleteNotice = (params) => {
|
||||||
|
return httpClient.post('/api/v1/bo/homeMgt/deleteNotice', params, { withCredentials: false });
|
||||||
|
};
|
||||||
|
|
||||||
const getImageUrl = (params) => {
|
const getImageUrl = (params) => {
|
||||||
return httpClient.post('/api/v1/bo/homeMgt/getImageUrl', params, {
|
return httpClient.post('/api/v1/bo/homeMgt/getImageUrl', params, {
|
||||||
headers: {
|
headers: {
|
||||||
@@ -56,6 +61,7 @@ const fileDownload = (params) => {
|
|||||||
export default {
|
export default {
|
||||||
insertNotice,
|
insertNotice,
|
||||||
updateNotice,
|
updateNotice,
|
||||||
|
deleteNotice,
|
||||||
fileDownload,
|
fileDownload,
|
||||||
getImageUrl,
|
getImageUrl,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -45,6 +45,7 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="button_group">
|
<div class="button_group">
|
||||||
<button type="button" class="button blue admin add" @click="ModalOpen()">공지사항 등록</button>
|
<button type="button" class="button blue admin add" @click="ModalOpen()">공지사항 등록</button>
|
||||||
|
<button type="button" class="button white del" @click="deleteNotice()">삭제</button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="table">
|
<div class="table">
|
||||||
@@ -65,13 +66,16 @@
|
|||||||
</div>
|
</div>
|
||||||
<NoticePop ref="NoticePop" />
|
<NoticePop ref="NoticePop" />
|
||||||
<NoticeUpdatePop ref="NoticeUpdatePop" />
|
<NoticeUpdatePop ref="NoticeUpdatePop" />
|
||||||
|
<common-modal ref="commmonModal"></common-modal>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
<script>
|
<script>
|
||||||
import httpClient from '../../../common/http-client';
|
import httpClient from '../../../common/http-client';
|
||||||
import customGrid from '@/components/CustomGrid';
|
import customGrid from '@/components/CustomGrid';
|
||||||
|
import commonModal from '@/components/modal/commonModal';
|
||||||
import NoticePop from '../components/NoticePop.vue';
|
import NoticePop from '../components/NoticePop.vue';
|
||||||
import NoticeUpdatePop from '../components/NoticeUpdatePop.vue';
|
import NoticeUpdatePop from '../components/NoticeUpdatePop.vue';
|
||||||
|
import homeMgtApi from '../service/homeMgtApi';
|
||||||
|
|
||||||
class CustomATagRenderer {
|
class CustomATagRenderer {
|
||||||
constructor(props) {
|
constructor(props) {
|
||||||
@@ -98,9 +102,10 @@ class CustomATagRenderer {
|
|||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: 'notice',
|
name: 'notice',
|
||||||
components: { customGrid, NoticePop, NoticeUpdatePop },
|
components: { customGrid, NoticePop, NoticeUpdatePop, commonModal },
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
|
row: {},
|
||||||
totalItems: 0,
|
totalItems: 0,
|
||||||
perPageCnt: 50,
|
perPageCnt: 50,
|
||||||
searchType1: '',
|
searchType1: '',
|
||||||
@@ -214,6 +219,48 @@ export default {
|
|||||||
this.grid.pagePerRows = this.perPageCnt;
|
this.grid.pagePerRows = this.perPageCnt;
|
||||||
this.search(true);
|
this.search(true);
|
||||||
},
|
},
|
||||||
|
deleteNotice() {
|
||||||
|
var chkList = this.$refs.table.checkedElementDatas();
|
||||||
|
if (chkList.length == 0) {
|
||||||
|
this.row.title = '공지사항 관리';
|
||||||
|
this.row.msg1 = '삭제 대상을 체크를 해주세요.';
|
||||||
|
this.$refs.commmonModal.alertModalOpen(this.row);
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
//const param = chkList.map((row)=>({regReqNo:row.regReqNo} ));
|
||||||
|
const param = chkList.map((row) => ({ ntNo: row.ntNo }));
|
||||||
|
this.row.list = param;
|
||||||
|
|
||||||
|
this.row.title = '공지사항 관리';
|
||||||
|
this.row.msg1 = '삭제 하시겠습니까?';
|
||||||
|
this.$refs.commmonModal.confirmModalOpen2(this.row);
|
||||||
|
|
||||||
|
console.log(typeof this.row.list[0].ntNo);
|
||||||
|
//this.$refs.commmonModal.confirmModalOpen2(this.row);
|
||||||
|
},
|
||||||
|
confirmCalbackFnc(props) {
|
||||||
|
if (props.result) {
|
||||||
|
this.noticeDelete();
|
||||||
|
}
|
||||||
|
},
|
||||||
|
async noticeDelete() {
|
||||||
|
try {
|
||||||
|
let response = await homeMgtApi.deleteNotice(this.row);
|
||||||
|
const result = response.data;
|
||||||
|
if (result != null && result.retCode == '0000') {
|
||||||
|
this.$refs.table.reloadData();
|
||||||
|
return;
|
||||||
|
} else {
|
||||||
|
this.row.title = '공지사항 관리';
|
||||||
|
this.row.msg1 = '실패 하였습니다.';
|
||||||
|
this.$refs.commmonModal.alertModalOpen(this.row);
|
||||||
|
}
|
||||||
|
} catch (err) {
|
||||||
|
this.row.title = '공지사항 관리';
|
||||||
|
this.row.msg1 = '실패 하였습니다.';
|
||||||
|
this.$refs.commmonModal.alertModalOpen(this.row);
|
||||||
|
}
|
||||||
|
},
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
</script>
|
</script>
|
||||||
|
|||||||
@@ -38,12 +38,14 @@ import org.springframework.web.bind.annotation.RestController;
|
|||||||
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
import org.springframework.web.multipart.MultipartHttpServletRequest;
|
||||||
|
|
||||||
import kr.co.uplus.ez.api.homeMgt.dto.*;
|
import kr.co.uplus.ez.api.homeMgt.dto.*;
|
||||||
|
import kr.co.uplus.ez.api.sendNumMgt.dto.DeleteNumberReqDto;
|
||||||
|
import kr.co.uplus.ez.api.sendNumMgt.dto.DeleteNumberResDto;
|
||||||
import kr.co.uplus.ez.common.components.ValidComponents;
|
import kr.co.uplus.ez.common.components.ValidComponents;
|
||||||
import kr.co.uplus.ez.common.data.ApiResponseCode;
|
import kr.co.uplus.ez.common.data.ApiResponseCode;
|
||||||
import kr.co.uplus.ez.common.utils.FileIoUtils;
|
import kr.co.uplus.ez.common.utils.FileIoUtils;
|
||||||
|
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping(value ="api/v1/bo/homeMgt")
|
@RequestMapping(value = "/api/v1/bo/homeMgt")
|
||||||
public class HomeMgtController {
|
public class HomeMgtController {
|
||||||
private static final Logger logger = LoggerFactory.getLogger(HomeMgtController.class);
|
private static final Logger logger = LoggerFactory.getLogger(HomeMgtController.class);
|
||||||
|
|
||||||
@@ -53,19 +55,18 @@ public class HomeMgtController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
ValidComponents validComponents;
|
ValidComponents validComponents;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* date : 2022. 10. 18.
|
* date : 2022. 10. 18. auth : kjh desc : 공지사항 조회.
|
||||||
* auth : kjh
|
*
|
||||||
* desc : 공지사항 조회.
|
|
||||||
* @param noticeListReqDto
|
* @param noticeListReqDto
|
||||||
* @return NoticeListResDto
|
* @return NoticeListResDto
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "noticeList", notes = "공지사항 조회")
|
@ApiOperation(value = "/noticeList", notes = "공지사항 조회")
|
||||||
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
||||||
@RequestMapping(value = "noticeList", method = {RequestMethod.POST})
|
@RequestMapping(value = "/noticeList", method = { RequestMethod.POST })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public NoticeListResDto noticeList(@RequestBody @Valid NoticeListReqDto noticeListReqDto, BindingResult bindingResult, HttpServletResponse response) {
|
public NoticeListResDto noticeList(@RequestBody @Valid NoticeListReqDto noticeListReqDto,
|
||||||
|
BindingResult bindingResult, HttpServletResponse response) {
|
||||||
|
|
||||||
if (validComponents.validParameter(bindingResult)) {
|
if (validComponents.validParameter(bindingResult)) {
|
||||||
return new NoticeListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
|
return new NoticeListResDto(ApiResponseCode.CM_PARAMETER_ERROR);
|
||||||
@@ -75,32 +76,30 @@ public class HomeMgtController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* date : 2022. 10. 21.
|
* date : 2022. 10. 21. auth : kjh desc : 공지사항 등록.
|
||||||
* auth : kjh
|
*
|
||||||
* desc : 공지사항 등록.
|
|
||||||
* @param insertNoticeReqDto
|
* @param insertNoticeReqDto
|
||||||
* @return InsertNoticeResDto
|
* @return InsertNoticeResDto
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "insertNotice", notes = "공지사항 등록")
|
@ApiOperation(value = "/insertNotice", notes = "공지사항 등록")
|
||||||
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
||||||
@RequestMapping(value = "insertNotice", method = {RequestMethod.POST})
|
@RequestMapping(value = "/insertNotice", method = { RequestMethod.POST })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public InsertNoticeResDto insertNotice(@RequestPart(value = "key") InsertNoticeReqDto insertNoticeReqDto,
|
public InsertNoticeResDto insertNotice(@RequestPart(value = "key") InsertNoticeReqDto insertNoticeReqDto,
|
||||||
MultipartHttpServletRequest multipartRequest) {
|
MultipartHttpServletRequest multipartRequest) {
|
||||||
|
|
||||||
return homeService.insertNotice(insertNoticeReqDto ,multipartRequest);
|
return homeService.insertNotice(insertNoticeReqDto, multipartRequest);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* date : 2022. 10. 24.
|
* date : 2022. 10. 24. auth : kjh desc : 공지사항 수정.
|
||||||
* auth : kjh
|
*
|
||||||
* desc : 공지사항 수정.
|
|
||||||
* @param updateNoticeReqDto
|
* @param updateNoticeReqDto
|
||||||
* @return UpdateNoticeResDto
|
* @return UpdateNoticeResDto
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "updateNotice", notes = "공지사항 수정")
|
@ApiOperation(value = "/updateNotice", notes = "공지사항 수정")
|
||||||
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
||||||
@RequestMapping(value = "updateNotice", method = {RequestMethod.POST})
|
@RequestMapping(value = "/updateNotice", method = { RequestMethod.POST })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public UpdateNoticeResDto updateNotice(@RequestPart(value = "key") UpdateNoticeReqDto updateNoticeReqDto,
|
public UpdateNoticeResDto updateNotice(@RequestPart(value = "key") UpdateNoticeReqDto updateNoticeReqDto,
|
||||||
MultipartHttpServletRequest multipartRequest) {
|
MultipartHttpServletRequest multipartRequest) {
|
||||||
@@ -111,13 +110,31 @@ public class HomeMgtController {
|
|||||||
/**
|
/**
|
||||||
* date : 2022. 10. 24.
|
* date : 2022. 10. 24.
|
||||||
* auth : kjh
|
* auth : kjh
|
||||||
* desc : 공지사항 editor 이미지 업로드 후 링크 리턴.
|
* desc : 공지사항 삭제.
|
||||||
|
* @param deleteNoticeReqDto
|
||||||
|
* @return DeleteNoticeResDto
|
||||||
|
*/
|
||||||
|
@ApiOperation(value = "/deleteNotice", notes = "공지사항 삭제")
|
||||||
|
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
||||||
|
@RequestMapping(value = "/deleteNotice", method = { RequestMethod.POST })
|
||||||
|
@ResponseBody
|
||||||
|
public DeleteNoticeResDto deleteNotice(@RequestBody @Valid DeleteNoticeReqDto deleteNoticeReqDto, BindingResult bindingResult) {
|
||||||
|
if (validComponents.validParameter(bindingResult)) {
|
||||||
|
return new DeleteNoticeResDto(ApiResponseCode.CM_PARAMETER_ERROR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return homeService.deleteNotice(deleteNoticeReqDto);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* date : 2022. 10. 24. auth : kjh desc : 공지사항 editor 이미지 업로드 후 링크 리턴.
|
||||||
|
*
|
||||||
* @param updateNoticeReqDto
|
* @param updateNoticeReqDto
|
||||||
* @return UpdateNoticeResDto
|
* @return UpdateNoticeResDto
|
||||||
*/
|
*/
|
||||||
@ApiOperation(value = "getImageUrl", notes = "공지사항 editor 이미지 업로드 후 링크 리턴")
|
@ApiOperation(value = "/getImageUrl", notes = "공지사항 editor 이미지 업로드 후 링크 리턴")
|
||||||
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
|
||||||
@RequestMapping(value = "getImageUrl", method = {RequestMethod.POST})
|
@RequestMapping(value = "/getImageUrl", method = { RequestMethod.POST })
|
||||||
@ResponseBody
|
@ResponseBody
|
||||||
public FileResDto fileResDto(MultipartHttpServletRequest multipartRequest) {
|
public FileResDto fileResDto(MultipartHttpServletRequest multipartRequest) {
|
||||||
|
|
||||||
@@ -126,26 +143,25 @@ public class HomeMgtController {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 파일 다운로드
|
* 파일 다운로드
|
||||||
|
*
|
||||||
* @throws IOException
|
* @throws IOException
|
||||||
*/
|
*/
|
||||||
@SuppressWarnings("rawtypes")
|
@SuppressWarnings("rawtypes")
|
||||||
@RequestMapping("filedownload")
|
@RequestMapping("filedownload")
|
||||||
public void filedownload(@RequestBody LinkedHashMap param, HttpServletRequest request, HttpServletResponse response) throws IOException {
|
public void filedownload(@RequestBody LinkedHashMap param, HttpServletRequest request, HttpServletResponse response)
|
||||||
|
throws IOException {
|
||||||
logger.debug(param.toString());
|
logger.debug(param.toString());
|
||||||
|
|
||||||
File file = new File(param.get("filePath") + File.separator + param.get("fileNm"));
|
File file = new File(param.get("filePath") + File.separator + param.get("fileNm"));
|
||||||
System.out.println("file ::::: " +file);
|
|
||||||
System.out.println("file.exists() ::::: " + file.exists());
|
|
||||||
if (file.exists()) {
|
if (file.exists()) {
|
||||||
FileIoUtils.fileDownload(file, request, response );
|
FileIoUtils.fileDownload(file, request, response);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiOperation(value = "이미지 미리보기", notes = "이미지 미리보기")
|
@ApiOperation(value = "이미지 미리보기", notes = "이미지 미리보기")
|
||||||
@GetMapping(value = "/preview/{imgurl}", produces=MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
@GetMapping(value = "/preview/{imgurl}", produces = MediaType.APPLICATION_OCTET_STREAM_VALUE)
|
||||||
public ResponseEntity<byte[]> previewImageResource(@PathVariable @ApiParam(value = "이미지 경로") String imgurl) {
|
public ResponseEntity<byte[]> previewImageResource(@PathVariable @ApiParam(value = "이미지 경로") String imgurl) {
|
||||||
System.out.println("imgurl :::: " + imgurl);
|
|
||||||
System.out.println("call previewImageResource");
|
|
||||||
try {
|
try {
|
||||||
String imgurldec = URLDecoder.decode(imgurl);
|
String imgurldec = URLDecoder.decode(imgurl);
|
||||||
|
|
||||||
@@ -157,19 +173,18 @@ public class HomeMgtController {
|
|||||||
|
|
||||||
String fileNameOnly = imgurlreplace;
|
String fileNameOnly = imgurlreplace;
|
||||||
String[] fileNameArr = imgurlreplace.split("/");
|
String[] fileNameArr = imgurlreplace.split("/");
|
||||||
if(fileNameArr != null && fileNameArr.length != 0) fileNameOnly = fileNameArr[fileNameArr.length-1];
|
if (fileNameArr != null && fileNameArr.length != 0)
|
||||||
|
fileNameOnly = fileNameArr[fileNameArr.length - 1];
|
||||||
|
|
||||||
HttpHeaders headers = new HttpHeaders();
|
HttpHeaders headers = new HttpHeaders();
|
||||||
headers.setContentDisposition(
|
headers.setContentDisposition(
|
||||||
ContentDisposition.builder("attachment")
|
ContentDisposition.builder("attachment").filename(fileNameOnly, StandardCharsets.UTF_8).build());
|
||||||
.filename(fileNameOnly, StandardCharsets.UTF_8)
|
|
||||||
.build());
|
|
||||||
headers.add(HttpHeaders.CONTENT_TYPE, contentType);
|
headers.add(HttpHeaders.CONTENT_TYPE, contentType);
|
||||||
|
|
||||||
byte[] b = Files.readAllBytes(path);
|
byte[] b = Files.readAllBytes(path);
|
||||||
|
|
||||||
return new ResponseEntity<byte[]>(b, headers, HttpStatus.OK);
|
return new ResponseEntity<byte[]>(b, headers, HttpStatus.OK);
|
||||||
}catch(Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("imgurl err, e={}, e", e.getMessage());
|
logger.error("imgurl err, e={}, e", e.getMessage());
|
||||||
return new ResponseEntity<byte[]>(HttpStatus.NOT_FOUND);
|
return new ResponseEntity<byte[]>(HttpStatus.NOT_FOUND);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package kr.co.uplus.ez.api.homeMgt;
|
package kr.co.uplus.ez.api.homeMgt;
|
||||||
|
|
||||||
import kr.co.uplus.ez.api.homeMgt.dto.*;
|
import kr.co.uplus.ez.api.homeMgt.dto.*;
|
||||||
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
import org.apache.ibatis.annotations.Mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
@@ -26,4 +27,6 @@ public interface HomeMgtMapper {
|
|||||||
|
|
||||||
void delNoticeFile(DelNoticeReqDto delNoticeReqDto);
|
void delNoticeFile(DelNoticeReqDto delNoticeReqDto);
|
||||||
|
|
||||||
|
int deleteNotice(DeleteNoticeReqDto deleteNoticeReqDto);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,8 +7,6 @@ import kr.co.uplus.ez.common.utils.DateUtils;
|
|||||||
import kr.co.uplus.ez.common.utils.FileIoUtils;
|
import kr.co.uplus.ez.common.utils.FileIoUtils;
|
||||||
import kr.co.uplus.ez.common.utils.FileUtil;
|
import kr.co.uplus.ez.common.utils.FileUtil;
|
||||||
|
|
||||||
//import kr.co.uplus.ez.common.utils.EncryptionUtil;
|
|
||||||
//import org.apache.commons.lang3.StringUtils;
|
|
||||||
import org.mybatis.spring.SqlSessionTemplate;
|
import org.mybatis.spring.SqlSessionTemplate;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
@@ -21,9 +19,8 @@ import org.springframework.web.multipart.MultipartHttpServletRequest;
|
|||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
//import java.util.HashMap;
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
//import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class HomeMgtService {
|
public class HomeMgtService {
|
||||||
@@ -144,8 +141,6 @@ public class HomeMgtService {
|
|||||||
insertNoticeFileDto.setRegId(insertNoticeReqDto.getRegId());
|
insertNoticeFileDto.setRegId(insertNoticeReqDto.getRegId());
|
||||||
insertNoticeFileDto.setChgId(insertNoticeReqDto.getRegId());
|
insertNoticeFileDto.setChgId(insertNoticeReqDto.getRegId());
|
||||||
|
|
||||||
System.out.println("insertNoticeFileDto.getFilePath() :::: " + insertNoticeFileDto.getFilePath());
|
|
||||||
|
|
||||||
homeMgtMapper.insertNoticeFile(insertNoticeFileDto);
|
homeMgtMapper.insertNoticeFile(insertNoticeFileDto);
|
||||||
idx++;
|
idx++;
|
||||||
}
|
}
|
||||||
@@ -171,9 +166,6 @@ public class HomeMgtService {
|
|||||||
List<MultipartFile> files = multipartRequest.getFiles("files");
|
List<MultipartFile> files = multipartRequest.getFiles("files");
|
||||||
String yyyyMMddHHmmss = DateUtils.date2strYMDHMS();
|
String yyyyMMddHHmmss = DateUtils.date2strYMDHMS();
|
||||||
|
|
||||||
System.out.println(" files len :::: " + files.size());
|
|
||||||
System.out.println(" legacyFiles :::: " + updateNoticeReqDto.getLegacyFiles());
|
|
||||||
|
|
||||||
// 공지사항 수정
|
// 공지사항 수정
|
||||||
try {
|
try {
|
||||||
homeMgtMapper.updateNotice(updateNoticeReqDto);
|
homeMgtMapper.updateNotice(updateNoticeReqDto);
|
||||||
@@ -228,15 +220,11 @@ public class HomeMgtService {
|
|||||||
if(!updateNoticeReqDto.getDelFileNo().isEmpty()) {
|
if(!updateNoticeReqDto.getDelFileNo().isEmpty()) {
|
||||||
String[] delFile = updateNoticeReqDto.getDelFileNo().split(",");
|
String[] delFile = updateNoticeReqDto.getDelFileNo().split(",");
|
||||||
for(int j=0; j<delFile.length; j++){
|
for(int j=0; j<delFile.length; j++){
|
||||||
System.out.println("delFile :::: " + delFile[j]);
|
|
||||||
DelNoticeReqDto delNoticeReqDto = new DelNoticeReqDto();
|
DelNoticeReqDto delNoticeReqDto = new DelNoticeReqDto();
|
||||||
delNoticeReqDto.setFileNo(Integer.parseInt(delFile[j]));
|
delNoticeReqDto.setFileNo(Integer.parseInt(delFile[j]));
|
||||||
delNoticeReqDto.setNtNo(updateNoticeReqDto.getNtNo());
|
delNoticeReqDto.setNtNo(updateNoticeReqDto.getNtNo());
|
||||||
System.out.println(delNoticeReqDto);
|
|
||||||
homeMgtMapper.delNoticeFile(delNoticeReqDto);
|
homeMgtMapper.delNoticeFile(delNoticeReqDto);
|
||||||
}
|
}
|
||||||
}else {
|
|
||||||
System.out.println("파일이 빈 상태입니다.");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return new UpdateNoticeResDto(ApiResponseCode.SUCCESS);
|
return new UpdateNoticeResDto(ApiResponseCode.SUCCESS);
|
||||||
@@ -254,9 +242,7 @@ public class HomeMgtService {
|
|||||||
HomeMgtMapper homeMgtMapper = sqlSessionSlave.getMapper(HomeMgtMapper.class);
|
HomeMgtMapper homeMgtMapper = sqlSessionSlave.getMapper(HomeMgtMapper.class);
|
||||||
|
|
||||||
List<MultipartFile> files = multipartRequest.getFiles("files");
|
List<MultipartFile> files = multipartRequest.getFiles("files");
|
||||||
System.out.println(" files len :::: " + files.size());
|
|
||||||
String yyyyMMddHHmmss = DateUtils.date2strYMDHMS();
|
String yyyyMMddHHmmss = DateUtils.date2strYMDHMS();
|
||||||
|
|
||||||
String yyyyMMdd = DateUtils.date2strYMD(); // Path : efs/admin/notice/yyyy/mm/
|
String yyyyMMdd = DateUtils.date2strYMD(); // Path : efs/admin/notice/yyyy/mm/
|
||||||
String path = noticeFilePath + yyyyMMdd.substring(0, 4) +
|
String path = noticeFilePath + yyyyMMdd.substring(0, 4) +
|
||||||
File.separator + yyyyMMdd.substring(4, 6) +
|
File.separator + yyyyMMdd.substring(4, 6) +
|
||||||
@@ -272,8 +258,7 @@ public class HomeMgtService {
|
|||||||
String fileNm = yyyyMMddHHmmss + "_noticeEditFile." + ext;
|
String fileNm = yyyyMMddHHmmss + "_noticeEditFile." + ext;
|
||||||
// File Upload.
|
// File Upload.
|
||||||
FileUtil.upload(files.get(i), fileNm, path);
|
FileUtil.upload(files.get(i), fileNm, path);
|
||||||
path = path.replace("C:/Users/admin/git/hubez-admin/frontend/public", "");
|
uploadFile = path + File.separator + fileNm;
|
||||||
uploadFile = path.replace("\\","/") + File.separator + fileNm;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}catch(Exception e) {
|
}catch(Exception e) {
|
||||||
@@ -283,4 +268,24 @@ public class HomeMgtService {
|
|||||||
return new FileResDto(ApiResponseCode.SUCCESS, uploadFile);
|
return new FileResDto(ApiResponseCode.SUCCESS, uploadFile);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* date : 2022. 11. 02.
|
||||||
|
* auth : kjh
|
||||||
|
* desc : 공지사항 삭제
|
||||||
|
* @param deleteNoticeReqDto
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public DeleteNoticeResDto deleteNotice(DeleteNoticeReqDto deleteNoticeReqDto) {
|
||||||
|
|
||||||
|
HomeMgtMapper homeMgtMapper = sqlSessionSlave.getMapper(HomeMgtMapper.class);
|
||||||
|
|
||||||
|
try {
|
||||||
|
homeMgtMapper.deleteNotice(deleteNoticeReqDto);
|
||||||
|
} catch (Exception e) {
|
||||||
|
return new DeleteNoticeResDto(ApiResponseCode.CM_DB_QUERY_ERR);
|
||||||
|
}
|
||||||
|
|
||||||
|
return new DeleteNoticeResDto(ApiResponseCode.SUCCESS);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package kr.co.uplus.ez.api.homeMgt.dto;
|
package kr.co.uplus.ez.api.homeMgt.dto;
|
||||||
|
|
||||||
import java.io.Serializable;
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
import io.swagger.annotations.ApiModelProperty;
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|||||||
@@ -0,0 +1,15 @@
|
|||||||
|
package kr.co.uplus.ez.api.homeMgt.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import io.swagger.annotations.ApiModelProperty;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
@Data
|
||||||
|
public class DeleteNotice implements Serializable{
|
||||||
|
|
||||||
|
@ApiModelProperty(example = "공지사항 번호", name = "공지사항 번호", dataType = "int")
|
||||||
|
private int ntNo;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
package kr.co.uplus.ez.api.homeMgt.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
@Data
|
||||||
|
public class DeleteNoticeReqDto implements Serializable{
|
||||||
|
|
||||||
|
private List<DeleteNotice> list;
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,32 @@
|
|||||||
|
package kr.co.uplus.ez.api.homeMgt.dto;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
import kr.co.uplus.ez.common.data.ApiResponseCode;
|
||||||
|
import kr.co.uplus.ez.common.data.ResponseMessage;
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
@SuppressWarnings("serial")
|
||||||
|
@Data
|
||||||
|
public class DeleteNoticeResDto extends ResponseMessage implements Serializable{
|
||||||
|
|
||||||
|
|
||||||
|
// 데이터.
|
||||||
|
private Object data;
|
||||||
|
|
||||||
|
public DeleteNoticeResDto() {
|
||||||
|
this.retCode = ApiResponseCode.SUCCESS.getResultCode();
|
||||||
|
this.retMsg = ApiResponseCode.SUCCESS.getResultMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeleteNoticeResDto(ApiResponseCode returnStr) {
|
||||||
|
this.retCode = returnStr.getResultCode();
|
||||||
|
this.retMsg = returnStr.getResultMsg();
|
||||||
|
}
|
||||||
|
|
||||||
|
public DeleteNoticeResDto(ApiResponseCode returnStr, Object data) {
|
||||||
|
this.retCode = returnStr.getResultCode();
|
||||||
|
this.retMsg = returnStr.getResultMsg();
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -196,11 +196,27 @@
|
|||||||
|
|
||||||
<!-- 첨부파일 삭제 -->
|
<!-- 첨부파일 삭제 -->
|
||||||
<delete id="delNoticeFile" parameterType="kr.co.uplus.ez.api.homeMgt.dto.DelNoticeReqDto">
|
<delete id="delNoticeFile" parameterType="kr.co.uplus.ez.api.homeMgt.dto.DelNoticeReqDto">
|
||||||
|
/* homeMgt-mapper.xml(delNoticeFile) */
|
||||||
DELETE FROM hubez_common.EZ_BBS_FATC
|
DELETE FROM hubez_common.EZ_BBS_FATC
|
||||||
WHERE BBS_NO = #{ntNo}
|
WHERE BBS_NO = #{ntNo}
|
||||||
AND FILE_NO = #{fileNo}
|
AND FILE_NO = #{fileNo}
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<!-- 공지사항 삭제 -->
|
||||||
|
<delete id="deleteNotice" parameterType="kr.co.uplus.ez.api.homeMgt.dto.DeleteNoticeReqDto">
|
||||||
|
/* homeMgt-mapper.xml(deleteNotice) */
|
||||||
|
DELETE
|
||||||
|
FROM
|
||||||
|
hubez_common.EZ_NTBBS
|
||||||
|
<where>
|
||||||
|
NT_NO IN
|
||||||
|
<foreach collection="list" item="item" index="i" open="("
|
||||||
|
separator="," close=")">
|
||||||
|
#{item.ntNo}
|
||||||
|
</foreach>
|
||||||
|
</where>
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
|
||||||
<sql id="NoticeListCondition">
|
<sql id="NoticeListCondition">
|
||||||
<if test="searchType1 != null and searchType1 != ''">
|
<if test="searchType1 != null and searchType1 != ''">
|
||||||
|
|||||||
Reference in New Issue
Block a user