数据库第二次大作业boostore
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.
 
 
 

165 Zeilen
4.7 KiB

<!DOCTYPE html>
<html id="htmlId">
<head>
<title>Coverage Report > BuyerController</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.controller</a>
</div>
<h1>Coverage Summary for Class: BuyerController (cn.edu.ecnu.stu.bookstore.controller)</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">BuyerController</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">
(6/6)
</span>
</td>
<td class="coverageStat">
<span class="percent">
94.7%
</span>
<span class="absValue">
(18/19)
</span>
</td>
</tr>
</table>
<br/>
<br/>
<pre>
<code class="sourceCode" id="sourceCode">&nbsp;package cn.edu.ecnu.stu.bookstore.controller;
&nbsp;
&nbsp;import cn.edu.ecnu.stu.bookstore.component.AppException;
&nbsp;import cn.edu.ecnu.stu.bookstore.component.Constants;
&nbsp;import cn.edu.ecnu.stu.bookstore.component.Result;
&nbsp;import cn.edu.ecnu.stu.bookstore.pojo.vo.NewOrderVO;
&nbsp;import cn.edu.ecnu.stu.bookstore.service.impl.BuyerService;
&nbsp;import com.alibaba.fastjson.JSONObject;
&nbsp;import org.springframework.beans.factory.annotation.Autowired;
&nbsp;import org.springframework.util.StringUtils;
&nbsp;import org.springframework.web.bind.annotation.*;
&nbsp;
&nbsp;import java.math.BigDecimal;
&nbsp;import java.util.Map;
&nbsp;
&nbsp;@RestController
&nbsp;@RequestMapping(&quot;/buyer&quot;)
<b class="fc">&nbsp;public class BuyerController {</b>
&nbsp;
&nbsp; @Autowired
&nbsp; private BuyerService buyerService;
&nbsp;
&nbsp; @PostMapping(&quot;/new_order&quot;)
&nbsp; public Result newOrder(@RequestBody NewOrderVO newOrderVO) {
<b class="fc">&nbsp; buyerService.newOrder(newOrderVO);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;
&nbsp; @PostMapping(&quot;/payment&quot;)
&nbsp; public Result payment(@RequestBody JSONObject object) {
<b class="fc">&nbsp; Integer userId = object.getInteger(&quot;userId&quot;);</b>
<b class="fc">&nbsp; String orderId = object.getString(&quot;orderId&quot;);</b>
<b class="fc">&nbsp; String password = object.getString(&quot;password&quot;);</b>
<b class="fc">&nbsp; buyerService.payment(userId, orderId, password);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;
&nbsp; @PostMapping(&quot;/add_funds&quot;)
&nbsp; public Result addFunds(@RequestBody JSONObject object) {
<b class="fc">&nbsp; String username = object.getString(&quot;username&quot;);</b>
<b class="fc">&nbsp; String password = object.getString(&quot;password&quot;);</b>
<b class="fc">&nbsp; BigDecimal addValue = object.getBigDecimal(&quot;addValue&quot;);</b>
<b class="fc">&nbsp; buyerService.addFunds(username, password, addValue);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;
&nbsp; @GetMapping(&quot;/order&quot;)
&nbsp; public Result order() {
<b class="fc">&nbsp; return Result.success(buyerService.getOrderList());</b>
&nbsp; }
&nbsp;
&nbsp; @PostMapping(&quot;/take_delivery&quot;)
&nbsp; public Result takeDelivery(@RequestBody Map&lt;String, String&gt; body) {
<b class="fc">&nbsp; String orderId = body.get(&quot;orderId&quot;);</b>
<b class="fc">&nbsp; if(!StringUtils.hasText(orderId))</b>
<b class="nc">&nbsp; throw new AppException(Constants.CLIENT_ERROR, Constants.PARAMETER_ERROR_MESSAGE);</b>
<b class="fc">&nbsp; buyerService.takeDelivery(orderId);</b>
<b class="fc">&nbsp; return Result.success();</b>
&nbsp; }
&nbsp;
&nbsp;
&nbsp;}
</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 18:32</div>
</div>
</body>
</html>