-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTest.java
More file actions
90 lines (67 loc) · 3.24 KB
/
Test.java
File metadata and controls
90 lines (67 loc) · 3.24 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
@Override
public ResultBody selectOrderDetail(HashMap<String, Object> param) throws Exception {
ResultBody resultBody = new ResultBody();
HashMap<String, Object> map = new HashMap<String,Object>();
ObjectMapper mapper = new ObjectMapper();
OrderGoodsVO goods = new OrderGoodsVO();
try {
CommonVO common = new CommonVO();
common.setMallId(param.get("mallId").toString());
String secretKey = commonDAO.selectApiSecretKey(common);
if( secretKey.equals("") ) {
resultBody.setCode(ReturnMessage.NOSECRETKEY.getCode());
resultBody.setMessage(ReturnMessage.NOSECRETKEY.getMessage());
} else {
// data object 복호화
String paramData = StringUtil.nvl(param.get("data"));
String decryptString = Crypto.decrypt(paramData, secretKey);
OrderVO order = mapper.readValue(decryptString, OrderVO.class);
if(order.getOrdrIdx() == 0) {
resultBody.setCode(ReturnMessage.NOIDX.getCode());
resultBody.setMessage(ReturnMessage.NOIDX.getMessage());
}else {
HashMap<String, Object> maping = new HashMap<String,Object>();
ArrayList<HashMap<String,Object>> OrderDetailAll= new ArrayList<HashMap<String,Object>>();
OrderVO orderDetail = apiOrderDao.selectOrderDetail(order);
goods.setOrdrIdx(order.getOrdrIdx());
List<OrderGoodsVO> orderGoodsList = apiOrderDao.selectGoodsList(goods);
if(orderDetail == null || orderGoodsList.size() == 0) {
// HashMap<String, Object> maping = new HashMap<String,Object>();
// ArrayList<HashMap<String,Object>> OrderDetailAll= new ArrayList<HashMap<String,Object>>();
maping.put("orderDetail", orderDetail);
OrderDetailAll.add(maping);
maping = new HashMap<String, Object>();
maping.put("orderGoodsList", orderGoodsList);
OrderDetailAll.add(maping);
JSONObject data = new JSONObject();
data.put("contents", mapper.writeValueAsString(OrderDetailAll));
String encryptString = Crypto.encrypt(data.toString(), secretKey);
resultBody.setCode(ReturnMessage.NODATA.getCode());
resultBody.setMessage(ReturnMessage.NODATA.getMessage());
resultBody.setData(encryptString);
}else {
// map.put("orderDetail", mapper.writeValueAsString(orderDetail));
// map.put("orderGoodsList", mapper.writeValueAsString(orderGoodsList));
// HashMap<String, Object> maping = new HashMap<String,Object>();
// ArrayList<HashMap<String,Object>> OrderDetailAll= new ArrayList<HashMap<String,Object>>();
maping.put("orderDetail", orderDetail);
OrderDetailAll.add(maping);
maping = new HashMap<String, Object>();
maping.put("orderGoodsList", orderGoodsList);
OrderDetailAll.add(maping);
JSONObject data = new JSONObject();
data.put("contents", mapper.writeValueAsString(OrderDetailAll));
String encryptString = Crypto.encrypt(data.toString(), secretKey);
resultBody.setCode(ReturnMessage.SUCCESS.getCode());
resultBody.setMessage(ReturnMessage.SUCCESS.getMessage());
resultBody.setData(encryptString);
}
}
}
}catch(Exception e){
log.error(e.getMessage());
resultBody.setCode(ReturnMessage.FAILURE.getCode());
resultBody.setMessage(ReturnMessage.FAILURE.getMessage());
}
return resultBody;
}