Ver código fonte

2020-03-03 bug修改

hugeng 4 anos atrás
pai
commit
31e768b2c8

+ 14 - 0
src/main/java/com/yc/education/controller/ForumController.java

@@ -162,6 +162,20 @@ public class ForumController {
                             downloadlist.setForumid(forum.getId());
                             downloadlist.setUsersid(user.getId());
                             downloadlist.setMoney(moeny);
+                            downloadlist.setType(1);
+                            //购买成功后给作者返还75%金币
+                            Users users = usersService.selectByKey(forum.getUsersid());
+                            users.setMoeny(users.getMoeny() + moeny * 0.75);
+                            int row = usersService.updateNotNull(users);
+                            if (row > 0) {
+                                Downloadlist download = new Downloadlist();
+                                download.setAddtime(new Date());
+                                download.setForumid(forum.getId());
+                                download.setUsersid(users.getId());
+                                download.setMoney(moeny * 0.75);
+                                download.setType(2);
+                                downloadlistService.save(download);
+                            }
                             int save = downloadlistService.save(downloadlist);
                             if (save > 0) {
                                 ajaxMessage.setIs(true);

+ 76 - 9
src/main/java/com/yc/education/controller/admin/OrderAdminController.java

@@ -123,15 +123,26 @@ public class OrderAdminController {
 
     @RequestMapping("export.html")
     @ResponseBody
-    public void exposrtdown(HttpServletResponse response) throws Exception {
-        List<Downloadlist> downloadlists = downloadlistService.downloadList(1, 10000, "", "", "");
-        HSSFWorkbook wb = export(downloadlists);
-        response.setContentType("application/vnd.ms-excel");
-        response.setHeader("Content-disposition", "attachment;filename=" + new String("产品下载记录".getBytes(), "ISO8859-1") + ".xls");
-        OutputStream ouputStream = response.getOutputStream();
-        wb.write(ouputStream);
-        ouputStream.flush();
-        ouputStream.close();
+    public void exposrtdown(HttpServletResponse response, int type) throws Exception {
+        if (type == 2) {
+            List<Downloadlist> downloadlists = downloadlistService.downloadList(1, 10000, "", "", "");
+            HSSFWorkbook wb = export(downloadlists);
+            response.setContentType("application/vnd.ms-excel");
+            response.setHeader("Content-disposition", "attachment;filename=" + new String("产品下载记录".getBytes(), "ISO8859-1") + ".xls");
+            OutputStream ouputStream = response.getOutputStream();
+            wb.write(ouputStream);
+            ouputStream.flush();
+            ouputStream.close();
+        } else {
+            List<Orders> orders = orderService.ORDERS_LIST(1, 10000, 1, 0);
+            HSSFWorkbook wb = exports(orders);
+            response.setContentType("application/vnd.ms-excel");
+            response.setHeader("Content-disposition", "attachment;filename=" + new String("充值记录".getBytes(), "ISO8859-1") + ".xls");
+            OutputStream ouputStream = response.getOutputStream();
+            wb.write(ouputStream);
+            ouputStream.flush();
+            ouputStream.close();
+        }
     }
 
     /**
@@ -195,6 +206,62 @@ public class OrderAdminController {
         return wb;
     }
 
+
+    /**
+     * @Description: 表格导出
+     * @Param: [page, rows]
+     * @return: org.springframework.web.servlet.ModelAndView
+     * @Author: Cc
+     * @Date: 2019-12-19
+     */
+    String[] excelHeaders = {"序列号", "用户id", "用户昵称", "订单编号", "充值金额", "充值方式", "充值时间"};
+
+    public HSSFWorkbook exports(List<Orders> orders) {
+        HSSFWorkbook wb = new HSSFWorkbook();
+        HSSFSheet sheet = wb.createSheet("Balances");
+        HSSFRow row = sheet.createRow((int) 0);
+        HSSFCellStyle style = wb.createCellStyle();
+        style.setAlignment(HSSFCellStyle.ALIGN_CENTER);
+        for (int i = 0; i < excelHeaders.length; i++) {
+            HSSFCell cell = row.createCell(i);
+            cell.setCellValue(excelHeaders[i]);
+            cell.setCellStyle(style);
+            sheet.autoSizeColumn(i);
+        }
+        for (int i = 0; i < orders.size(); i++) {
+            Orders itme = orders.get(i);
+            try {
+                Users users = usersService.selectByKey(itme.getUsersid());
+                itme.setUsers(users);
+                row = sheet.createRow(i + 1);
+                row.createCell(0).setCellValue(itme.getId());
+                row.createCell(1).setCellValue(itme.getUsers().getId());
+                row.createCell(2).setCellValue(itme.getUsers().getUsername());
+                row.createCell(3).setCellValue(itme.getOrdersid());
+                row.createCell(4).setCellValue(itme.getMoneys());
+                row.createCell(5).setCellValue(itme.getWay());
+                row.createCell(6).setCellValue(fms.format(itme.getAddtime()));
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+        }
+        //求和行
+//        row = sheet.createRow(list.size() + 1);
+//        row.createCell(0).setCellValue("入账总计");
+//        row.createCell(1).setCellValue(reprice);
+//        row.createCell(2).setCellValue("支出总计:");
+//        row.createCell(3).setCellValue(payprice);
+//        row.createCell(4).setCellValue("小计:");
+//        row.createCell(5).setCellValue(reprice - payprice);
+        sheet.autoSizeColumn((short) 0);
+        sheet.autoSizeColumn((short) 1);
+        sheet.autoSizeColumn((short) 2);
+        sheet.autoSizeColumn((short) 3);
+        sheet.autoSizeColumn((short) 4);
+        sheet.autoSizeColumn((short) 5);
+        return wb;
+    }
+
     /**
      * @return org.springframework.web.servlet.ModelAndView
      * @Author Cc

+ 2 - 0
src/main/java/com/yc/education/model/Downloadlist.java

@@ -30,6 +30,8 @@ public class Downloadlist {
 
     private Date addtime;
 
+    private Integer type;
+
     @Transient
     private Forum forum;
 

+ 3 - 1
src/main/webapp/WEB-INF/jsp/admin/orderslist.jsp

@@ -59,7 +59,7 @@
 			<span class="l">
                 <%--<a class="btn btn-primary radius" href="updhtype.html?id=0"><i--%>
                         <%--class="Hui-iconfont">&#xe600;</i> 添加类型</a>--%>
-                  <a href="export.html" class="btn btn-success"><i class="Hui-iconfont">&#xe641;</i>
+                  <a href="export.html?type=${type}" class="btn btn-success"><i class="Hui-iconfont">&#xe641;</i>
         导出数据
                 </a>
 			</span>
@@ -105,6 +105,7 @@
                         <td><fmt:formatDate value="${item.addtime }" pattern="yyyy-MM-dd"/></td>
                     </c:if>
                     <c:if test="${type == 2}">
+                        <%--                        <c:if test="${item.type == 1}">--%>
                         <td>${item.id }</td>
                         <td>${item.users.id }</td>
                         <td>${item.users.username }</td>
@@ -113,6 +114,7 @@
                         <td>${item.msgid }</td>
                         <td>${item.money }</td>
                         <td><fmt:formatDate value="${item.addtime }" pattern="yyyy-MM-dd"/></td>
+                        <%--                        </c:if>--%>
                     </c:if>
                 </tr>
             </c:forEach>

+ 5 - 6
src/main/webapp/WEB-INF/jsp/index.jsp

@@ -544,7 +544,7 @@ To change this template use File | Settings | File Templates.
                                 </div>
                             </c:if>
                         </c:forEach>
-                        <div id="forumlist">
+                        <div id="forumlist" data-am-widget="gallery" data-am-gallery="{ pureview: true }">
                             <c:forEach items="${pageInfo.list}" var="itme">
                                 <c:if test="${itme.top == 0}">
                                     <div class="mess-item box-shadow img-transition">
@@ -573,8 +573,7 @@ To change this template use File | Settings | File Templates.
                                                 ${itme.contexts}
                                         </p>
                                         <c:if test="${itme.imgurl != null && itme.imgurl != ''}">
-                                            <ul class="img-mini clearfix" data-am-widget="gallery"
-                                                data-am-gallery="{ pureview: true }">
+                                            <ul class="img-mini clearfix" >
                                                 <c:if test="${itme.imgurl.contains(',')}">
                                                     <c:set value="${fn:split(itme.imgurl, ',') }" var="arr"/>
                                                     <c:forEach items="${arr}" var="arrs">
@@ -925,15 +924,15 @@ To change this template use File | Settings | File Templates.
                             moneyhtml = '<span class="mess-price">&nbsp;<i class="iconfont"></i>' + x.money + '</span>'
                         }
                         if (x.imgurl != '' && x.imgurl != null) {
-                            imgurlhtml = '<ul class="img-mini clearfix" data-am-widget="gallery" data-am-gallery="{ pureview: true }">'
+                            imgurlhtml = '<ul class="img-mini clearfix" >'
                             if (x.imgurl.indexOf(',')) {
                                 var arr = x.imgurl.split(",");
                                 for (var j = 0; j < arr.length; j++) {
                                     var t = arr[j];
-                                    imgurlhtml = imgurlhtml + '<li><img src="' + t + '" class="am-pureview am-active"></li>';
+                                    imgurlhtml = imgurlhtml + '<li><img src="' + t + '" ></li>';
                                 }
                             } else {
-                                imgurlhtml = imgurlhtml + '<li><img src="' + x.imgurl + '" class="am-pureview am-active"></li>';
+                                imgurlhtml = imgurlhtml + '<li><img src="' + x.imgurl + '" ></li>';
                             }
                             imgurlhtml = imgurlhtml + '</ul>';
                         }

+ 1 - 1
src/main/webapp/WEB-INF/jsp/sechindex.jsp

@@ -549,7 +549,7 @@ To change this template use File | Settings | File Templates.
         </div>
         <div class="mess-btn dload-btn">
             <input type="button" class="go_pay" id="gotozf" onclick="gotozf(this)" value="去支付">
-            <input type="button" id="dload-url" disabled="" class="null-url" value="下载">
+            <a type="button" id="dload-url" download class="null-url">下载</a>
         </div>
         <div style="margin-top: 10px;">
         </div>

+ 1 - 1
src/main/webapp/WEB-INF/jsp/tixian.jsp

@@ -76,7 +76,7 @@ To change this template use File | Settings | File Templates.
                                 <ul class="setlist-menu">
                                     <em class="tri"></em><em class="tri-bg"></em>
                                     <li>
-                                        <a href="${pageContext.request.contextPath}/person.html?usesrid=${users.id}">我的主页</a>
+                                        <a href="${pageContext.request.contextPath}/person.html?usesrid=${userSession.id}">我的主页</a>
                                     </li>
                                     <li><a href="${pageContext.request.contextPath}/basic.html">账号管理</a></li>
                                     <li onclick="exits()"><a>退出</a></li>

+ 7 - 1
src/main/webapp/WEB-INF/jsp/xiaofei.jsp

@@ -161,7 +161,13 @@ To change this template use File | Settings | File Templates.
 
                                             <c:forEach items="${downloadlists}" var="downloadlist">
                                                 <tr>
-                                                    <td>${downloadlist.money}</td>
+                                                    <td><c:if test="${downloadlist.type == 1}">
+                                                        -${downloadlist.money}
+                                                    </c:if>
+                                                        <c:if test="${downloadlist.type == 2}">
+                                                            +${downloadlist.money}
+                                                        </c:if>
+                                                    </td>
                                                     <td><fmt:formatDate value="${downloadlist.addtime }"
                                                                         pattern="yyyy-MM-dd"/></td>
                                                     <td>${downloadlist.forum.title}</td>

+ 1 - 0
src/main/webapp/css/main.63.css

@@ -2004,6 +2004,7 @@ li.topic-partic > p {
     word-wrap: break-word;
     box-sizing: border-box;
     border-radius: 2px;
+	position:relative;
 }
 
 .mess-item .mess-meta-cmt {