|
|
|
@ -35,7 +35,7 @@ public abstract class BaseMpowerDaoSupport {
|
|
|
|
|
private int fileHostPort;
|
|
|
|
|
@Value("${mpower.file.serviceName}")
|
|
|
|
|
private String fileServiceName;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// 주정차이미지경로
|
|
|
|
|
@Value("${mpower.file.parkingImagePath}")
|
|
|
|
|
private String parkingImagePath;
|
|
|
|
@ -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){
|
|
|
|
|
Objects.requireNonNull(sql, "SQL cannot be null");
|
|
|
|
|
List<Map<String,Object>> list = new ArrayList<>();
|
|
|
|
@ -360,6 +400,39 @@ public abstract class BaseMpowerDaoSupport {
|
|
|
|
|
"\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(){
|
|
|
|
|
Client mpowerClient = null;
|
|
|
|
|
try {
|
|
|
|
|