|
|
|
|
|
|
<!DOCTYPE html>
|
|
<html id="htmlId">
|
|
<head>
|
|
<title>Coverage Report > OrderService</title>
|
|
<style type="text/css">
|
|
@import "../../css/coverage.css";
|
|
@import "../../css/idea.min.css";
|
|
</style>
|
|
<script type="text/javascript" src="../../js/highlight.min.js"></script>
|
|
<script type="text/javascript" src="../../js/highlightjs-line-numbers.min.js"></script>
|
|
</head>
|
|
|
|
<body>
|
|
<div class="content">
|
|
<div class="breadCrumbs">
|
|
Current scope: <a href="../../index.html">all classes</a>
|
|
<span class="separator">|</span>
|
|
<a href="../index.html">cn.edu.ecnu.stu.bookstore.service.impl</a>
|
|
</div>
|
|
|
|
<h1>Coverage Summary for Class: OrderService (cn.edu.ecnu.stu.bookstore.service.impl)</h1>
|
|
|
|
<table class="coverageStats">
|
|
<tr>
|
|
<th class="name">Class</th>
|
|
<th class="coverageStat
|
|
">
|
|
Class, %
|
|
</th>
|
|
<th class="coverageStat
|
|
">
|
|
Method, %
|
|
</th>
|
|
<th class="coverageStat
|
|
">
|
|
Line, %
|
|
</th>
|
|
</tr>
|
|
<tr>
|
|
<td class="name">OrderService</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
100%
|
|
</span>
|
|
<span class="absValue">
|
|
(1/1)
|
|
</span>
|
|
</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
100%
|
|
</span>
|
|
<span class="absValue">
|
|
(4/4)
|
|
</span>
|
|
</td>
|
|
<td class="coverageStat">
|
|
<span class="percent">
|
|
87.5%
|
|
</span>
|
|
<span class="absValue">
|
|
(7/8)
|
|
</span>
|
|
</td>
|
|
</tr>
|
|
|
|
</table>
|
|
|
|
<br/>
|
|
<br/>
|
|
|
|
|
|
<pre>
|
|
<code class="sourceCode" id="sourceCode"> package cn.edu.ecnu.stu.bookstore.service.impl;
|
|
|
|
import cn.edu.ecnu.stu.bookstore.component.AppException;
|
|
import cn.edu.ecnu.stu.bookstore.component.Constants;
|
|
import cn.edu.ecnu.stu.bookstore.mapper.OrderMapper;
|
|
import cn.edu.ecnu.stu.bookstore.pojo.Order;
|
|
import cn.edu.ecnu.stu.bookstore.pojo.OrderStatus;
|
|
import cn.edu.ecnu.stu.bookstore.pojo.User;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.security.core.context.SecurityContextHolder;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
|
import java.util.List;
|
|
|
|
@Service
|
|
<b class="fc"> public class OrderService {</b>
|
|
|
|
@Autowired
|
|
private OrderMapper orderMapper;
|
|
|
|
public List<Order> getOrderList(Integer status) {
|
|
<b class="fc"> User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();</b>
|
|
<b class="fc"> return orderMapper.select(user.getId(), status == null ? null : OrderStatus.getByValue(status));</b>
|
|
}
|
|
|
|
public void cancelOrder(String orderId) {
|
|
<b class="fc"> User user = (User) SecurityContextHolder.getContext().getAuthentication().getPrincipal();</b>
|
|
<b class="fc"> if(orderMapper.checkOrder(orderId, user.getId()) != 1)</b>
|
|
<b class="nc"> throw new AppException(Constants.CLIENT_ERROR, Constants.AUTHORITY_ERROR);</b>
|
|
<b class="fc"> orderMapper.updateOrderStatus(orderId, OrderStatus.CANCEL);</b>
|
|
}
|
|
|
|
public void add(Order order) {
|
|
<b class="fc"> orderMapper.insert(order);</b>
|
|
}
|
|
}
|
|
</code>
|
|
</pre>
|
|
</div>
|
|
|
|
<script type="text/javascript">
|
|
(function() {
|
|
var msie = false, msie9 = false;
|
|
/*@cc_on
|
|
msie = true;
|
|
@if (@_jscript_version >= 9)
|
|
msie9 = true;
|
|
@end
|
|
@*/
|
|
|
|
if (!msie || msie && msie9) {
|
|
hljs.highlightAll()
|
|
hljs.initLineNumbersOnLoad();
|
|
}
|
|
})();
|
|
</script>
|
|
|
|
<div class="footer">
|
|
|
|
<div style="float:right;">generated on 2023-12-12 12:29</div>
|
|
</div>
|
|
</body>
|
|
</html>
|