|
@@ -27,7 +27,7 @@ public class TruckController {
|
|
|
*/
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.POST)
|
|
@RequestMapping(method = RequestMethod.POST)
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
- public void add(HttpSession session, Long noticeId) {
|
|
|
|
|
|
|
+ public Object add(HttpSession session, Long noticeId) {
|
|
|
Object track = session.getAttribute(TRUCK);
|
|
Object track = session.getAttribute(TRUCK);
|
|
|
Long[] noticeArray = null;
|
|
Long[] noticeArray = null;
|
|
|
if (track != null)
|
|
if (track != null)
|
|
@@ -35,9 +35,10 @@ public class TruckController {
|
|
|
else
|
|
else
|
|
|
noticeArray = new Long[] {};
|
|
noticeArray = new Long[] {};
|
|
|
if (!ArrayUtils.contains(noticeArray, noticeId)) {
|
|
if (!ArrayUtils.contains(noticeArray, noticeId)) {
|
|
|
- ArrayUtils.add(noticeArray, noticeId);
|
|
|
|
|
|
|
+ noticeArray = ArrayUtils.add(noticeArray, noticeId);
|
|
|
session.setAttribute(TRUCK, noticeArray);
|
|
session.setAttribute(TRUCK, noticeArray);
|
|
|
}
|
|
}
|
|
|
|
|
+ return noticeArray;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -47,16 +48,17 @@ public class TruckController {
|
|
|
*/
|
|
*/
|
|
|
@RequestMapping(method = RequestMethod.DELETE)
|
|
@RequestMapping(method = RequestMethod.DELETE)
|
|
|
@ResponseBody
|
|
@ResponseBody
|
|
|
- public void delete(HttpSession session, Long noticeId) {
|
|
|
|
|
|
|
+ public Object delete(HttpSession session, Long noticeId) {
|
|
|
Object track = session.getAttribute(TRUCK);
|
|
Object track = session.getAttribute(TRUCK);
|
|
|
if (track != null) {
|
|
if (track != null) {
|
|
|
if (noticeId != null) {
|
|
if (noticeId != null) {
|
|
|
Long[] noticeArray = (Long[]) track;
|
|
Long[] noticeArray = (Long[]) track;
|
|
|
- ArrayUtils.removeElement(noticeArray, noticeId);
|
|
|
|
|
|
|
+ noticeArray = ArrayUtils.removeElement(noticeArray, noticeId);
|
|
|
session.setAttribute(TRUCK, noticeArray);
|
|
session.setAttribute(TRUCK, noticeArray);
|
|
|
} else
|
|
} else
|
|
|
session.removeAttribute(TRUCK);// 清除货车的商品
|
|
session.removeAttribute(TRUCK);// 清除货车的商品
|
|
|
}
|
|
}
|
|
|
|
|
+ return session.getAttribute(TRUCK);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
/**
|
|
/**
|