로그인 및 메인 화면 수정 변경

This commit is contained in:
kimre
2022-07-10 20:53:26 +09:00
parent b2ff509948
commit fb40f49f09
61 changed files with 3660 additions and 1174 deletions

View File

@@ -5,28 +5,21 @@
*/
package kr.co.uplus.ez.api.calculate;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import kr.co.uplus.ez.api.calculate.dto.CalcListExcelReqDto;
import kr.co.uplus.ez.api.calculate.dto.CalcListExcelResDto;
import kr.co.uplus.ez.api.calculate.dto.CalcListReqDto;
import kr.co.uplus.ez.api.calculate.dto.CalcListResDto;
import kr.co.uplus.ez.api.stats.dto.BsnmMonthListResDto;
import kr.co.uplus.ez.common.components.ValidComponents;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ApiResponseMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
@RestController
@RequestMapping(value = "api/v1/bo/calculate")
@@ -41,9 +34,8 @@ public class CalculateController {
* date : 2022. 4. 25.
* auth : ckr
* desc : 정산 이력 목록 조회
* @param paramMap
* @param calcListReqDto
* @return
* @throws Exception
*/
@ApiOperation(value = "calcList", notes = "정산 이력 목록 조회")
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
@@ -60,13 +52,15 @@ public class CalculateController {
* date : 2022. 4. 25.
* auth : ckr
* desc : 정산 이력 목록 엑셀 다운로드
* @param paramMap
* @param calcListExcelReqDto
* @return
* @throws Exception
*/
@RequestMapping(value = "/calcListExcel" , method = {RequestMethod.POST})
@ResponseBody
public ApiResponseMessage calcListExcel(@RequestBody Map<String, Object> paramMap) throws Exception{
return calculateService.calcListExcel(paramMap);
public CalcListExcelResDto calcListExcel(@RequestBody @Valid CalcListExcelReqDto calcListExcelReqDto, BindingResult bindingResult){
if (validComponents.validParameter(bindingResult)) {
return new CalcListExcelResDto(ApiResponseCode.CM_PARAMETER_ERROR);
}
return calculateService.calcListExcel(calcListExcelReqDto);
}
}

View File

@@ -1,11 +1,11 @@
package kr.co.uplus.ez.api.calculate;
import java.util.List;
import kr.co.uplus.ez.api.calculate.dto.CalcList;
import kr.co.uplus.ez.api.calculate.dto.CalcListExcelReqDto;
import kr.co.uplus.ez.api.calculate.dto.CalcListReqDto;
import org.apache.ibatis.annotations.Mapper;
import kr.co.uplus.ez.api.calculate.dto.CalcList;
import kr.co.uplus.ez.api.calculate.dto.CalcListReqDto;
import java.util.List;
@Mapper
public interface CalculateMapper {
@@ -14,4 +14,6 @@ public interface CalculateMapper {
int selectCalculateListTotalCnt(CalcListReqDto calcListReqDto);
List<CalcList> selectCalculateExcelList(CalcListExcelReqDto calcListExcelReqDto);
}

View File

@@ -1,24 +1,15 @@
package kr.co.uplus.ez.api.calculate;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import kr.co.uplus.ez.api.calculate.dto.*;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.Paging;
import org.mybatis.spring.SqlSessionTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;
import kr.co.uplus.ez.api.calculate.dto.CalcList;
import kr.co.uplus.ez.api.calculate.dto.CalcListReqDto;
import kr.co.uplus.ez.api.calculate.dto.CalcListRes;
import kr.co.uplus.ez.api.calculate.dto.CalcListResDto;
import kr.co.uplus.ez.api.stats.dto.BsnmMonthList;
import kr.co.uplus.ez.api.stats.dto.BsnmMonthListRes;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ApiResponseMessage;
import kr.co.uplus.ez.common.data.Paging;
import java.util.ArrayList;
import java.util.List;
@Service
public class CalculateService {
@@ -35,7 +26,7 @@ public class CalculateService {
* date : 2022. 4. 25.
* auth : ckr
* desc : 정산 이력 목록 조회
* @param paramMap
* @param calcListReqDto
* @return
*/
public CalcListResDto calcList(CalcListReqDto calcListReqDto) {
@@ -77,40 +68,15 @@ public class CalculateService {
* date : 2022. 4. 25.
* auth : ckr
* desc : 정산 이력 목록 엑셀 다운로드
* @param paramMap
* @param calcListExcelReqDto
* @return
*/
public ApiResponseMessage calcListExcel(Map<String, Object> paramMap) {
ApiResponseMessage result = new ApiResponseMessage(ApiResponseCode.SUCCESS);
Map<String, Object> dataObj = new HashMap<>();
List<Map<String,Object>> dataList = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
data.put("totalCnt","999");
data.put("currentPage","1");
dataObj.put("paging", data);
for(int i=0; i<10; i++) {
data = new HashMap<>();
data.put("date", "2022-02");
data.put("custNm", "유플러스"+(i+1));
data.put("bRegNo", "22-81-39937");
data.put("plan", "요금제1(50000)");
data.put("startAmount", "50000");
data.put("useAmount", "100000");
data.put("carryOverAmount", "-");
data.put("unitAmount", "-");
data.put("extshAmount", "-");
data.put("requestAmount", "100000");
data.put("allSendingCnt", "84000000");
data.put("sms", "21000000");
data.put("lms", "21000000");
data.put("mms", "21000000");
data.put("notiTalk", "21000000");
dataList.add(data);
}
dataObj.put("list", dataList);
result.setData(dataObj);
return result;
public CalcListExcelResDto calcListExcel(CalcListExcelReqDto calcListExcelReqDto) {
CalculateMapper calcMapper = sqlSessionSlave.getMapper(CalculateMapper.class);
CalcListExcelRes calcListExcelRes = new CalcListExcelRes();
List<CalcList> calcLists = calcMapper.selectCalculateExcelList(calcListExcelReqDto);
calcListExcelRes.setList(calcLists);
return new CalcListExcelResDto(ApiResponseCode.SUCCESS, calcListExcelRes);
}
}

View File

@@ -0,0 +1,27 @@
package kr.co.uplus.ez.api.calculate.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@SuppressWarnings("serial")
@Data
public class CalcListExcelReqDto implements Serializable {
@NotNull
@ApiModelProperty(example = "검색시작월", name = "검색시작월",dataType = "String")
private String startMonth;
@NotNull
@ApiModelProperty(example = "검색종료월", name = "검색종료월",dataType = "String")
private String endMonth;
@ApiModelProperty(example = "고객사명", name = "고객사명", dataType = "String")
private String custNm;
@ApiModelProperty(example = "사업자번호", name = "사업자번호", dataType = "String")
private String bizrno;
}

View File

@@ -0,0 +1,14 @@
package kr.co.uplus.ez.api.calculate.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@SuppressWarnings("serial")
@Data
public class CalcListExcelRes implements Serializable{
private List<CalcList> list;
}

View File

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

View File

@@ -5,33 +5,20 @@
*/
package kr.co.uplus.ez.api.stats;
import java.util.Map;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import kr.co.uplus.ez.api.stats.dto.BsnmDayListReqDto;
import kr.co.uplus.ez.api.stats.dto.BsnmDayListResDto;
import kr.co.uplus.ez.api.stats.dto.BsnmMonthListReqDto;
import kr.co.uplus.ez.api.stats.dto.BsnmMonthListResDto;
import kr.co.uplus.ez.api.stats.dto.DayListReqDto;
import kr.co.uplus.ez.api.stats.dto.DayListResDto;
import kr.co.uplus.ez.api.stats.dto.MonthListReqDto;
import kr.co.uplus.ez.api.stats.dto.MonthListResDto;
import kr.co.uplus.ez.api.stats.dto.*;
import kr.co.uplus.ez.common.components.ValidComponents;
import kr.co.uplus.ez.common.data.ApiResponseCode;
import kr.co.uplus.ez.common.data.ApiResponseMessage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.Map;
@RestController
@RequestMapping(value = "api/v1/bo/stats")
@@ -129,14 +116,18 @@ public class StatsController {
* date : 2022. 4. 25.
* auth : ckr
* desc : 사업자 월별 통계 목록 엑셀 다운로드
* @param paramMap
* @param bsnmMonthListExcelReqDto
* @
*/
@Deprecated
@ApiOperation(value = "bsnmMonthListExcel", notes = "사업자 월별 통계 목록 엑셀 다운로드")
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
@RequestMapping(value = "/bsnmMonthListExcel" , method = {RequestMethod.POST})
@ResponseBody
public ApiResponseMessage bsnmMonthListExcel(@RequestBody Map<String, Object> paramMap) {
return statsService.bsnmMonthListExcel(paramMap);
public BsnmMonthListExcelResDto bsnmMonthListExcel(@RequestBody @Valid BsnmMonthListExcelReqDto bsnmMonthListExcelReqDto, BindingResult bindingResult) {
if (validComponents.validParameter(bindingResult)) {
return new BsnmMonthListExcelResDto(ApiResponseCode.CM_PARAMETER_ERROR);
}
return statsService.bsnmMonthListExcel(bsnmMonthListExcelReqDto);
}
/**
@@ -161,14 +152,18 @@ public class StatsController {
* date : 2022. 4. 25.
* auth : ckr
* desc : 사업자 일별 통계 목록 엑셀 다운로드
* @param paramMap
* @param bsnmDayListExcelReqDto
* @
*/
@Deprecated
@ApiOperation(value = "bsnmDayListExcel", notes = "사업자 일별 통계 목록 엑셀 다운로드")
@ApiResponses({ @ApiResponse(code = HttpServletResponse.SC_OK, message = "SUCESS") })
@RequestMapping(value = "/bsnmDayListExcel" , method = {RequestMethod.POST})
@ResponseBody
public ApiResponseMessage bsnmDayListExcel(@RequestBody Map<String, Object> paramMap) {
return statsService.bsnmDayListExcel(paramMap);
public BsnmDayListExcelResDto bsnmDayListExcel(@RequestBody BsnmDayListExcelReqDto bsnmDayListExcelReqDto, BindingResult bindingResult) {
if (validComponents.validParameter(bindingResult)) {
return new BsnmDayListExcelResDto(ApiResponseCode.CM_PARAMETER_ERROR);
}
return statsService.bsnmDayListExcel(bsnmDayListExcelReqDto);
}
}

View File

@@ -19,4 +19,10 @@ public interface StatsMapper {
int selectCustMstatListTotalCnt(BsnmMonthListReqDto bsnmMonthListReqDto);
/** 일별통계 카운트 조회 */
int selectCustDstatListTotalCnt(BsnmDayListReqDto bsnmDayListReqDto);
/** 월별톨계 Excel 목록 조회 */
List<BsnmMonthList> selectCustMstatExcelList(BsnmMonthListExcelReqDto bsnmMonthListExcelReqDto);
/** 일별통계 Excel 목록 조회 */
List<BsnmDayList> selectCustDstatExcelList(BsnmDayListExcelReqDto bsnmDayListExcelReqDto);
}

View File

@@ -51,6 +51,7 @@ public class StatsService {
* @param paramMap
* @return
*/
@Deprecated
public ApiResponseMessage monthListExcel(Map<String, Object> paramMap) {
ApiResponseMessage result = new ApiResponseMessage(ApiResponseCode.SUCCESS);
Map<String, Object> dataObj = new HashMap<>();
@@ -104,6 +105,7 @@ public class StatsService {
* @param paramMap
* @return
*/
@Deprecated
public ApiResponseMessage dayListExcel(Map<String, Object> paramMap) {
ApiResponseMessage result = new ApiResponseMessage(ApiResponseCode.SUCCESS);
Map<String, Object> dataObj = new HashMap<>();
@@ -181,37 +183,18 @@ public class StatsService {
* date : 2022. 4. 25.
* auth : ckr
* desc : 사업자 월별 통계 목록 엑셀 다운로드
* @param paramMap
* @param bsnmMonthListExcelReqDto
* @return
*/
public ApiResponseMessage bsnmMonthListExcel(Map<String, Object> paramMap) {
ApiResponseMessage result = new ApiResponseMessage(ApiResponseCode.SUCCESS);
Map<String, Object> dataObj = new HashMap<>();
List<Map<String,Object>> dataList = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
public BsnmMonthListExcelResDto bsnmMonthListExcel(BsnmMonthListExcelReqDto bsnmMonthListExcelReqDto) {
StatsMapper statsMapper = sqlSessionSlave.getMapper(StatsMapper.class);
for(int i=1; i<=4; i++) {
data = new HashMap<>();
data.put("date", "2022-0"+i);
data.put("custNm", "유플러스");
data.put("bRegNo", "사업자번호");
data.put("allSendCnt", "40000000");
data.put("allSuccesCnt", "40000000(100%)");
data.put("smsSendCnt", "10000000");
data.put("smsSuccesCnt", "10000000(100%)");
data.put("lmsSendCnt", "10000000");
data.put("lmsSuccesCnt", "10000000(100%)");
data.put("mmsSendCnt", "10000000");
data.put("mmsSuccesCnt", "10000000(100%)");
data.put("notiTalkSendCnt", "10000000");
data.put("notiTalkSuccesCnt", "10000000(100%)");
List<BsnmMonthList> bsnmMonthLists = statsMapper.selectCustMstatExcelList(bsnmMonthListExcelReqDto);
dataList.add(data);
}
dataObj.put("list", dataList);
result.setData(dataObj);
BsnmMonthListExcelRes bsnmMonthListExcelRes = new BsnmMonthListExcelRes();
bsnmMonthListExcelRes.setList(bsnmMonthLists);
return result;
return new BsnmMonthListExcelResDto(ApiResponseCode.SUCCESS, bsnmMonthListExcelRes);
}
/**
@@ -262,37 +245,20 @@ public class StatsService {
* date : 2022. 4. 25.
* auth : ckr
* desc : 사업자 일별 통계 목록 엑셀 다운로드
* @param paramMap
* @param bsnmDayListExcelReqDto
* @return
*/
public ApiResponseMessage bsnmDayListExcel(Map<String, Object> paramMap) {
ApiResponseMessage result = new ApiResponseMessage(ApiResponseCode.SUCCESS);
Map<String, Object> dataObj = new HashMap<>();
List<Map<String,Object>> dataList = new ArrayList<>();
Map<String, Object> data = new HashMap<>();
public BsnmDayListExcelResDto bsnmDayListExcel(BsnmDayListExcelReqDto bsnmDayListExcelReqDto) {
for(int i=1; i<=9; i++) {
data = new HashMap<>();
data.put("date", "2022-03-0"+i);
data.put("custNm", "유플러스");
data.put("bRegNo", "사업자번호");
data.put("allSendCnt", "40000000");
data.put("allSuccesCnt", "40000000(100%)");
data.put("smsSendCnt", "10000000");
data.put("smsSuccesCnt", "10000000(100%)");
data.put("lmsSendCnt", "10000000");
data.put("lmsSuccesCnt", "10000000(100%)");
data.put("mmsSendCnt", "10000000");
data.put("mmsSuccesCnt", "10000000(100%)");
data.put("notiTalkSendCnt", "10000000");
data.put("notiTalkSuccesCnt", "10000000(100%)");
StatsMapper statsMapper = sqlSessionSlave.getMapper(StatsMapper.class);
dataList.add(data);
}
dataObj.put("list", dataList);
result.setData(dataObj);
List<BsnmDayList> bsnmDayLists = statsMapper.selectCustDstatExcelList(bsnmDayListExcelReqDto);
return result;
BsnmDayListExcelRes bsnmDayListExcelRes = new BsnmDayListExcelRes();
bsnmDayListExcelRes.setList(bsnmDayLists);
return new BsnmDayListExcelResDto(ApiResponseCode.SUCCESS, bsnmDayListExcelRes);
}
}

View File

@@ -0,0 +1,27 @@
package kr.co.uplus.ez.api.stats.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@SuppressWarnings("serial")
@Data
public class BsnmDayListExcelReqDto implements Serializable {
@NotNull
@ApiModelProperty(example = "조회시작일", name = "조회시작일", dataType = "String")
private String startDay;
@NotNull
@ApiModelProperty(example = "조회종료일", name = "조회종료일",dataType = "String")
private String endDay;
@ApiModelProperty(example = "고객사명", name = "고객사명", dataType = "String")
private String custNm;
@ApiModelProperty(example = "사업자등록번호", name = "사업자등록번호", dataType = "String")
private String bizrno;
}

View File

@@ -0,0 +1,13 @@
package kr.co.uplus.ez.api.stats.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@SuppressWarnings("serial")
@Data
public class BsnmDayListExcelRes implements Serializable{
private List<BsnmDayList> list;
}

View File

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

View File

@@ -0,0 +1,27 @@
package kr.co.uplus.ez.api.stats.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import javax.validation.constraints.NotNull;
import java.io.Serializable;
@SuppressWarnings("serial")
@Data
public class BsnmMonthListExcelReqDto implements Serializable {
@NotNull
@ApiModelProperty(example = "조회시작월", name = "조회시작월", dataType = "String")
private String startMon;
@NotNull
@ApiModelProperty(example = "조회종료월", name = "조회종료월",dataType = "String")
private String endMon;
@ApiModelProperty(example = "고객사명", name = "고객사명", dataType = "String")
private String custNm;
@ApiModelProperty(example = "사업자등록번호", name = "사업자등록번호", dataType = "String")
private String bizrno;
}

View File

@@ -0,0 +1,13 @@
package kr.co.uplus.ez.api.stats.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
@SuppressWarnings("serial")
@Data
public class BsnmMonthListExcelRes implements Serializable{
private List<BsnmMonthList> list;
}

View File

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

View File

@@ -85,11 +85,11 @@ public class SysMgtService {
SearchMadangId MadangId = new SearchMadangId();
try {
MadangId = sysMgtMapper.selectSearchMadangId(searchMadangIdReqDto);
if(MadangId == null) {
return new SearchMadangIdResDto(ApiResponseCode.CM_NOT_FOUND);
}
} catch (Exception e) {
return new SearchMadangIdResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
@@ -178,13 +178,13 @@ public class SysMgtService {
* @return
*/
public AdminDetailResDto adminDetail(AdminDetailReqDto adminDetailReqDto) {
SysMgtMapper sysMgtMapper = sqlSessionSlave.getMapper(SysMgtMapper.class);
AdminDetail adminDetail = new AdminDetail();
try {
adminDetail = sysMgtMapper.selectAdminDetail(adminDetailReqDto);
if(adminDetail == null) {
return new AdminDetailResDto(ApiResponseCode.CM_NOT_FOUND);
}
@@ -205,16 +205,16 @@ public class SysMgtService {
public AuthListResDto authList(Map<String, Object> paramMap) {
List<AuthInfo> rsAuthInfoList = new ArrayList<AuthInfo>();
AuthListRes result = new AuthListRes();
SysMgtMapper sysMgtMapper = sqlSessionSlave.getMapper(SysMgtMapper.class);
try {
rsAuthInfoList = sysMgtMapper.selectAuthList();
if(rsAuthInfoList.size() < 1) {
return new AuthListResDto(ApiResponseCode.CM_NOT_FOUND);
}
result.setList(rsAuthInfoList);
} catch (Exception e) {
return new AuthListResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
@@ -230,27 +230,27 @@ public class SysMgtService {
* @return
*/
public DeleteAuthResDto deleteAuth(DeleteAuthReqDto deleteAuthReqDto) {
SysMgtMapper sysMgtMapper = sqlSessionMaster.getMapper(SysMgtMapper.class);
Map<String, Object> authParamMap = new HashMap<String, Object>();
authParamMap.put("authCd", deleteAuthReqDto.getAuthCd());
try {
// 1.권한메뉴 삭제
sysMgtMapper.deleteAuthMenu(authParamMap);
// 2.권한 삭제
int result = sysMgtMapper.deleteAuth(authParamMap);
if(result < 1) {
return new DeleteAuthResDto(ApiResponseCode.CM_NOT_FOUND);
}
} catch (Exception e) {
return new DeleteAuthResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
DeleteAuthResDto result = new DeleteAuthResDto(ApiResponseCode.SUCCESS);
return result;
}
@@ -263,33 +263,33 @@ public class SysMgtService {
* @return
*/
public AuthDetailResDto authDetail(AuthDetailReqDto authDetailReqDto) {
SysMgtMapper sysMgtMapper = sqlSessionSlave.getMapper(SysMgtMapper.class);
AuthDetail authDetail = new AuthDetail();
List<AuthMenu> authMenuList = new ArrayList<AuthMenu>();
try {
authDetail = sysMgtMapper.selectAuthDetail(authDetailReqDto);
authDetail = sysMgtMapper.selectAuthDetail(authDetailReqDto);
if(authDetail == null) {
return new AuthDetailResDto(ApiResponseCode.CM_NOT_FOUND);
}
authMenuList = sysMgtMapper.selectAuthMemuList(authDetailReqDto);
if(authMenuList.size() < 1) {
return new AuthDetailResDto(ApiResponseCode.CM_NOT_FOUND);
}
authDetail.setList(authMenuList);
} catch (Exception e) {
return new AuthDetailResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
return new AuthDetailResDto(ApiResponseCode.SUCCESS, authDetail);
}
/**
@@ -300,23 +300,23 @@ public class SysMgtService {
* @return
*/
public InsertAuthResDto insertAuth(InsertAuthReqDto insertAuthReqDto, String regId) {
SysMgtMapper sysMgtMapper = sqlSessionMaster.getMapper(SysMgtMapper.class);
AuthDetailReqDto authDetailReqDto = new AuthDetailReqDto();
AuthDetail authDetail = new AuthDetail();
Map<String, Object> authParamMap = new HashMap<String, Object>();
Map<String, Object> authMenuParamMap = new HashMap<String, Object>();
List<AuthMenu> reqAuthMenuList = new ArrayList<AuthMenu>();
authDetailReqDto.setAuthCd(insertAuthReqDto.getAuthCd());
// 권한코드 조회(권한코드 중복체크)
authDetail = sysMgtMapper.selectAuthDetail(authDetailReqDto);
if(authDetail != null) {
return new InsertAuthResDto(ApiResponseCode.CE_SYSMGT_AUTHCODE_INVALID);
}
}
try {
// 권한 등록
authParamMap.put("authCd", insertAuthReqDto.getAuthCd());
@@ -325,19 +325,19 @@ public class SysMgtService {
authParamMap.put("stat", insertAuthReqDto.getStat());
authParamMap.put("regId", regId);
sysMgtMapper.insertAuth(authParamMap);
// 권한메뉴 등록
// 권한메뉴 등록
reqAuthMenuList = insertAuthReqDto.getList();
for(int i =0; i<reqAuthMenuList.size(); i++) {
authMenuParamMap = new HashMap<String, Object>();
authMenuParamMap.put("authCd", authParamMap.get("authCd"));
authMenuParamMap.put("regId", regId);
authMenuParamMap.put("menuNo", reqAuthMenuList.get(i).getMenuNo());
sysMgtMapper.insertAuthMenu(authMenuParamMap);
}
sysMgtMapper.insertAuthMenu(authMenuParamMap);
}
} catch (Exception e) {
return new InsertAuthResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
@@ -356,7 +356,7 @@ public class SysMgtService {
Map<String, Object> authParamMap = new HashMap<String, Object>();
Map<String, Object> authMenuParamMap = new HashMap<String, Object>();
List<AuthMenu> reqAuthMenuList = new ArrayList<AuthMenu>();
try {
// 권한 데이터 수정
authParamMap.put("authCd", updateAuthReqDto.getAuthCd());
@@ -364,29 +364,29 @@ public class SysMgtService {
authParamMap.put("authDesc", updateAuthReqDto.getAuthDesc());
authParamMap.put("stat", updateAuthReqDto.getStat());
authParamMap.put("regId", regId);
sysMgtMapper.updateAuth(authParamMap);
// 권한메뉴 수정 (기존 권한메뉴 등록데이터 삭제 후 등록)
// 1. 기존 권한메뉴 데이터 삭제
sysMgtMapper.deleteAuthMenu(authParamMap);
// 2. 권한메뉴 데이터 등록
reqAuthMenuList = updateAuthReqDto.getList();
for(int i =0; i<reqAuthMenuList.size(); i++) {
authMenuParamMap = new HashMap<String, Object>();
authMenuParamMap.put("authCd", authParamMap.get("authCd"));
authMenuParamMap.put("regId", regId);
authMenuParamMap.put("menuNo", reqAuthMenuList.get(i).getMenuNo());
sysMgtMapper.insertAuthMenu(authMenuParamMap);
}
sysMgtMapper.insertAuthMenu(authMenuParamMap);
}
} catch (Exception e) {
return new UpdateAuthResDto(ApiResponseCode.CM_DB_QUERY_ERR);
}
return new UpdateAuthResDto(ApiResponseCode.SUCCESS);
}

View File

@@ -1,103 +1,103 @@
package kr.co.uplus.ez.common.security;
import javax.crypto.Cipher;
import javax.crypto.spec.IvParameterSpec;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.binary.Base64;
/**
* key가 16byte(128bit)면 AES128로 동작한다.
* key가 32byte(256bit)면 AES256으로 동작한다.
*/
public class Aes256 {
private static final String ALGORITHM = "AES";
private static final String TRANSFORMATION = "AES/CBC/PKCS5Padding"; // algorithm/mode/padding
// private static final String TRANSFORMATION = "AES/ECB/PKCS5Padding"; // "AES"와 같다. ECB mode cannot use IV
public static byte[] encrypt(byte[] plainText, byte[] key) {
byte[] iv = new byte[16];
return encrypt(plainText, key, iv);
}
public static byte[] encrypt(byte[] plainText, byte[] key, byte[] iv) {
try {
Cipher c = Cipher.getInstance(TRANSFORMATION);
SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
IvParameterSpec ivSpec = new IvParameterSpec(iv);
c.init(Cipher.ENCRYPT_MODE, k, ivSpec);
return c.doFinal(plainText);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public static String encryptBase64(String plainText, byte[] key) {
byte[] iv = new byte[16];
return encryptBase64(plainText, key, iv);
}
public static String encryptBase64(String plainText, byte[] key, byte[] iv) {
byte[] enc = encrypt(plainText.getBytes(), key, iv);
return new String(Base64.encodeBase64(enc));
}
public static byte[] decrypt(byte[] cipherText, byte[] key) {
byte[] iv = new byte[16];
return decrypt(cipherText, key, iv);
}
public static byte[] decrypt(byte[] cipherText, byte[] key, byte[] iv) {
try {
Cipher c = Cipher.getInstance(TRANSFORMATION);
SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
IvParameterSpec ivSpec = new IvParameterSpec(iv);
c.init(Cipher.DECRYPT_MODE, k, ivSpec);
return c.doFinal(cipherText);
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public static String decryptBase64(String b64CipherText, byte[] key) {
byte[] iv = new byte[16];
return decryptBase64(b64CipherText, key, iv);
}
public static String decryptBase64(String b64CipherText, byte[] key, byte[] iv) {
byte[] enc = Base64.decodeBase64(b64CipherText.getBytes());
return new String(decrypt(enc, key, iv));
}
public static String encryptNoIvBase64(String plainText, byte[] key) {
try {
Cipher c = Cipher.getInstance(ALGORITHM);
SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
c.init(Cipher.ENCRYPT_MODE, k); // ECB mode cannot use IV
byte[] enc = c.doFinal(plainText.getBytes());
return new String(Base64.encodeBase64(enc));
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
public static String decryptNoIvBase64(String b64CipherText, byte[] key) {
try {
Cipher c = Cipher.getInstance(ALGORITHM);
SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
c.init(Cipher.DECRYPT_MODE, k); // ECB mode cannot use IV
byte[] enc = Base64.decodeBase64(b64CipherText.getBytes());
return new String(c.doFinal(enc));
}
catch (Exception e) {
throw new RuntimeException(e);
}
}
}
//package kr.co.uplus.ez.common.security;
//
//import javax.crypto.Cipher;
//import javax.crypto.spec.IvParameterSpec;
//import javax.crypto.spec.SecretKeySpec;
//
//import org.apache.commons.codec.binary.Base64;
//
///**
// * key가 16byte(128bit)면 AES128로 동작한다.
// * key가 32byte(256bit)면 AES256으로 동작한다.
// */
//public class Aes256 {
//
// private static final String ALGORITHM = "AES";
// private static final String TRANSFORMATION = "AES/CBC/PKCS5Padding"; // algorithm/mode/padding
//// private static final String TRANSFORMATION = "AES/ECB/PKCS5Padding"; // "AES"와 같다. ECB mode cannot use IV
//
// public static byte[] encrypt(byte[] plainText, byte[] key) {
// byte[] iv = new byte[16];
// return encrypt(plainText, key, iv);
// }
//
// public static byte[] encrypt(byte[] plainText, byte[] key, byte[] iv) {
// try {
// Cipher c = Cipher.getInstance(TRANSFORMATION);
// SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
// IvParameterSpec ivSpec = new IvParameterSpec(iv);
// c.init(Cipher.ENCRYPT_MODE, k, ivSpec);
// return c.doFinal(plainText);
// }
// catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String encryptBase64(String plainText, byte[] key) {
// byte[] iv = new byte[16];
// return encryptBase64(plainText, key, iv);
// }
//
// public static String encryptBase64(String plainText, byte[] key, byte[] iv) {
// byte[] enc = encrypt(plainText.getBytes(), key, iv);
// return new String(Base64.encodeBase64(enc));
// }
//
//
// public static byte[] decrypt(byte[] cipherText, byte[] key) {
// byte[] iv = new byte[16];
// return decrypt(cipherText, key, iv);
// }
//
// public static byte[] decrypt(byte[] cipherText, byte[] key, byte[] iv) {
// try {
// Cipher c = Cipher.getInstance(TRANSFORMATION);
// SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
// IvParameterSpec ivSpec = new IvParameterSpec(iv);
// c.init(Cipher.DECRYPT_MODE, k, ivSpec);
// return c.doFinal(cipherText);
// }
// catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String decryptBase64(String b64CipherText, byte[] key) {
// byte[] iv = new byte[16];
// return decryptBase64(b64CipherText, key, iv);
// }
//
// public static String decryptBase64(String b64CipherText, byte[] key, byte[] iv) {
// byte[] enc = Base64.decodeBase64(b64CipherText.getBytes());
// return new String(decrypt(enc, key, iv));
// }
//
//
// public static String encryptNoIvBase64(String plainText, byte[] key) {
// try {
// Cipher c = Cipher.getInstance(ALGORITHM);
// SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
// c.init(Cipher.ENCRYPT_MODE, k); // ECB mode cannot use IV
// byte[] enc = c.doFinal(plainText.getBytes());
// return new String(Base64.encodeBase64(enc));
// }
// catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
//
// public static String decryptNoIvBase64(String b64CipherText, byte[] key) {
// try {
// Cipher c = Cipher.getInstance(ALGORITHM);
// SecretKeySpec k = new SecretKeySpec(key, ALGORITHM);
// c.init(Cipher.DECRYPT_MODE, k); // ECB mode cannot use IV
// byte[] enc = Base64.decodeBase64(b64CipherText.getBytes());
// return new String(c.doFinal(enc));
// }
// catch (Exception e) {
// throw new RuntimeException(e);
// }
// }
//
//}

View File

@@ -1,24 +1,17 @@
package kr.co.uplus.ez.common.utils;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Base64;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import java.io.File;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.nio.charset.StandardCharsets;
import java.security.InvalidKeyException;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
import java.util.Arrays;
import javax.crypto.Cipher;
import javax.crypto.Mac;
import javax.crypto.spec.SecretKeySpec;
import org.apache.commons.codec.DecoderException;
import org.apache.commons.codec.binary.Base64;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import lombok.extern.slf4j.Slf4j;
@Slf4j
public class EncryptionUtil {
@@ -221,117 +214,117 @@ public class EncryptionUtil {
return isHashCompare;
}
public byte[] aesEncryptEcb(String sKey, String sText) {
byte[] key = null;
byte[] text = null;
byte[] encrypted = null;
final int AES_KEY_SIZE_128 = 128;
// public byte[] aesEncryptEcb(String sKey, String sText) {
// byte[] key = null;
// byte[] text = null;
// byte[] encrypted = null;
// final int AES_KEY_SIZE_128 = 128;
//
// try {
// // UTF-8
// key = sKey.getBytes("UTF-8");
//
// // Key size (128bit, 16byte)
// key = Arrays.copyOf(key, AES_KEY_SIZE_128 / 8);
//
// // UTF-8
// text = sText.getBytes("UTF-8");
//
// // AES/EBC/PKCS5Padding
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"));
// encrypted = cipher.doFinal(text);
// } catch (Exception e) {
// encrypted = null;
// log.error("aesEncryptEcb exception. : {}", e.getMessage());
// }
try {
// UTF-8
key = sKey.getBytes("UTF-8");
// Key size (128bit, 16byte)
key = Arrays.copyOf(key, AES_KEY_SIZE_128 / 8);
// UTF-8
text = sText.getBytes("UTF-8");
// AES/EBC/PKCS5Padding
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"));
encrypted = cipher.doFinal(text);
} catch (Exception e) {
encrypted = null;
log.error("aesEncryptEcb exception. : {}", e.getMessage());
}
return encrypted;
}
// return encrypted;
// }
/*
* AES128 Decrypt
*/
public byte[] aesDecryptEcb(String sKey, byte[] encrypted) throws UnsupportedEncodingException {
byte[] key = null;
byte[] decrypted = null;
final int AES_KEY_SIZE_128 = 128;
try {
// UTF-8
key = sKey.getBytes("UTF-8");
// Key size 128 (128bit, 16byte)
key = Arrays.copyOf(key, AES_KEY_SIZE_128 / 8);
// AES/EBC/PKCS5Padding
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"));
decrypted = cipher.doFinal(encrypted);
} catch (Exception e) {
decrypted = null;
log.error("aesDecryptEcb exception. : {}", e.getMessage());
}
return decrypted;
}
// public byte[] aesDecryptEcb(String sKey, byte[] encrypted) throws UnsupportedEncodingException {
// byte[] key = null;
// byte[] decrypted = null;
// final int AES_KEY_SIZE_128 = 128;
//
// try {
// // UTF-8
// key = sKey.getBytes("UTF-8");
//
// // Key size 128 (128bit, 16byte)
// key = Arrays.copyOf(key, AES_KEY_SIZE_128 / 8);
//
// // AES/EBC/PKCS5Padding
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"));
// decrypted = cipher.doFinal(encrypted);
// } catch (Exception e) {
// decrypted = null;
// log.error("aesDecryptEcb exception. : {}", e.getMessage());
// }
// return decrypted;
// }
/*
* AES256 Encrypt
*/
public byte[] aes256EncryptEcb(String sKey, String sText) {
byte[] key = null;
byte[] text = null;
byte[] encrypted = null;
final int AES_KEY_SIZE_256 = 256;
try {
// UTF-8
key = sKey.getBytes("UTF-8");
// Key size (256bit, 16byte)
key = Arrays.copyOf(key, AES_KEY_SIZE_256 / 8);
// UTF-8
text = sText.getBytes("UTF-8");
// AES/EBC/PKCS5Padding
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"));
encrypted = cipher.doFinal(text);
} catch (Exception e) {
encrypted = null;
log.error("aes256EncryptEcb exception. : {}", e.getMessage());
}
return encrypted;
}
// public byte[] aes256EncryptEcb(String sKey, String sText) {
// byte[] key = null;
// byte[] text = null;
// byte[] encrypted = null;
// final int AES_KEY_SIZE_256 = 256;
//
// try {
// // UTF-8
// key = sKey.getBytes("UTF-8");
//
// // Key size (256bit, 16byte)
// key = Arrays.copyOf(key, AES_KEY_SIZE_256 / 8);
//
// // UTF-8
// text = sText.getBytes("UTF-8");
//
// // AES/EBC/PKCS5Padding
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// cipher.init(Cipher.ENCRYPT_MODE, new SecretKeySpec(key, "AES"));
// encrypted = cipher.doFinal(text);
// } catch (Exception e) {
// encrypted = null;
// log.error("aes256EncryptEcb exception. : {}", e.getMessage());
// }
//
// return encrypted;
// }
/*
* AES256 Decrypt
*/
public byte[] aes256DecryptEcb(String sKey, byte[] encrypted) throws UnsupportedEncodingException {
byte[] key = null;
byte[] decrypted = null;
final int AES_KEY_SIZE_256 = 256;
try {
// UTF-8
key = sKey.getBytes("UTF-8");
// Key size (256bit, 16byte)
key = Arrays.copyOf(key, AES_KEY_SIZE_256 / 8);
// AES/EBC/PKCS5Padding
Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"));
decrypted = cipher.doFinal(encrypted);
} catch (Exception e) {
decrypted = null;
log.error("aes256DecryptEcb exception. : {}", e.getMessage());
}
return decrypted;
}
// public byte[] aes256DecryptEcb(String sKey, byte[] encrypted) throws UnsupportedEncodingException {
// byte[] key = null;
// byte[] decrypted = null;
// final int AES_KEY_SIZE_256 = 256;
//
// try {
// // UTF-8
// key = sKey.getBytes("UTF-8");
//
// // Key size (256bit, 16byte)
// key = Arrays.copyOf(key, AES_KEY_SIZE_256 / 8);
//
// // AES/EBC/PKCS5Padding
// Cipher cipher = Cipher.getInstance("AES/ECB/PKCS5Padding");
// cipher.init(Cipher.DECRYPT_MODE, new SecretKeySpec(key, "AES"));
// decrypted = cipher.doFinal(encrypted);
// } catch (Exception e) {
// decrypted = null;
// log.error("aes256DecryptEcb exception. : {}", e.getMessage());
// }
//
// return decrypted;
// }
public String toHexString(byte[] b) {
StringBuffer sb = new StringBuffer();

View File

@@ -1,29 +1,17 @@
package kr.co.uplus.ez.common.utils;
import java.io.BufferedInputStream;
import java.io.BufferedOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import java.net.URLEncoder;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.zip.GZIPInputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.commons.io.FilenameUtils;
import org.apache.commons.io.IOUtils;
import org.springframework.core.io.Resource;
import org.springframework.web.multipart.MultipartFile;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.*;
import java.net.URLEncoder;
import java.util.Arrays;
import java.util.List;
public class FileIoUtils {
/**
* @return d:/Downloads/aaa.txt --> aaa.txt
@@ -205,7 +193,7 @@ public class FileIoUtils {
/**
* @param ext "."를 포함해야 정확한 결과를 얻는다.
* @param crext "."를 포함해야 정확한 결과를 얻는다.
*/
public static boolean isExtension(String fname, String... exts) {
if (fname == null) return false;
@@ -237,43 +225,43 @@ public class FileIoUtils {
}
}
public static List<File> unzip(File zip, String saveDir) throws Exception {
int bufSize = 1024 * 64;
List<File> files = new ArrayList<File>();
ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(zip), bufSize));
ZipEntry entry = null;
// public static List<File> unzip(File zip, String saveDir) throws Exception {
// int bufSize = 1024 * 64;
// List<File> files = new ArrayList<File>();
//
// ZipInputStream in = new ZipInputStream(new BufferedInputStream(new FileInputStream(zip), bufSize));
// ZipEntry entry = null;
//
// while ((entry = in.getNextEntry()) != null) {
// byte[] buffer = new byte[bufSize];
//
// File outfile = new File(saveDir, entry.getName());
// OutputStream out = new BufferedOutputStream(new FileOutputStream(outfile), bufSize);
//
// int size = 0;
// while ((size = in.read(buffer, 0, bufSize)) != -1) {
// out.write(buffer, 0, size);
// }
// out.flush();
// IOUtils.closeQuietly(out);
// files.add(outfile);
// }
//
// IOUtils.closeQuietly(in);
// return files;
// }
while ((entry = in.getNextEntry()) != null) {
byte[] buffer = new byte[bufSize];
File outfile = new File(saveDir, entry.getName());
OutputStream out = new BufferedOutputStream(new FileOutputStream(outfile), bufSize);
int size = 0;
while ((size = in.read(buffer, 0, bufSize)) != -1) {
out.write(buffer, 0, size);
}
out.flush();
IOUtils.closeQuietly(out);
files.add(outfile);
}
IOUtils.closeQuietly(in);
return files;
}
public static File ungzip(File gzip, String saveDir) throws Exception {
String outName = getBaseName(gzip.getName());
File outfile = new File(saveDir, outName);
InputStream in = new GZIPInputStream(new FileInputStream(gzip));
OutputStream out = new FileOutputStream(outfile);
IOUtils.copy(in, out);
IOUtils.closeQuietly(in);
IOUtils.closeQuietly(out);
return outfile;
}
// public static File ungzip(File gzip, String saveDir) throws Exception {
// String outName = getBaseName(gzip.getName());
// File outfile = new File(saveDir, outName);
//
// InputStream in = new GZIPInputStream(new FileInputStream(gzip));
// OutputStream out = new FileOutputStream(outfile);
// IOUtils.copy(in, out);
//
// IOUtils.closeQuietly(in);
// IOUtils.closeQuietly(out);
// return outfile;
// }
}