Browse Source

铸造订单

licailing 4 years ago
parent
commit
a4c1201d31

+ 3 - 2
src/main/java/com/izouma/nineth/repo/CollectionRepo.java

@@ -29,11 +29,12 @@ public interface CollectionRepo extends JpaRepository<Collection, Long>, JpaSpec
     @Query(value = "update collection_info c set c.on_shelf = ?2, c.salable = ?3, c.start_time = ?4, " +
     @Query(value = "update collection_info c set c.on_shelf = ?2, c.salable = ?3, c.start_time = ?4, " +
             "c.schedule_sale = ?5, c.sort = ?6, c.detail = ?7, c.privileges = ?8, " +
             "c.schedule_sale = ?5, c.sort = ?6, c.detail = ?7, c.privileges = ?8, " +
             "c.properties = ?9, c.model3d = ?10, c.max_count = ?11, c.count_id = ?12, c.scan_code = ?13, " +
             "c.properties = ?9, c.model3d = ?10, c.max_count = ?11, c.count_id = ?12, c.scan_code = ?13, " +
-            "c.no_sold_out = ?14 where c.id = ?1", nativeQuery = true)
+            "c.no_sold_out = ?14, c.assignment = ?15 where c.id = ?1", nativeQuery = true)
     @CacheEvict(value = {"collection", "recommend"}, allEntries = true)
     @CacheEvict(value = {"collection", "recommend"}, allEntries = true)
     void update(@Nonnull Long id, boolean onShelf, boolean salable, LocalDateTime startTime,
     void update(@Nonnull Long id, boolean onShelf, boolean salable, LocalDateTime startTime,
                 boolean schedule, int sort, String detail, String privileges,
                 boolean schedule, int sort, String detail, String privileges,
-                String properties, String model3d, int maxCount, String countId, boolean scanCode, boolean noSoldOut);
+                String properties, String model3d, int maxCount, String countId, boolean scanCode,
+                boolean noSoldOut, int assignment);
 
 
     @Cacheable("collection")
     @Cacheable("collection")
     Optional<Collection> findById(@Nonnull Long id);
     Optional<Collection> findById(@Nonnull Long id);

+ 2 - 1
src/main/java/com/izouma/nineth/service/CollectionService.java

@@ -141,7 +141,8 @@ public class CollectionService {
                 record.getStartTime(), record.isScheduleSale(), record.getSort(),
                 record.getStartTime(), record.isScheduleSale(), record.getSort(),
                 record.getDetail(), JSON.toJSONString(record.getPrivileges()),
                 record.getDetail(), JSON.toJSONString(record.getPrivileges()),
                 JSON.toJSONString(record.getProperties()), JSON.toJSONString(record.getModel3d()),
                 JSON.toJSONString(record.getProperties()), JSON.toJSONString(record.getModel3d()),
-                record.getMaxCount(), record.getCountId(), record.isScanCode(), record.isNoSoldOut());
+                record.getMaxCount(), record.getCountId(), record.isScanCode(), record.isNoSoldOut(),
+                record.getAssignment());
 
 
         record = collectionRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
         record = collectionRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
         onShelfTask(record);
         onShelfTask(record);

+ 11 - 6
src/main/java/com/izouma/nineth/web/MintOrderController.java

@@ -4,11 +4,11 @@ import com.izouma.nineth.converter.LongArrayConverter;
 import com.izouma.nineth.domain.MintActivity;
 import com.izouma.nineth.domain.MintActivity;
 import com.izouma.nineth.domain.MintOrder;
 import com.izouma.nineth.domain.MintOrder;
 import com.izouma.nineth.dto.MintOrderDTO;
 import com.izouma.nineth.dto.MintOrderDTO;
-import com.izouma.nineth.repo.MintActivityRepo;
-import com.izouma.nineth.service.MintOrderService;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.dto.PageQuery;
 import com.izouma.nineth.exception.BusinessException;
 import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.MintActivityRepo;
 import com.izouma.nineth.repo.MintOrderRepo;
 import com.izouma.nineth.repo.MintOrderRepo;
+import com.izouma.nineth.service.MintOrderService;
 import com.izouma.nineth.utils.ObjUtils;
 import com.izouma.nineth.utils.ObjUtils;
 import com.izouma.nineth.utils.SecurityUtils;
 import com.izouma.nineth.utils.SecurityUtils;
 import com.izouma.nineth.utils.excel.ExcelUtils;
 import com.izouma.nineth.utils.excel.ExcelUtils;
@@ -19,10 +19,7 @@ import org.springframework.web.bind.annotation.*;
 
 
 import javax.servlet.http.HttpServletResponse;
 import javax.servlet.http.HttpServletResponse;
 import java.io.IOException;
 import java.io.IOException;
-import java.util.List;
-import java.util.Map;
-import java.util.Objects;
-import java.util.Set;
+import java.util.*;
 import java.util.stream.Collectors;
 import java.util.stream.Collectors;
 
 
 @RestController
 @RestController
@@ -107,5 +104,13 @@ public class MintOrderController extends BaseController {
     public void delivery(@RequestParam Long id, @RequestParam String courierId) {
     public void delivery(@RequestParam Long id, @RequestParam String courierId) {
         mintOrderService.dispatch(id, courierId);
         mintOrderService.dispatch(id, courierId);
     }
     }
+
+    @GetMapping("/{id}/status")
+    public Object status(@PathVariable Long id) {
+        MintOrder order = mintOrderRepo.findById(id).orElseThrow(new BusinessException("订单不存在"));
+        return new HashMap<>() {{
+            put("status", order.getStatus());
+        }};
+    }
 }
 }
 
 

+ 1 - 1
src/main/java/com/izouma/nineth/web/OrderPayController.java

@@ -149,7 +149,7 @@ public class OrderPayController {
         String payUrl = (String) mintOrderService.payAdapay(id, "alipay_wap", null);
         String payUrl = (String) mintOrderService.payAdapay(id, "alipay_wap", null);
         model.addAttribute("payUrl", payUrl);
         model.addAttribute("payUrl", payUrl);
         model.addAttribute("orderId", id);
         model.addAttribute("orderId", id);
-        return "AlipayHtml";
+        return "AlipayHtml2";
     }
     }
 
 
     @RequestMapping(value = "/mint/alipay_qr", method = RequestMethod.GET)
     @RequestMapping(value = "/mint/alipay_qr", method = RequestMethod.GET)

+ 177 - 0
src/main/resources/templates/AlipayHtml2.ftlh

@@ -0,0 +1,177 @@
+<!DOCTYPE html>
+<html lang="zh-CN">
+
+<head>
+    <meta charset="utf-8">
+    <meta http-equiv="X-UA-Compatible" content="IE=edge">
+    <meta name="viewport" content="width=device-width,initial-scale=1.0">
+    <title>支付</title>
+    <script src="/static/js/jquery.min.js"></script>
+    <style>
+        html {
+            width: 100%;
+            height: 100%;
+            padding: 0;
+            margin: 0;
+            font-family: -apple-system, SF UI Text, Arial, PingFang SC, Hiragino Sans GB, Microsoft YaHei, WenQuanYi Micro Hei, sans-serif;
+            font-size: 14px;
+            font-weight: 400;
+            line-height: 1.6;
+        }
+
+        body {
+            width: 100%;
+            height: 100%;
+            padding: 0;
+            margin: 0;
+            background: #1677ff url(/static/img/zfb.png) no-repeat top;
+            background-size: 100%;
+        }
+
+        .overlay .overlay-img {
+            width: 186px;
+            height: 210px;
+            margin-right: 15px;
+        }
+
+        .overlay .overlay-text1 {
+            width: 272px;
+            font-size: 16px;
+            font-weight: bold;
+            color: rgba(255, 255, 255, 1);
+            line-height: 22px;
+            margin: 15px auto 0;
+        }
+
+        .overlay .overlay-text2 {
+            width: 272px;
+            font-size: 13px;
+            color: rgba(255, 255, 255, 1);
+            line-height: 18px;
+            margin: 15px auto 0;
+        }
+
+        .overlay {
+            position: fixed;
+            top: 0;
+            right: 0;
+            bottom: 0;
+            left: 0;
+            background: rgba(0, 0, 0, 0.7);
+            display: none;
+        }
+
+        #btn-zfb {
+            width: 100%;
+            margin: auto;
+            background: #ffffff;
+            line-height: 52px;
+            height: 52px;
+            outline: none;
+            color: #1677ff;
+            font-size: 18px;
+            letter-spacing: 3px;
+            font-weight: 400;
+            border-radius: 8px;
+            border: none;
+        }
+
+        #btn-zfb:active {
+            background: rgba(240, 240, 240, 1);
+        }
+
+        #btn-finish:active {
+            background: rgba(0, 0, 0, 0.03);
+        }
+
+        #btn-finish {
+            width: 100%;
+            line-height: 50px;
+            height: 52px;
+            outline: none;
+            font-size: 18px;
+            letter-spacing: 3px;
+            font-weight: 400;
+            border-radius: 8px;
+            margin: 20px auto 0 auto;
+            border: 2px solid #ffffff;
+            color: #ffffff;
+            background: none;
+        }
+
+        .btns {
+            width: 80%;
+            display: flex;
+            align-items: center;
+            justify-content: center;
+            position: absolute;
+            left: 0;
+            right: 0;
+            top: 0;
+            bottom: 0;
+            margin: auto;
+            flex-direction: column;
+        }
+
+        .btns a {
+            width: 100%;
+        }
+    </style>
+</head>
+
+<body>
+<div class="overlay" id="overlay">
+    <div style="text-align: right"><img class="overlay-img" src="/static/img/zhifu_img_liulanqi_ios.png" alt=""/>
+    </div>
+    <div class="overlay-text1">请点击右上角,选择在默认浏览器中打开然后继续完成支付</div>
+    <div class="overlay-text2">注:由于微信限制,需要在浏览器中打开才可以完成支付宝支付</div>
+</div>
+
+<div class="btn-wrapper" style="display: none">
+    <div class="btns">
+        <a id="link" href="alipays://platformapi/startapp?saId=10000007&qrcode=${payUrl?no_esc}">
+            <button id="btn-zfb">打开支付宝</button>
+        </a>
+        <a id="" href="/9th/orders">
+            <button id="btn-finish">我已完成支付</button>
+        </a>
+    </div>
+</div>
+<script>
+    function GetQueryString(name) {
+        var after = window.location.href.split("?")[1];
+        if (after) {
+            var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)");
+            var r = after.match(reg);
+            if (r != null) {
+                return decodeURIComponent(r[2]);
+            } else {
+                return null;
+            }
+        }
+    }
+
+    setInterval(function () {
+        $.get('/mintOrder/${orderId}/status', function (data) {
+            console.log(data);
+            if (data.status !== 'NOT_PAID') {
+                window.location = '/9th/activityOrderDetail?id=${orderId}';
+            }
+        });
+    }, 1000);
+
+    window.onload = function () {
+        console.log('onload');
+        if (/micromessenger/i.test(navigator.userAgent)) {
+            $('.overlay').fadeIn();
+        } else {
+            $('.btn-wrapper').fadeIn();
+            setTimeout(function () {
+                $('#link')[0].click();
+            }, 100);
+        }
+    }
+</script>
+</body>
+
+</html>