Merge branch 'dev-image-editor'

main
minuk926 2 years ago
commit 030ffa81b3

@ -1,5 +1,7 @@
package kr.xit.fims.biz.ec.web;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collectors;
@ -20,6 +22,7 @@ import kr.xit.framework.biz.cmm.model.CmmFileDTO;
import kr.xit.framework.biz.cmm.service.ICmmFileService;
import kr.xit.framework.core.model.ResultResponse;
import kr.xit.framework.support.mybatis.MybatisUtils;
import kr.xit.framework.support.util.ConvertUtils;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -43,13 +46,14 @@ public class EcCtznSttemntController {
}
@RequestMapping(value = "/ecCtznSttemntMgtPopup")
@ResponseBody
//@ResponseBody
public ModelAndView ecCtznSttemntMgtPopup(final String interfaceSeqN){
ModelAndView mav = new ModelAndView(FimsConst.FIMS_JSP_BASE_PATH +"ec/ecCtznSttemntMgtPopup.popup");
CtznStmtDTO.Request reqDTO = CtznStmtDTO.Request.builder()
.interfaceSeqN(interfaceSeqN)
.ctznSttemntDetailSn("01").build();
//.ctznSttemntDetailSn("01")
.build();
mav.addObject("interfaceSeqN", interfaceSeqN);
mav.addObject("ctznStmtDTO", service.findCtznStmt(reqDTO));
mav.addObject("ctznStmtDtlDTOs", service.findCtznStmtDtls(reqDTO));

@ -1,7 +1,13 @@
package kr.xit.framework.support.util;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import org.apache.commons.beanutils.BeanUtils;
@ -22,4 +28,123 @@ public class ConvertUtils {
//noinspection unchecked
return (T) o;
}
/**
* Class > Map
* @param obj
* @return
*/
public static Map<String, Object> convertToMap(Object obj) {
try {
if (Objects.isNull(obj)) {
return Collections.emptyMap();
}
Map<String, Object> convertMap = new HashMap<>();
Field[] fields = obj.getClass().getDeclaredFields();
for (Field field : fields) {
field.setAccessible(true);
convertMap.put(field.getName(), field.get(obj));
}
return convertMap;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* Map > Class
* @param map
* @param type
* @return
* @param <T>
*/
public static <T> T convertToValueObject(Map<String, Object> map, Class<T> type) {
try {
Objects.requireNonNull(type, "Class cannot be null");
T instance = type.getConstructor().newInstance();
if (map == null || map.isEmpty()) {
return instance;
}
Field[] fields = type.getDeclaredFields();
for (Map.Entry<String, Object> entry : map.entrySet()) {
String key = entry.getKey();
Object value = entry.getValue();
for (Field field : fields) {
field.setAccessible(true);
String name = field.getName();
if (value != null) {
boolean isSameType = value.getClass().equals(getReferenceType(field.getType()));
boolean isSameName = key.equals(name);
if (isSameType && isSameName) {
field.set(instance, map.get(name));
break;
}
}
}
}
return instance;
} catch (Exception e) {
throw new RuntimeException(e);
}
}
/**
* List<Class> > List<Map>
* @param list
* @return
*/
public static List<Map<String, Object>> convertToMaps(List<?> list) {
if (list == null || list.isEmpty()) {
return Collections.emptyList();
}
List<Map<String, Object>> convertList = new ArrayList<>(list.size());
for (Object obj : list) {
convertList.add(ConvertUtils.convertToMap(obj));
}
return convertList;
}
/**
* List<Map> > List<Class>
* @param list
* @param type
* @return
* @param <T>
*/
public static <T> List<T> convertToValueObjects(List<Map<String, Object>> list, Class<T> type) {
Objects.requireNonNull(type, "Class cannot be null");
if (list == null || list.isEmpty()) {
return Collections.emptyList();
}
List<T> convertList = new ArrayList<>(list.size());
for (Map<String, Object> map : list) {
convertList.add(ConvertUtils.convertToValueObject(map, type));
}
return convertList;
}
private static Class<?> getReferenceType(Class<?> type) {
switch (type.getName()) {
case "boolean" : return Boolean.class;
case "byte" : return Byte.class;
case "short" : return Short.class;
case "char" : return Character.class;
case "int" : return Integer.class;
case "long" : return Long.class;
case "float" : return Float.class;
case "double" : return Double.class;
default : return type;
}
}
}

@ -125,6 +125,8 @@
</form>
<form name="frmStmtDtl">
<c:forEach var="dtlDTO" items="${ctznStmtDtlDTOs}" varStatus="status">
<table class="tbl03">
<caption><c:out value="${bizName}"/> 상세</caption>
<colgroup>
@ -136,73 +138,69 @@
<col style="width: 20%;"/>
</colgroup>
<tbody>
<%-- <c:forEach var="dtlDTO" items="ctznStmtDtlDTOs">--%>
<tr>
<th>순번</th>
<td>
<input type="text" name="ctznSttemntDetailSn" value='<c:out value="${dtlDTO.ctznSttemntDetailSn}"/>' readonly>
</td>
<th>차량번호</th>
<td>
<%-- <c:out value="${dtlDTO.vhcleNo}"/>--%>
<%-- <input type="text" name="vhcleNo" value="${dtlDTO.vhcleNo}" readonly>--%>
<%-- <input type="text" name="vhcleNo" value='<c:out value="${dtlDTO.vhcleNo}"/>' readonly>--%>
<input type="text" name="vhcleNo" value='<c:out value="${dtlDTO.vhcleNo}"/>' readonly>
</td>
<th>순번</th>
<th>단속ID</th>
<td>
<%-- <input type="text" name="ctnzSttemntDetailSn" value='<c:out value="${dtlDTO.ctnzSttemntDetailSn}"/>' readonly>--%>
<%-- <input type="text" name="ctnzSttemntDetailSn" value='jjj' readonly>--%>
<input type="text" name="cvplSe" value='<c:out value="${dtlDTO.regltId}"/>' readonly>
</td>
</tr>
<tr>
<th>단속일시</th>
<td>
<fmt:parseDate value="${dtlDTO.regltDeTime}" var="regltDeTimet" pattern="yyyyMMddHHmmss"/>
<input type="text" name="regltDeTime" value='<fmt:formatDate value="${regltDeTime}" pattern="yyyy-MM-dd HH:mm:ss"/>' readonly>
</td>
<th>단속장소</th>
<td>
<input type="text" name="petiNoC" value='<c:out value="${dtlDTO.regltPlace}"/>' readonly>
</td>
<th>위반내역</th>
<td>
<input type="text" name="civilNoC" value='<c:out value="${dtlDTO.violtDtlsNm}"/>' readonly>
</td>
</tr>
<tr>
<th>GPS위도</th>
<td>
<input type="text" name="peterNameV" value='<c:out value="${dtlDTO.gpsX}"/>' readonly>
</td>
<th>GPS경도</th>
<td>
<input type="text" name="zipCodeC" value='<c:out value="${dtlDTO.gpsY}"/>' readonly>
</td>
<th>기관코드</th>
<td>
<input type="text" name="addressV" value='<c:out value="${dtlDTO.insttCode}"/>' readonly>
</td>
</tr>
<tr>
<th>과태료코드</th>
<td>
<input type="text" name="celNoV" value='<c:out value="${dtlDTO.sysCode}"/>' readonly>
</td>
<th>처리상태</th>
<td>
<input type="text" name="telNoV" value='<c:out value="${dtlDTO.ctznSttemntDetailProcessSttus}"/>' readonly>
</td>
<th>등록일시</th>
<td>
<fmt:parseDate value="${dtlDTO.registDt}" var="registDt" pattern="yyyyMMddHHmmss"/>
<input type="text" name="registDt" value='<fmt:formatDate value="${registDt}" pattern="yyyy-MM-dd HH:mm:ss"/>' readonly>
</td>
<%-- <th>단속ID</th>--%>
<%-- <td>--%>
<%-- <input type="text" name="cvplSe" value='<c:out value="${dtlDTO.regltId}"/>' readonly>--%>
<%-- </td>--%>
</tr>
<%-- </c:forEach>--%>
<%-- <tr>--%>
<%-- <th>단속일시</th>--%>
<%-- <td>--%>
<%-- <fmt:parseDate value="${dtlDTO.regltDeTime}" var="regltDeTimet" pattern="yyyyMMddHHmmss"/>--%>
<%-- <input type="text" name="regltDeTime" value="<fmt:formatDate value="${regltDeTime}" pattern="yyyy-MM-dd HH:mm:ss"/>' readonly>--%>
<%-- </td>--%>
<%-- <th>단속장소</th>--%>
<%-- <td>--%>
<%-- <input type="text" name="petiNoC" value='<c:out value="${dtlDTO.regltPlace}"/>' readonly>--%>
<%-- </td>--%>
<%-- <th>위반내역</th>--%>
<%-- <td>--%>
<%-- <input type="text" name="civilNoC" value='<c:out value="${dtlDTO.violtDtlsNm}"/>' readonly>--%>
<%-- </td>--%>
<%-- </tr>--%>
<%-- <tr>--%>
<%-- <th>GPS위도</th>--%>
<%-- <td>--%>
<%-- <input type="text" name="peterNameV" value='<c:out value="${dtlDTO.gpsX}"/>' readonly>--%>
<%-- </td>--%>
<%-- <th>GPS경도</th>--%>
<%-- <td>--%>
<%-- <input type="text" name="zipCodeC" value='<c:out value="${dtlDTO.gpsY}"/>' readonly>--%>
<%-- </td>--%>
<%-- <th>기관코드</th>--%>
<%-- <td>--%>
<%-- <input type="text" name="addressV" value='<c:out value="${dtlDTO.insttCode}"/>' readonly>--%>
<%-- </td>--%>
<%-- </tr>--%>
<%-- <tr>--%>
<%-- <th>과태료코드</th>--%>
<%-- <td>--%>
<%-- <input type="text" name="celNoV" value='<c:out value="${dtlDTO.sysCode}"/>' readonly>--%>
<%-- </td>--%>
<%-- <th>처리상태</th>--%>
<%-- <td>--%>
<%-- <input type="text" name="telNoV" value='<c:out value="${dtlDTO.ctznSttemntDetailProcessSttus}"/>' readonly>--%>
<%-- </td>--%>
<%-- <th>등록일시</th>--%>
<%-- <td>--%>
<%-- <fmt:parseDate value="${dtlDTO.registDt}" var="registDt" pattern="yyyyMMddHHmmss"/>--%>
<%-- <input type="text" name="registDt" value="<fmt:formatDate value="${registDt}" pattern="yyyy-MM-dd HH:mm:ss"/>' readonly>--%>
<%-- </td>--%>
<%-- </tr>--%>
</tbody>
</table>
</c:forEach>
</form>
<div id="ctznImg"></div>
@ -299,15 +297,6 @@
**************************************************************************/
$(document).ready(function () {
// orgData = $('form').serialize();
// fnBiz.downloadImg();
<%-- console.log('eeee');--%>
<%-- fnBiz.viewImg();--%>
<%-- //CtznStmtDTO.CtznStmtDtl--%>
<%-- <c:forEach var="dto" items="${ctznStmtDtlDTOs}">--%>
<%-- '<c:out value="${dto.vhcleNo}"/>';--%>
<%-- '<c:out value="${dto.ctnzSttemntDetailSn}"/>';--%>
<%-- <c:out value="111"/>--%>
<%-- </c:forEach>--%>
fnBiz.downloadImg();
});
</script>

Loading…
Cancel
Save