|
|
|
|
@ -7,6 +7,8 @@ import java.net.http.HttpResponse;
|
|
|
|
|
import java.nio.file.Files;
|
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
import java.util.ArrayList;
|
|
|
|
|
import java.util.Arrays;
|
|
|
|
|
import java.util.Collections;
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
|
import java.util.List;
|
|
|
|
|
import java.util.Map;
|
|
|
|
|
@ -33,6 +35,7 @@ import externalsystem.nuri2.service.bean.LinuxServiceBean;
|
|
|
|
|
import externalsystem.nuri2.service.bean.Nuri2ServiceBean;
|
|
|
|
|
import externalsystem.nuri2.service.bean.WindowsServiceBean;
|
|
|
|
|
import externalsystem.testpool.RandomUtil;
|
|
|
|
|
import externalsystem.testpool.dao.TestPoolMapper;
|
|
|
|
|
@Controller
|
|
|
|
|
@RequestMapping(name="모바일 메시지 컨트롤러", value="/mms")
|
|
|
|
|
public class nuri2Controller extends AbstractController {
|
|
|
|
|
@ -40,6 +43,9 @@ public class nuri2Controller extends AbstractController {
|
|
|
|
|
@Resource(name="objectMapper")
|
|
|
|
|
private ObjectMapper objectMapper;
|
|
|
|
|
|
|
|
|
|
@Resource(name = "testPoolMapper")
|
|
|
|
|
private TestPoolMapper testPoolMapper;
|
|
|
|
|
|
|
|
|
|
@RequestMapping(name="모듈 실행 스크립트 파일 생성 팝업", value="/createScriptMain.do")
|
|
|
|
|
public ModelAndView createScriptMain() {
|
|
|
|
|
ModelAndView mav = new ModelAndView();
|
|
|
|
|
@ -165,4 +171,87 @@ public class nuri2Controller extends AbstractController {
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@RequestMapping(name="mms 발송테스트 submit", value="/sendMobileMessage.do")
|
|
|
|
|
public ModelAndView sendMobileMessage(RandomMessageCreateRequest rmcq) throws ParseException {
|
|
|
|
|
ModelAndView mav = new ModelAndView("jsonView");
|
|
|
|
|
DataObject respDataObject = new DataObject();
|
|
|
|
|
|
|
|
|
|
Map<String,Object> req = new HashMap<String,Object>();
|
|
|
|
|
|
|
|
|
|
req.put("recptnNo", RandomUtil.randomPhone());
|
|
|
|
|
|
|
|
|
|
List<Map<String,String>> args = new ArrayList<Map<String,String>>();
|
|
|
|
|
|
|
|
|
|
Map<String,String> arg = new HashMap<String,String>();
|
|
|
|
|
|
|
|
|
|
DataObject chgr = testPoolMapper.selectRandomChgr();
|
|
|
|
|
arg = new HashMap<String,String>();
|
|
|
|
|
arg.put("argName", "충전소");
|
|
|
|
|
arg.put("argValue", chgr.string("STN_NM"));
|
|
|
|
|
args.add(arg);
|
|
|
|
|
|
|
|
|
|
arg = new HashMap<String,String>();
|
|
|
|
|
arg.put("argName", "충전기");
|
|
|
|
|
arg.put("argValue", chgr.string("CHGR_NM"));
|
|
|
|
|
args.add(arg);
|
|
|
|
|
|
|
|
|
|
switch(rmcq.getMsgPrps()) {
|
|
|
|
|
case "02":
|
|
|
|
|
arg = new HashMap<String,String>();
|
|
|
|
|
arg.put("argName", "입차시간");
|
|
|
|
|
arg.put("argValue", RandomUtil.randomYmdhhmmss(rmcq.getIbchaFrom(), rmcq.getIbchaTo()));
|
|
|
|
|
args.add(arg);
|
|
|
|
|
case "03":
|
|
|
|
|
List<String> GyeongGwa = Arrays.asList("50분", "60분", "12시간");
|
|
|
|
|
Collections.shuffle(GyeongGwa);
|
|
|
|
|
arg = new HashMap<String,String>();
|
|
|
|
|
arg.put("argName", "주차시간");
|
|
|
|
|
arg.put("argValue", GyeongGwa.get(0));
|
|
|
|
|
args.add(arg);
|
|
|
|
|
|
|
|
|
|
arg = new HashMap<String,String>();
|
|
|
|
|
arg.put("argName", "차량번호");
|
|
|
|
|
arg.put("argValue", RandomUtil.randomCarNo());
|
|
|
|
|
args.add(arg);
|
|
|
|
|
break;
|
|
|
|
|
case "04":
|
|
|
|
|
arg = new HashMap<String,String>();
|
|
|
|
|
arg.put("argName", "신청일자");
|
|
|
|
|
arg.put("argValue", RandomUtil.randomYmd(rmcq.getSincheongFrom(), rmcq.getSincheongTo()));
|
|
|
|
|
args.add(arg);
|
|
|
|
|
|
|
|
|
|
arg = new HashMap<String,String>();
|
|
|
|
|
arg.put("argName", "차량번호");
|
|
|
|
|
arg.put("argValue", RandomUtil.randomCarNo());
|
|
|
|
|
args.add(arg);
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
req.put("args", args);
|
|
|
|
|
|
|
|
|
|
HttpResponse<String> apiRslt = new WebClient().post(request -> {
|
|
|
|
|
request.contentType(WebClient.Request.ContentType.JSON);
|
|
|
|
|
request.uri(rmcq.getDest());
|
|
|
|
|
request.data("msgPrps", rmcq.getMsgPrps());
|
|
|
|
|
request.data("reqSys", "01");
|
|
|
|
|
request.data("sggCd", rmcq.getSggCd());
|
|
|
|
|
request.data("teskSeCd", "");
|
|
|
|
|
request.data("msgDtlPrps", "");
|
|
|
|
|
request.data("reqs", List.of(req));
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
String rslt = apiRslt.body();
|
|
|
|
|
try {
|
|
|
|
|
respDataObject = objectMapper.readValue(rslt, new TypeReference<DataObject>() {});
|
|
|
|
|
} catch (JsonMappingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
} catch (JsonProcessingException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
mav.addObject("respDataObject", respDataObject);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return mav;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|