fix: 강남심사 주정차(admin) 반영

main
minuk926 2 years ago
parent d996ea3f5f
commit ca5094cd59

@ -2,9 +2,11 @@ package com.xit.biz.ctgy.v2.repository;
import com.xit.biz.ctgy.dto.*; import com.xit.biz.ctgy.dto.*;
import com.xit.core.config.database.BaseMpowerDaoSupport; import com.xit.core.config.database.BaseMpowerDaoSupport;
import com.xit.core.exception.CustomBaseException;
import com.xit.core.oauth2.config.properties.MasterDatabaseProperties; import com.xit.core.oauth2.config.properties.MasterDatabaseProperties;
import com.xit.core.oauth2.utils.HeaderUtil; import com.xit.core.oauth2.utils.HeaderUtil;
import com.xit.core.support.sql.parser.QueryGenerator; import com.xit.core.support.sql.parser.QueryGenerator;
import lombok.extern.slf4j.Slf4j;
import org.springframework.data.domain.Page; import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable; import org.springframework.data.domain.Pageable;
import org.springframework.stereotype.Repository; import org.springframework.stereotype.Repository;
@ -13,10 +15,12 @@ import javax.validation.constraints.NotNull;
import java.time.LocalDate; import java.time.LocalDate;
import java.time.LocalDateTime; import java.time.LocalDateTime;
import java.time.format.DateTimeFormatter; import java.time.format.DateTimeFormatter;
import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
@Repository @Repository
@Slf4j
public class ParkingDao extends BaseMpowerDaoSupport { public class ParkingDao extends BaseMpowerDaoSupport {
private static final String NAME_SPACE = "parking"; private static final String NAME_SPACE = "parking";
@ -103,6 +107,7 @@ public class ParkingDao extends BaseMpowerDaoSupport {
} }
public void updateMsResult(@NotNull final Long msMaincode, @NotNull final String msSeq, @NotNull final String msResult) { public void updateMsResult(@NotNull final Long msMaincode, @NotNull final String msSeq, @NotNull final String msResult) {
final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateJudegResult") final String sql = QueryGenerator.createNamedQuery(NAME_SPACE, "updateJudegResult")
.setParameter("msMaincode", msMaincode) .setParameter("msMaincode", msMaincode)
.setParameter("msSeq", msSeq) .setParameter("msSeq", msSeq)
@ -110,6 +115,16 @@ public class ParkingDao extends BaseMpowerDaoSupport {
.getQueryString(); .getQueryString();
update(sql); update(sql);
final String mainCodeSql = QueryGenerator.createNamedQuery(NAME_SPACE, "selectRcMaincode")
.setParameter("msMaincode", msMaincode)
.getQueryString();
selectOneColumn(mainCodeSql);
final List<String> inParams = Arrays.asList("11680", "11", selectOneColumn(mainCodeSql), String.valueOf(msSeq), msResult);
final List<String> outParams = Arrays.asList("result", "message");
final String spSql = "SIMSA_EDIT_RESULT(?,?,?,?,?,?,?)";
Map<String,Object> rslt = executeSp(spSql, inParams, outParams);
if(!"1".equals(rslt.get("result"))) throw new CustomBaseException(String.valueOf(rslt.get("message")));
} }
public List<ParkingTargetDto> findParkingJudgeTargets(@NotNull final ParkingTargetDto dto) { public List<ParkingTargetDto> findParkingJudgeTargets(@NotNull final ParkingTargetDto dto) {

@ -267,6 +267,46 @@ public abstract class BaseMpowerDaoSupport {
} }
} }
/**
*
* @param sql
* @param inParams
* @param outParams result, message...
*/
public Map<String, Object> executeSp(String sql, List<String> inParams, List<String> outParams){
Objects.requireNonNull(sql, "SQL cannot be null");
Map<String,Object> map = new HashMap<>();
Client client = null;
try {
client = getConnection();
client.setInput("SQLXML", getSpQueryXml(sql, inParams, outParams));
client.Request();
//map.put("result", client.getString("result", 0, 0));
String result = client.getString("result", 0, 0);
if(result.equals("true")) {
for (int i = 0; i < client.getMaxCol("list1"); i++) {
map.put(outParams.get(i), client.getString("list1", 0, i));
}
}else{
map.put(outParams.get(0), "-9999");
map.put(outParams.get(1), result);
}
return map;
}catch (MpowerException e){
throw e;
}catch (Exception e){
throw new MpowerException(ErrorCode.MPOWER_ERROR);
} finally {
disConnection(client);
}
}
public List<Map<String, Object>> selectMapList(String sql, String fieldStr){ public List<Map<String, Object>> selectMapList(String sql, String fieldStr){
Objects.requireNonNull(sql, "SQL cannot be null"); Objects.requireNonNull(sql, "SQL cannot be null");
List<Map<String,Object>> list = new ArrayList<>(); List<Map<String,Object>> list = new ArrayList<>();
@ -360,6 +400,39 @@ public abstract class BaseMpowerDaoSupport {
"\n]]></SQL></QUERY></QUERYS>"); "\n]]></SQL></QUERY></QUERYS>");
} }
private String getSpQueryXml(String sql, List<String> inParams, List<String> outParams){
log.info("\n{}",sql);
String str = String.format(
"%s%s%s%s%s%s%s",
"<?xml version='1.0' encoding='euc-kr'?>\n<QUERYS DBNAME='",
databaseProperties.getDbName(),
"' DEBUG='true'>\n<QUERY TYPE='spcall' BATCH='false'>\n<SQL><![CDATA[\n",
sql,
"\n]]></SQL>",
setSpParam(inParams, outParams),
"\n</QUERY></QUERYS>");
log.info(str);
return str;
}
private String setSpParam(List<String> inParams, List<String> outParams){
StringBuilder sb = new StringBuilder();
sb.append("<PARAMS>");
inParams.forEach((s) -> {
sb.append("\n<PARAM><![CDATA[");
sb.append("I:").append(s);
sb.append("]]></PARAM>");
});
outParams.forEach((s) -> {
sb.append("\n<PARAM><![CDATA[");
sb.append("O:").append(s);
sb.append("]]></PARAM>");
});
sb.append("\n</PARAMS>");
return sb.toString();
}
private Client getConnection(){ private Client getConnection(){
Client mpowerClient = null; Client mpowerClient = null;
try { try {

@ -392,4 +392,10 @@
AND msu_userid = #{msuUserid} AND msu_userid = #{msuUserid}
</native-query> </native-query>
<native-query id="selectRcMaincode">
/* parking-mapper|selectRcMaincode|julim */
SELECT rc_maincode
FROM tf680_recall
WHERE rc_code = #{msMaincode}
</native-query>
</entity-mappings> </entity-mappings>
Loading…
Cancel
Save