diff --git a/WebContent/jsp/onl/admin/inflow/inflowControlHistoryMan.jsp b/WebContent/jsp/onl/admin/inflow/inflowControlHistoryMan.jsp index 9744828..c9a402c 100644 --- a/WebContent/jsp/onl/admin/inflow/inflowControlHistoryMan.jsp +++ b/WebContent/jsp/onl/admin/inflow/inflowControlHistoryMan.jsp @@ -31,6 +31,22 @@ function timeStampFormat2(cellvalue, options, rowObject){ } +function groupNameFormat(cellvalue, options, rowObject) { + if (!cellvalue) return ""; + + var strVal = cellvalue.toString().trim(); + + if (strVal.length === 36) { + // 그룹ID의 경우 GROUPNAME 으로 보여줌 + var groupName = rowObject.GROUPNAME; + + // 비어있다면 원래 값을 반환 + return groupName ? groupName : strVal; + } + + return strVal; +} + $(document).ready(function() { $("input[name=searchStartYYYYMMDD],input[name=searchEndYYYYMMDD]").inputmask("yyyy-mm-dd",{'autoUnmask':true}); @@ -66,10 +82,11 @@ $(document).ready(function() { '<%= localeMessage.getString("infConHstMan.eaiSvcSrlNum") %>', '<%= localeMessage.getString("infConHstMan.instNm") %>', '<%= localeMessage.getString("infConHstMan.eaiSvcCd") %>', - '<%= localeMessage.getString("infConHstMan.adpGrpNm") %>', + '그룹별 / <%= localeMessage.getString("infConHstMan.adpGrpNm") %>', '<%= localeMessage.getString("infAdpConMan.thrPerSecond") %>', '<%= localeMessage.getString("infAdpConMan.thr") %>', - '<%= localeMessage.getString("infAdpConMan.thrTimeUnit") %>' + '<%= localeMessage.getString("infAdpConMan.thrTimeUnit") %>', + '그룹별' ], colModel:[ { name : 'EAIBZWKDSTCD' , width:'50' , align:'center' , sortable:false }, @@ -77,10 +94,11 @@ $(document).ready(function() { { name : 'EAISVCSERNO' , width:'150', align:'left' }, { name : 'EAISEVRINSTNCNAME' , width:'50' , align:'center' }, { name : 'EAISVCNAME' , width:'70' , align:'center' }, - { name : 'ADPTRBZWKGROUPNAME' , width:'70' , align:'center' }, - { name : 'THRESHOLDPERSECOND' , width:'40' , align:'right' }, - { name : 'THRESHOLD' , width:'40' , align:'right' }, - { name : 'THRESHOLDTIMEUNIT' , width:'70' , align:'center' } + { name : 'ADPTRBZWKGROUPNAME' , width:'100' , align:'center' , formatter: groupNameFormat }, + { name : 'THRESHOLDPERSECOND' , width:'30' , align:'right' }, + { name : 'THRESHOLD' , width:'30' , align:'right' }, + { name : 'THRESHOLDTIMEUNIT' , width:'50' , align:'center' }, + { name : 'GROUPNAME' , width:'70' , hidden:true } ], jsonReader: { repeatitems:false diff --git a/src/main/java/com/eactive/eai/rms/data/entity/onl/inflow/InflowControlLogService.java b/src/main/java/com/eactive/eai/rms/data/entity/onl/inflow/InflowControlLogService.java index 458a5b0..eccb2ef 100644 --- a/src/main/java/com/eactive/eai/rms/data/entity/onl/inflow/InflowControlLogService.java +++ b/src/main/java/com/eactive/eai/rms/data/entity/onl/inflow/InflowControlLogService.java @@ -1,19 +1,33 @@ package com.eactive.eai.rms.data.entity.onl.inflow; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.domain.Page; import org.springframework.data.domain.Pageable; import org.springframework.stereotype.Service; import com.eactive.eai.data.entity.onl.inflow.InflowControlLog; import com.eactive.eai.data.entity.onl.inflow.InflowControlLogId; +import com.eactive.eai.data.entity.onl.inflow.QInflowControlGroup; import com.eactive.eai.data.entity.onl.inflow.QInflowControlLog; import com.eactive.eai.data.jpa.AbstractDataService; +import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManMapper; +import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManUI; import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManUISearch; import com.querydsl.core.BooleanBuilder; +import com.querydsl.core.Tuple; @Service public class InflowControlLogService extends AbstractDataService { + + private final InflowControlService inflowControlService; + private final InflowControlHistoryManMapper inflowControlHistoryManMapper; + + @Autowired + public InflowControlLogService(InflowControlService inflowControlService, InflowControlHistoryManMapper inflowControlHistoryManMapper) { + this.inflowControlService = inflowControlService; + this.inflowControlHistoryManMapper = inflowControlHistoryManMapper; + } public Page findAll(Pageable pageable, InflowControlHistoryManUISearch uiSearch) { QInflowControlLog qInflowConfrolLog = QInflowControlLog.inflowControlLog; @@ -25,6 +39,28 @@ public class InflowControlLogService return super.repository.findAll(booleanBuilder, pageable); } + public Page selectList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) { + + Page tuples = inflowControlService.selectLogList(pageable, uiSearch); + + return tuples.map(tuple -> { + InflowControlLog inflowControlLog = tuple.get(QInflowControlLog.inflowControlLog); + + String groupName = tuple.get(QInflowControlGroup.inflowControlGroup.groupName); + + InflowControlHistoryManUI inflowControlHistoryManUI; + + inflowControlHistoryManUI = inflowControlHistoryManMapper.toVo(inflowControlLog); + + inflowControlHistoryManUI.setGroupname(groupName); + + return inflowControlHistoryManUI; + + }); + + + } + public Iterable findAll(InflowControlHistoryManUISearch uiSearch) { QInflowControlLog qInflowConfrolLog = QInflowControlLog.inflowControlLog; BooleanBuilder booleanBuilder = new BooleanBuilder(); diff --git a/src/main/java/com/eactive/eai/rms/data/entity/onl/inflow/InflowControlService.java b/src/main/java/com/eactive/eai/rms/data/entity/onl/inflow/InflowControlService.java index 7c08a0a..15adc96 100644 --- a/src/main/java/com/eactive/eai/rms/data/entity/onl/inflow/InflowControlService.java +++ b/src/main/java/com/eactive/eai/rms/data/entity/onl/inflow/InflowControlService.java @@ -17,11 +17,16 @@ import com.eactive.eai.data.entity.onl.adapter.QAdapterGroup; import com.eactive.eai.data.entity.onl.inflow.InflowControl; import com.eactive.eai.data.entity.onl.inflow.InflowControlId; import com.eactive.eai.data.entity.onl.inflow.QInflowControl; +import com.eactive.eai.data.entity.onl.inflow.QInflowControlGroup; +import com.eactive.eai.data.entity.onl.inflow.QInflowControlLog; import com.eactive.eai.data.entity.onl.message.QEAIMessageEntity; import com.eactive.eai.data.jpa.AbstractDataService; +import com.eactive.eai.rms.onl.manage.inflow.history.InflowControlHistoryManUISearch; import com.eactive.eai.rms.onl.manage.inflow.inflow.InflowControlManMapper; import com.querydsl.core.BooleanBuilder; import com.querydsl.core.Tuple; +import com.querydsl.core.types.OrderSpecifier; +import com.querydsl.jpa.impl.JPAQuery; import com.querydsl.jpa.impl.JPAQueryFactory; @Service @@ -168,5 +173,45 @@ public class InflowControlService extends AbstractDataService selectLogList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) { + QInflowControlLog qlog = QInflowControlLog.inflowControlLog; + QInflowControlGroup qgroup = QInflowControlGroup.inflowControlGroup; + + JPAQuery jpaQuery = createBaseQuery(uiSearch); + + long totalCount = jpaQuery.select(QInflowControlLog.inflowControlLog.count()).fetchOne(); + + List inflowControlLog = jpaQuery + .select(qlog, qgroup.groupName) + .limit(pageable.getPageSize()) + .offset(pageable.getOffset()) + .orderBy(qlog.id.msgdpstyms.desc()) + .fetch(); + + return new PageImpl<>(inflowControlLog, pageable, totalCount); + } + + private JPAQuery createBaseQuery(InflowControlHistoryManUISearch uiSearch) { + QInflowControlLog qInflowConfrolLog = QInflowControlLog.inflowControlLog; + QInflowControlGroup qinflowControlGroup = QInflowControlGroup.inflowControlGroup; + + BooleanBuilder predicate = new BooleanBuilder(); + predicate + .and(qInflowConfrolLog.id.msgdpstyms + .between(uiSearch.getSearchStartDate() + "000000000", + uiSearch.getSearchEndDate() + "235959999")); + + return getJPAQueryFactory() + .select( + qInflowConfrolLog, + qinflowControlGroup.groupName + ) + .from(qInflowConfrolLog) + .leftJoin(qinflowControlGroup) + .on(qInflowConfrolLog.adptrbzwkgroupname.eq(qinflowControlGroup.groupId)) + .where(predicate); + + } } diff --git a/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManController.java b/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManController.java index da9d0b3..4473bb2 100644 --- a/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManController.java +++ b/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManController.java @@ -31,6 +31,13 @@ public class InflowControlHistoryManController extends OnlBaseAnnotationControll return "/onl/admin/inflow/inflowControlHistoryMan"; } +// @RequestMapping(value = "/onl/admin/inflow/inflowControlHistoryMan.json", params = "cmd=LIST") +// public ResponseEntity> selectList(HttpServletRequest request, +// Pageable pageable, InflowControlHistoryManUISearch uiSearch) { +// Page uiPage = service.selectList(pageable, uiSearch); +// return ResponseEntity.ok(new GridResponse<>(uiPage)); +// } + @RequestMapping(value = "/onl/admin/inflow/inflowControlHistoryMan.json", params = "cmd=LIST") public ResponseEntity> selectList(HttpServletRequest request, Pageable pageable, InflowControlHistoryManUISearch uiSearch) { diff --git a/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManService.java b/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManService.java index 2aa632b..8ee1410 100644 --- a/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManService.java +++ b/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManService.java @@ -23,8 +23,13 @@ public class InflowControlHistoryManService extends BaseService { @Autowired InflowControlHistoryManMapper mapper; +// public Page selectList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) { +// return service.findAll(pageable, uiSearch).map(mapper::toVo); +// } + + public Page selectList(Pageable pageable, InflowControlHistoryManUISearch uiSearch) { - return service.findAll(pageable, uiSearch).map(mapper::toVo); + return service.selectList(pageable, uiSearch); } public List> selectListToExcel(InflowControlHistoryManUISearch uiSearch) { diff --git a/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManUI.java b/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManUI.java index 9b1bfb6..d63736c 100644 --- a/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManUI.java +++ b/src/main/java/com/eactive/eai/rms/onl/manage/inflow/history/InflowControlHistoryManUI.java @@ -66,6 +66,12 @@ public class InflowControlHistoryManUI { */ @JsonProperty("THRESHOLDTIMEUNIT") private String thresholdtimeunit; + + /** + * 그룹명 + */ + @JsonProperty("GROUPNAME") + private String groupname; }