ソースを参照

商品资质上传

plf 4 年 前
コミット
50e8c87e60

+ 9 - 2
src/main/java/com/caimei/modules/order/service/NewOrderService.java

@@ -2010,13 +2010,20 @@ public class NewOrderService extends CrudService<NewOrderDao, NewOrder> {
     public List<LogisticsRecord> qualificationInfo(Integer logisticsBatchId) {
         List<LogisticsRecord> logisticsRecords = logisticsRecordDao.findByLogisticsBatchID(logisticsBatchId);
         String wwwServer = Global.getConfig("wwwServer");
-        logisticsRecords.forEach(item -> {
+        Iterator<LogisticsRecord> iterator = logisticsRecords.iterator();
+        while (iterator.hasNext()) {
+            LogisticsRecord item = iterator.next();
             item.setImage(AppUtils.getImageURL("product", item.getImage(), 0, wwwServer));
             List<CmFile> fileList = newOrderDao.findQualificationFile(item.getId());
             item.setFileList(fileList);
             List<String> images = newOrderDao.findQualificationImage(Integer.valueOf(item.getId()));
             item.setImageList(images);
-        });
+            boolean isFile = (fileList == null || fileList.size() == 0);
+            boolean isImage = (images == null || images.size() == 0);
+            if (StringUtils.isBlank(item.getSn()) && isFile && isImage) {
+                iterator.remove();
+            }
+        }
         return logisticsRecords;
     }
 }

+ 8 - 5
src/main/java/com/caimei/modules/order/web/NewOrderController.java

@@ -2096,14 +2096,17 @@ public class NewOrderController extends BaseController {
      * 查看商品资质
      */
     @RequestMapping("qualificationInfo")
-    public String qualificationInfo(Integer logisticsBatchId, Model model) {
+    public String qualificationInfo(Integer logisticsBatchId, Integer orderId, Model model) {
         List<LogisticsRecord> recordList = newOrderService.qualificationInfo(logisticsBatchId);
         model.addAttribute("recordList", recordList);
-        model.addAttribute("shopName", recordList.get(0).getShopName());
-        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
-        String uploadTime = format.format(recordList.get(0).getUploadTime());
-        model.addAttribute("uploadTime", uploadTime);
+        if (recordList != null && recordList.size() > 0) {
+            model.addAttribute("shopName", recordList.get(0).getShopName());
+            SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+            String uploadTime = format.format(recordList.get(0).getUploadTime());
+            model.addAttribute("uploadTime", uploadTime);
+        }
         model.addAttribute("logisticsBatchId", logisticsBatchId);
+        model.addAttribute("orderId", orderId);
         return "modules/order/qualificationInfo";
     }
 }

+ 1 - 1
src/main/webapp/WEB-INF/views/modules/order/logisticsDetails.jsp

@@ -75,7 +75,7 @@
                 </table>
             </c:forEach>
             <div class="select-ship" style="float:right">
-                <input class="btn btn-primary" type="button" value="查看商品资质" onclick="window.location.href='${ctx}/order/qualificationInfo?logisticsBatchId=${liv.logisticsBatch.id}'" style="margin-right: 100px"/>
+                <input class="btn btn-primary" type="button" value="查看商品资质" onclick="window.location.href='${ctx}/order/qualificationInfo?logisticsBatchId=${liv.logisticsBatch.id}&orderId=${liv.logisticsBatch.orderID}'" style="margin-right: 100px"/>
             </div>
             <c:forEach items="${liv.logisticsInformationList}" var="lis">
                 <div class="more-order">

+ 32 - 24
src/main/webapp/WEB-INF/views/modules/order/qualificationInfo.jsp

@@ -38,33 +38,41 @@
 </head>
 <body>
 <ul class="nav nav-tabs">
-    <li><a href="${ctx}/order/logisticsDetails?orderID=">发货记录</a></li>
-    <li class="active"><a href="${ctx}/order/qualificationInfo?logisticsBatchId=${logisticsBatchId}">商品资质</a></li>
+    <li><a href="${ctx}/order/logisticsDetails?orderID=${orderId}">发货记录</a></li>
+    <li class="active"><a href="${ctx}/order/qualificationInfo?logisticsBatchId=${logisticsBatchId}&orderId=${orderId}">商品资质</a></li>
 </ul><br/>
-<div style="margin-left: 75px">
-    <font style="font-size: 20px;font-weight: bold">${shopName}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${uploadTime}</font>
-    <br><br>
-    <c:forEach items="${recordList}" var="record" varStatus="status">
-        <label><font style="font-weight: bold">商品${status.index+1}:</font>${record.productName}</label><br><br>
-        <label><font style="font-weight: bold">SN码:</font>${record.sn}</label><br><br>
-        <label>
-            <font style="font-weight: bold">资质文件:</font>
-        <c:forEach items="${record.fileList}" var="file">
-            <p style="margin-left: 55px">${file.fileName}&nbsp;&nbsp;&nbsp;&nbsp;<a href="${ctx}/oss/cmOssArchive/fileDownload?ossName=${file.ossName}&fileName=${file.fileName}">下载</a></p>
+<c:if test="${not empty recordList}">
+    <div style="margin-left: 75px">
+        <font style="font-size: 20px;font-weight: bold">${shopName}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;${uploadTime}</font>
+        <br><br>
+        <c:forEach items="${recordList}" var="record" varStatus="status">
+            <label><font style="font-weight: bold">商品${status.index+1}:</font>${record.productName}</label><br><br>
+            <label><font style="font-weight: bold">SN码:</font>${record.sn}</label><br><br>
+            <label>
+                <font style="font-weight: bold">资质文件:</font>
+            <c:forEach items="${record.fileList}" var="file">
+                <p style="margin-left: 55px">${file.fileName}&nbsp;&nbsp;&nbsp;&nbsp;<a href="${ctx}/oss/cmOssArchive/fileDownload?ossName=${file.ossName}&fileName=${file.fileName}">下载</a></p>
+            </c:forEach>
+            </label><br><br>
+            <label><font style="font-weight: bold">图片:</font>
+            <c:forEach items="${record.imageList}" var="image">
+                    <img src="${image}" width="100" height="100">&nbsp;&nbsp;
+            </c:forEach>
+            </label><br>
+           <hr style="border:1px dashed #000">
         </c:forEach>
-        </label><br><br>
-        <label><font style="font-weight: bold">图片:</font>
-        <c:forEach items="${record.imageList}" var="image">
-                <img src="${image}" width="100" height="100">&nbsp;&nbsp;
-        </c:forEach>
-        </label><br>
-       <hr style="border:1px dashed #000">
-    </c:forEach>
-    <br><br>
-    <div class="select-ship">
-        <input class="btn btn-primary" type="button" value="编辑" onclick="window.location.href='${ctx}/order/qualificationList?logisticsBatchId=${logisticsBatchId}'"/>
+        <br><br>
+        <div style="text-align: center">
+            <input class="btn btn-primary" type="button" value="编辑" onclick="window.location.href='${ctx}/order/qualificationList?logisticsBatchId=${logisticsBatchId}'"/>
+        </div>
+    </div>
+</c:if>
+<c:if test="${empty recordList}">
+    <div style="text-align: center">
+        <font color="#00bfff">尚未添加资质信息</font><br><br>
+        <input class="btn btn-primary" type="button" value="去补充" onclick="window.location.href='${ctx}/order/qualificationList?logisticsBatchId=${logisticsBatchId}'"/>
     </div>
-</div>
+</c:if>
 </body>
 </html>