Просмотр исходного кода

Merge branch 'master' of http://git.izouma.com/xiongzhu/9th

panhui 4 лет назад
Родитель
Сommit
150287255b
24 измененных файлов с 563 добавлено и 66 удалено
  1. 29 0
      src/main/java/com/izouma/nineth/domain/Activity.java
  2. 16 0
      src/main/java/com/izouma/nineth/repo/ActivityRepo.java
  3. 3 0
      src/main/java/com/izouma/nineth/repo/AssetRepo.java
  4. 20 0
      src/main/java/com/izouma/nineth/service/ActivityService.java
  5. 11 11
      src/main/java/com/izouma/nineth/service/GiftOrderService.java
  6. 7 11
      src/main/java/com/izouma/nineth/service/OrderService.java
  7. 21 5
      src/main/java/com/izouma/nineth/service/SysConfigService.java
  8. 60 0
      src/main/java/com/izouma/nineth/web/ActivityController.java
  9. 2 2
      src/main/java/com/izouma/nineth/web/OrderPayController.java
  10. 1 1
      src/main/nine-space/src/views/Discover.vue
  11. 3 3
      src/main/nine-space/src/views/Givesubmit.vue
  12. 10 8
      src/main/nine-space/src/views/Submit.vue
  13. 2 2
      src/main/nine-space/src/views/asset/Detail.vue
  14. 1 0
      src/main/resources/genjson/Activity.json
  15. 3 0
      src/main/resources/templates/AlipayHtml.ftlh
  16. 27 13
      src/main/resources/templates/WxMpTest.ftlh
  17. 2 0
      src/main/vue/src/components/RichText.vue
  18. 16 0
      src/main/vue/src/router.js
  19. 133 0
      src/main/vue/src/views/ActivityEdit.vue
  20. 179 0
      src/main/vue/src/views/ActivityList.vue
  21. 1 1
      src/test/java/com/izouma/nineth/service/AdapayServiceTest.java
  22. 7 2
      src/test/java/com/izouma/nineth/service/AssetServiceTest.java
  23. 1 1
      src/test/java/com/izouma/nineth/service/OrderServiceTest.java
  24. 8 6
      src/test/java/com/izouma/nineth/service/UserServiceTest.java

+ 29 - 0
src/main/java/com/izouma/nineth/domain/Activity.java

@@ -0,0 +1,29 @@
+package com.izouma.nineth.domain;
+
+import com.izouma.nineth.annotations.Searchable;
+import io.swagger.annotations.ApiModel;
+import lombok.AllArgsConstructor;
+import lombok.Builder;
+import lombok.Data;
+import lombok.NoArgsConstructor;
+
+import javax.persistence.Column;
+import javax.persistence.Entity;
+
+@Data
+@Entity
+@AllArgsConstructor
+@NoArgsConstructor
+@Builder
+@ApiModel("系列活动")
+public class Activity extends BaseEntity {
+
+    @Searchable
+    private String name;
+
+    private String cover;
+
+    @Column(columnDefinition = "TEXT")
+    private String detail;
+
+}

+ 16 - 0
src/main/java/com/izouma/nineth/repo/ActivityRepo.java

@@ -0,0 +1,16 @@
+package com.izouma.nineth.repo;
+
+import com.izouma.nineth.domain.Activity;
+import org.springframework.data.jpa.repository.JpaRepository;
+import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
+import org.springframework.data.jpa.repository.Modifying;
+import org.springframework.data.jpa.repository.Query;
+
+import javax.transaction.Transactional;
+
+public interface ActivityRepo extends JpaRepository<Activity, Long>, JpaSpecificationExecutor<Activity> {
+    @Query("update Activity t set t.del = true where t.id = ?1")
+    @Modifying
+    @Transactional
+    void softDelete(Long id);
+}

+ 3 - 0
src/main/java/com/izouma/nineth/repo/AssetRepo.java

@@ -36,4 +36,7 @@ public interface AssetRepo extends JpaRepository<Asset, Long>, JpaSpecificationE
 
     @Query("select a from Asset a join Order o on o.assetId = a.id join Asset aa on aa.orderId = o.id where a.id = ?1")
     Optional<Asset> findChild(Long id);
+
+    @Query("select a from Asset a join User u on a.userId = u.id where a.consignment = true and u.settleAccountId is null")
+    List<Asset> findNoAccount();
 }

+ 20 - 0
src/main/java/com/izouma/nineth/service/ActivityService.java

@@ -0,0 +1,20 @@
+package com.izouma.nineth.service;
+
+import com.izouma.nineth.domain.Activity;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.repo.ActivityRepo;
+import com.izouma.nineth.utils.JpaUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.stereotype.Service;
+
+@Service
+@AllArgsConstructor
+public class ActivityService {
+
+    private ActivityRepo activityRepo;
+
+    public Page<Activity> all(PageQuery pageQuery) {
+        return activityRepo.findAll(JpaUtils.toSpecification(pageQuery, Activity.class), JpaUtils.toPageRequest(pageQuery));
+    }
+}

+ 11 - 11
src/main/java/com/izouma/nineth/service/GiftOrderService.java

@@ -49,17 +49,17 @@ import java.util.Map;
 @AllArgsConstructor
 public class GiftOrderService {
 
-    private AssetRepo          assetRepo;
-    private UserRepo           userRepo;
-    private SysConfigService   sysConfigService;
-    private GiftOrderRepo      giftOrderRepo;
-    private AlipayProperties   alipayProperties;
-    private AlipayClient       alipayClient;
-    private WxPayProperties    wxPayProperties;
-    private WxPayService       wxPayService;
-    private Environment        env;
-    private AssetService       assetService;
-    private AdapayProperties   adapayProperties;
+    private AssetRepo        assetRepo;
+    private UserRepo         userRepo;
+    private SysConfigService sysConfigService;
+    private GiftOrderRepo    giftOrderRepo;
+    private AlipayProperties alipayProperties;
+    private AlipayClient     alipayClient;
+    private WxPayProperties  wxPayProperties;
+    private WxPayService     wxPayService;
+    private Environment      env;
+    private AssetService     assetService;
+    private AdapayProperties adapayProperties;
 
     @Transactional
     public GiftOrder gift(Long userId, Long assetId, Long toUserId) {

+ 7 - 11
src/main/java/com/izouma/nineth/service/OrderService.java

@@ -34,6 +34,7 @@ import lombok.extern.slf4j.Slf4j;
 import org.apache.commons.codec.EncoderException;
 import org.apache.commons.codec.net.URLCodec;
 import org.apache.commons.collections.MapUtils;
+import org.apache.commons.lang3.StringUtils;
 import org.springframework.context.event.EventListener;
 import org.springframework.core.env.Environment;
 import org.springframework.data.domain.Page;
@@ -303,29 +304,24 @@ public class OrderService {
             paymentParams.put("div_members", divMembers);
         }
 
-        if (wxChannels.contains(payChannel)) {
-//            if (StringUtils.isBlank(openId)) {
-//                throw new BusinessException("缺少openId");
-//            }
+        if ("wx_pub".equals(payChannel)) {
+            if (StringUtils.isBlank(openId)) {
+                throw new BusinessException("缺少openId");
+            }
             Map<String, Object> expend = new HashMap<>();
             expend.put("open_id", openId);
             expend.put("limit_pay", "1");
-            if ("wx_lite".equals(payChannel)) {
-                expend.put("wx_app_id", adapayProperties.getWxAppId());
-            }
+            expend.put("wx_app_id", adapayProperties.getWxAppId());
             paymentParams.put("expend", expend);
         }
 
         Map<String, Object> response;
-        if (wxChannels.contains(payChannel)) {
+        if ("wx_lite".equals(payChannel)) {
             paymentParams.put("adapay_func_code", "wxpay.createOrder");
             paymentParams.put("callback_url", generalProperties.getHost() + "/9th/orders");
             response = AdapayCommon.requestAdapayUits(paymentParams);
             log.info("createOrderResponse {}", JSON.toJSONString(response, SerializerFeature.PrettyFormat));
         } else {
-            if (divMembers.size() > 1) {
-                paymentParams.put("div_members", JSON.toJSONString(divMembers));
-            }
             response = Payment.create(paymentParams);
             log.info("createOrderResponse {}", JSON.toJSONString(response, SerializerFeature.PrettyFormat));
             AdapayService.checkSuccess(response);

+ 21 - 5
src/main/java/com/izouma/nineth/service/SysConfigService.java

@@ -10,6 +10,7 @@ import org.springframework.cache.annotation.Cacheable;
 import org.springframework.data.domain.Page;
 import org.springframework.stereotype.Service;
 
+import javax.annotation.PostConstruct;
 import java.math.BigDecimal;
 import java.time.LocalTime;
 import java.time.format.DateTimeFormatter;
@@ -25,11 +26,6 @@ public class SysConfigService {
 
     @Cacheable("SysConfigServiceGetBigDecimal")
     public BigDecimal getBigDecimal(String name) {
-        try {
-            Thread.sleep(3000);
-        } catch (InterruptedException e) {
-            e.printStackTrace();
-        }
         return sysConfigRepo.findByName(name).map(sysConfig -> new BigDecimal(sysConfig.getValue()))
                 .orElse(BigDecimal.ZERO);
     }
@@ -55,4 +51,24 @@ public class SysConfigService {
                 .orElseThrow(new BusinessException("配置不存在"));
         return Integer.parseInt(str);
     }
+
+    @PostConstruct
+    public void init() {
+        if (!sysConfigRepo.findByName("gift_gas_fee").isPresent()) {
+            sysConfigRepo.save(SysConfig.builder()
+                    .name("gift_gas_fee")
+                    .desc("转赠gas费")
+                    .type(SysConfig.ValueType.NUMBER)
+                    .value("1")
+                    .build());
+        }
+        if (!sysConfigRepo.findByName("enable_wx_pub").isPresent()) {
+            sysConfigRepo.save(SysConfig.builder()
+                    .name("enable_wx_pub")
+                    .desc("使用公众号支付")
+                    .type(SysConfig.ValueType.BOOLEAN)
+                    .value("FALSE")
+                    .build());
+        }
+    }
 }

+ 60 - 0
src/main/java/com/izouma/nineth/web/ActivityController.java

@@ -0,0 +1,60 @@
+package com.izouma.nineth.web;
+import com.izouma.nineth.domain.Activity;
+import com.izouma.nineth.service.ActivityService;
+import com.izouma.nineth.dto.PageQuery;
+import com.izouma.nineth.exception.BusinessException;
+import com.izouma.nineth.repo.ActivityRepo;
+import com.izouma.nineth.utils.ObjUtils;
+import com.izouma.nineth.utils.excel.ExcelUtils;
+import lombok.AllArgsConstructor;
+import org.springframework.data.domain.Page;
+import org.springframework.security.access.prepost.PreAuthorize;
+import org.springframework.web.bind.annotation.*;
+
+import javax.servlet.http.HttpServletResponse;
+import java.io.IOException;
+import java.util.List;
+
+@RestController
+@RequestMapping("/activity")
+@AllArgsConstructor
+public class ActivityController extends BaseController {
+    private ActivityService activityService;
+    private ActivityRepo activityRepo;
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/save")
+    public Activity save(@RequestBody Activity record) {
+        if (record.getId() != null) {
+            Activity orig = activityRepo.findById(record.getId()).orElseThrow(new BusinessException("无记录"));
+            ObjUtils.merge(orig, record);
+            return activityRepo.save(orig);
+        }
+        return activityRepo.save(record);
+    }
+
+
+    //@PreAuthorize("hasRole('ADMIN')")
+    @PostMapping("/all")
+    public Page<Activity> all(@RequestBody PageQuery pageQuery) {
+        return activityService.all(pageQuery);
+    }
+
+    @GetMapping("/get/{id}")
+    public Activity get(@PathVariable Long id) {
+        return activityRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+    }
+
+    @PostMapping("/del/{id}")
+    public void del(@PathVariable Long id) {
+        activityRepo.softDelete(id);
+    }
+
+    @GetMapping("/excel")
+    @ResponseBody
+    public void excel(HttpServletResponse response, PageQuery pageQuery) throws IOException {
+        List<Activity> data = all(pageQuery).getContent();
+        ExcelUtils.export(response, data);
+    }
+}
+

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

@@ -66,8 +66,8 @@ public class OrderPayController {
 
     @RequestMapping(value = "/weixin")
     @ResponseBody
-    public Object payOrderWeixin(@RequestParam Long id) throws BaseAdaPayException {
-        return orderService.payAdapay(id, "wx_lite", null);
+    public Object payOrderWeixin(@RequestParam Long id, @RequestParam(defaultValue = "wx_lite") String channel, @RequestParam(required = false) String openId) throws BaseAdaPayException {
+        return orderService.payAdapay(id, channel, openId);
     }
 
     @RequestMapping(value = "/weixin_pc")

+ 1 - 1
src/main/nine-space/src/views/Discover.vue

@@ -101,7 +101,7 @@
         <div class="box">
             <page-title title="更多藏品" :isLink="false"></page-title>
             <van-list
-                style="padding-bottom: 100px;"
+                style="padding-bottom: 100px"
                 class="box-list"
                 v-model:loading="loading"
                 :finished="finished"

+ 3 - 3
src/main/nine-space/src/views/Givesubmit.vue

@@ -60,7 +60,7 @@
 </template>
 
 <script>
-const path = require('path');
+import resolveUrl from 'resolve-url';
 import { add } from 'mathjs';
 import { mapState } from 'vuex';
 import product from '../mixins/product';
@@ -151,7 +151,7 @@ export default {
                             this.$nextTick(() => {
                                 if (this.payType === 'ALIPAY') {
                                     document.location.replace(
-                                        path.resolve(this.$baseUrl, 'payOrder/gift/alipay?id=' + res.id)
+                                        resolveUrl(this.$baseUrl, 'payOrder/gift/alipay?id=' + res.id)
                                     );
                                 } else if (this.payType === 'WEIXIN') {
                                     if (this.inWeixin) {
@@ -185,7 +185,7 @@ export default {
                                             });
                                     } else {
                                         document.location.replace(
-                                            path.resolve(this.$baseUrl, 'payOrder/gift/weixin_h5?id=' + res.id)
+                                            resolveUrl(this.$baseUrl, 'payOrder/gift/weixin_h5?id=' + res.id)
                                         );
                                     }
                                 }

+ 10 - 8
src/main/nine-space/src/views/Submit.vue

@@ -59,10 +59,10 @@
 </template>
 
 <script>
-const path = require('path');
 import product from '../mixins/product';
 import coupon from '../mixins/coupon';
 import { mapState } from 'vuex';
+import resolveUrl from 'resolve-url';
 let inWeixin = /micromessenger/i.test(navigator.userAgent);
 let inApp = /#cordova#/i.test(navigator.userAgent);
 export default {
@@ -72,18 +72,18 @@ export default {
         return {
             info: {},
             message: '',
-            payType: inWeixin ? 'WEIXIN' : 'ALIPAY',
+            payType: inWeixin ? 'ALIPAY' : 'ALIPAY',
             payInfos: [
                 {
                     icon: require('@assets/svgs/zhifubao.svg'),
                     name: '支付宝',
                     type: 'ALIPAY'
                 },
-                {
-                    icon: require('@assets/svgs/wechat.svg'),
-                    name: '微信',
-                    type: 'WEIXIN'
-                }
+                // {
+                //     icon: require('@assets/svgs/wechat.svg'),
+                //     name: '微信',
+                //     type: 'WEIXIN'
+                // }
                 // {
                 //   icon: require("@assets/svgs/png-decp.svg"),
                 //   name: "DCEP",
@@ -212,7 +212,9 @@ export default {
                         this.$nextTick(() => {
                             if (this.payType === 'ALIPAY') {
                                 if (this.inWeixin) {
-                                    window.open(path.resolve(this.$baseUrl, '/payOrder/alipay_wx?id=' + res.id));
+                                    document.location.replace(
+                                        resolveUrl(this.$baseUrl, '/payOrder/alipay_wx?id=' + res.id)
+                                    );
                                 } else {
                                     this.$http
                                         .get(`/payOrder/${this.inApp ? 'alipay_app' : 'alipay_h5'}?id=${res.id}`)

+ 2 - 2
src/main/nine-space/src/views/asset/Detail.vue

@@ -147,7 +147,7 @@
                     <div class="prive" v-if="init.length > 0">
                         <div class="prive1" :class="{ opened: item.opened }" v-for="(item, index) in init" :key="index">
                             <img v-if="!item.opened" class="img" :src="item.icon[0]" alt="" />
-                            <div style="margin-top: 4px;" v-if="item.icon[2]">
+                            <div style="margin-top: 4px" v-if="item.icon[2]">
                                 <img v-if="item.opened" class="img" :src="item.icon[2]" alt="" />
                             </div>
                             <!-- <img class="img" v-else :src="item.icon[0]" alt="" /> -->
@@ -190,7 +190,7 @@
                             <div class="text4">{{ item.createdAt.substr(0, 16) }}</div>
                         </div>
                     </div>
-                    <div v-else style="display: flex; justify-content: center;">暂无购买记录</div>
+                    <div v-else style="display: flex; justify-content: center">暂无购买记录</div>
                 </van-collapse-item>
             </van-collapse>
 

+ 1 - 0
src/main/resources/genjson/Activity.json

@@ -0,0 +1 @@
+{"tableName":"Activity","className":"Activity","remark":"活动","genTable":true,"genClass":true,"genList":true,"genForm":true,"genRouter":true,"javaPath":"/Users/drew/Projects/Java/9th/src/main/java/com/izouma/nineth","viewPath":"/Users/drew/Projects/Java/9th/src/main/vue/src/views","routerPath":"/Users/drew/Projects/Java/9th/src/main/vue/src","resourcesPath":"/Users/drew/Projects/Java/9th/src/main/resources","dataBaseType":"Mysql","fields":[{"name":"name","modelName":"name","remark":"名称","showInList":true,"showInForm":true,"formType":"singleLineText","required":true},{"name":"cover","modelName":"cover","remark":"主图","showInList":true,"showInForm":true,"formType":"singleImage","required":true},{"name":"detail","modelName":"detail","remark":"详情","showInList":true,"showInForm":true,"formType":"singleImage","required":true}],"readTable":false,"dataSourceCode":"dataSource","genJson":"","subtables":[],"update":false,"basePackage":"com.izouma.nineth","tablePackage":"com.izouma.nineth.domain.Activity"}

+ 3 - 0
src/main/resources/templates/AlipayHtml.ftlh

@@ -166,6 +166,9 @@
             $('.overlay').fadeIn();
         } else {
             $('.btn-wrapper').fadeIn();
+            setTimeout(function () {
+                $('#link')[0].click();
+            }, 100);
         }
     }
 </script>

+ 27 - 13
src/main/resources/templates/WxMpTest.ftlh

@@ -85,6 +85,12 @@
                     <input id="totalFee" class="weui-input" placeholder="填写支付金额" value="0.01" type="number">
                 </div>
             </div>
+            <div class="weui-cell weui-cell_active">
+                <div class="weui-cell__hd"><label class="weui-label">自定义参数</label></div>
+                <div class="weui-cell__bd">
+                    <textarea id="payParams" class="weui-textarea" placeholder="自定义参数" rows="3"></textarea>
+                </div>
+            </div>
             <div class="weui-cell">
                 <button onclick="pay()" class="weui-btn weui-btn_primary">立即支付</button>
             </div>
@@ -191,23 +197,31 @@
     });
 
     function pay() {
-        $.get('/wx/testPay', {
-            openId: $('#openId').html(),
-            totalFee: $('#totalFee').val() * 100
-        }, function (res) {
-            var config = {
-                appId: res.appId,
-                timestamp: res.timeStamp,
-                nonceStr: res.nonceStr,
-                package: res.packageValue,
-                signType: res.signType,
-                paySign: res.paySign
-            };
+        if ($('#payParams').val()) {
+            var config = JSON.parse($('#payParams').val());
             config.success = function () {
                 showSuccess('支付成功');
             };
             wx.chooseWXPay(config);
-        });
+        } else {
+            $.get('/wx/testPay', {
+                openId: $('#openId').html(),
+                totalFee: $('#totalFee').val() * 100
+            }, function (res) {
+                var config = {
+                    appId: res.appId,
+                    timestamp: res.timeStamp,
+                    nonceStr: res.nonceStr,
+                    package: res.packageValue,
+                    signType: res.signType,
+                    paySign: res.paySign
+                };
+                config.success = function () {
+                    showSuccess('支付成功');
+                };
+                wx.chooseWXPay(config);
+            });
+        }
     }
 
     function setupShare() {

+ 2 - 0
src/main/vue/src/components/RichText.vue

@@ -29,6 +29,7 @@ import 'tinymce/plugins/code';
 import 'tinymce/plugins/help';
 import 'tinymce/plugins/imagetools';
 import 'tinymce/skins/ui/oxide/skin.css';
+import 'tinymce/skins/ui/oxide-dark/skin.css';
 import 'tinymce/icons/default/index';
 
 export default {
@@ -38,6 +39,7 @@ export default {
         return {
             init: {
                 language: 'zh_CN',
+                theme: 'silver',
                 skin: 'oxide-dark',
                 menubar: false,
                 branding: false,

+ 16 - 0
src/main/vue/src/router.js

@@ -380,6 +380,22 @@ const router = new Router({
                     meta: {
                        title: '首页推荐',
                     },
+               },
+                {
+                    path: '/activityEdit',
+                    name: 'ActivityEdit',
+                    component: () => import(/* webpackChunkName: "activityEdit" */ '@/views/ActivityEdit.vue'),
+                    meta: {
+                       title: '活动编辑',
+                    },
+                },
+                {
+                    path: '/activityList',
+                    name: 'ActivityList',
+                    component: () => import(/* webpackChunkName: "activityList" */ '@/views/ActivityList.vue'),
+                    meta: {
+                       title: '活动',
+                    },
                }
                 /**INSERT_LOCATION**/
             ]

+ 133 - 0
src/main/vue/src/views/ActivityEdit.vue

@@ -0,0 +1,133 @@
+<template>
+    <div class="edit-view">
+        <page-title>
+            <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+            <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id"> 删除 </el-button>
+            <el-button @click="onSave" :loading="saving" type="primary">保存</el-button>
+        </page-title>
+        <div class="edit-view__content-wrapper">
+            <div class="edit-view__content-section">
+                <el-form
+                    :model="formData"
+                    :rules="rules"
+                    ref="form"
+                    label-width="52px"
+                    label-position="right"
+                    size="small"
+                    style="max-width: 500px"
+                >
+                    <el-form-item prop="name" label="名称">
+                        <el-input v-model="formData.name"></el-input>
+                    </el-form-item>
+                    <el-form-item prop="cover" label="主图">
+                        <object-upload v-model="formData.cover" compress></object-upload>
+                    </el-form-item>
+                    <el-form-item prop="detail" label="详情">
+                        <rich-text v-model="formData.detail"></rich-text>
+                    </el-form-item>
+                    <el-form-item class="form-submit">
+                        <el-button @click="onSave" :loading="saving" type="primary"> 保存 </el-button>
+                        <el-button @click="onDelete" :disabled="saving" type="danger" v-if="formData.id">
+                            删除
+                        </el-button>
+                        <el-button @click="$router.go(-1)" :disabled="saving">取消</el-button>
+                    </el-form-item>
+                </el-form>
+            </div>
+        </div>
+    </div>
+</template>
+<script>
+import RichText from '../components/RichText.vue';
+export default {
+    components: { RichText },
+    name: 'ActivityEdit',
+    created() {
+        if (this.$route.query.id) {
+            this.$http
+                .get('activity/get/' + this.$route.query.id)
+                .then(res => {
+                    this.formData = res;
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.$message.error(e.error);
+                });
+        }
+    },
+    data() {
+        return {
+            saving: false,
+            formData: {},
+            rules: {
+                name: [
+                    {
+                        required: true,
+                        message: '请输入名称',
+                        trigger: 'blur'
+                    }
+                ],
+                cover: [
+                    {
+                        required: true,
+                        message: '请输入主图',
+                        trigger: 'blur'
+                    }
+                ],
+                detail: [
+                    {
+                        required: true,
+                        message: '请输入详情',
+                        trigger: 'blur'
+                    }
+                ]
+            }
+        };
+    },
+    methods: {
+        onSave() {
+            this.$refs.form.validate(valid => {
+                if (valid) {
+                    this.submit();
+                } else {
+                    return false;
+                }
+            });
+        },
+        submit() {
+            let data = { ...this.formData };
+
+            this.saving = true;
+            this.$http
+                .post('/activity/save', data, { body: 'json' })
+                .then(res => {
+                    this.saving = false;
+                    this.$message.success('成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    console.log(e);
+                    this.saving = false;
+                    this.$message.error(e.error);
+                });
+        },
+        onDelete() {
+            this.$confirm('删除将无法恢复,确认要删除么?', '警告', { type: 'error' })
+                .then(() => {
+                    return this.$http.post(`/activity/del/${this.formData.id}`);
+                })
+                .then(() => {
+                    this.$message.success('删除成功');
+                    this.$router.go(-1);
+                })
+                .catch(e => {
+                    if (e !== 'cancel') {
+                        console.log(e);
+                        this.$message.error((e || {}).error || '删除失败');
+                    }
+                });
+        }
+    }
+};
+</script>
+<style lang="less" scoped></style>

+ 179 - 0
src/main/vue/src/views/ActivityList.vue

@@ -0,0 +1,179 @@
+<template>
+    <div  class="list-view">
+        <page-title>
+            <el-button @click="addRow" type="primary" icon="el-icon-plus" :disabled="fetchingData || downloading" class="filter-item">
+                新增
+            </el-button>
+            <el-button @click="download" icon="el-icon-upload2" :loading="downloading" :disabled="fetchingData" class="filter-item">
+                导出
+            </el-button>
+        </page-title>
+        <div class="filters-container">
+            <el-input
+                    placeholder="搜索..."
+                    v-model="search"
+                    clearable
+                    class="filter-item search"
+                    @keyup.enter.native="getData"
+            >
+                <el-button @click="getData" slot="append" icon="el-icon-search"> </el-button>
+            </el-input>
+        </div>
+        <el-table :data="tableData" row-key="id" ref="table"
+                  header-row-class-name="table-header-row"
+                  header-cell-class-name="table-header-cell"
+                  row-class-name="table-row" cell-class-name="table-cell"
+                  :height="tableHeight" v-loading="fetchingData">
+            <el-table-column v-if="multipleMode" align="center" type="selection"
+                             width="50">
+            </el-table-column>
+            <el-table-column prop="id" label="ID" width="100">
+            </el-table-column>
+                                <el-table-column prop="name" label="名称"
+>
+                    </el-table-column>
+                    <el-table-column prop="cover" label="主图"
+>
+                            <template slot-scope="{row}">
+                                <el-image style="width: 30px; height: 30px"
+                                          :src="row.cover" fit="cover"
+                                          :preview-src-list="[row.cover]"></el-image>
+                            </template>
+                    </el-table-column>
+                    <el-table-column prop="detail" label="详情"
+>
+                            <template slot-scope="{row}">
+                                <el-image style="width: 30px; height: 30px"
+                                          :src="row.detail" fit="cover"
+                                          :preview-src-list="[row.detail]"></el-image>
+                            </template>
+                    </el-table-column>
+            <el-table-column
+                    label="操作"
+                    align="center"
+                    fixed="right"
+                    width="150">
+                <template slot-scope="{row}">
+                    <el-button @click="editRow(row)" type="primary" size="mini" plain>编辑</el-button>
+                    <el-button @click="deleteRow(row)" type="danger" size="mini" plain>删除</el-button>
+                </template>
+            </el-table-column>
+        </el-table>
+        <div class="pagination-wrapper">
+            <!-- <div class="multiple-mode-wrapper">
+                <el-button v-if="!multipleMode" @click="toggleMultipleMode(true)">批量编辑</el-button>
+                <el-button-group v-else>
+                    <el-button @click="operation1">批量操作1</el-button>
+                    <el-button @click="operation2">批量操作2</el-button>
+                    <el-button @click="toggleMultipleMode(false)">取消</el-button>
+                </el-button-group>
+            </div> -->
+            <el-pagination background @size-change="onSizeChange"
+                           @current-change="onCurrentChange" :current-page="page"
+                           :page-sizes="[10, 20, 30, 40, 50]" :page-size="pageSize"
+                           layout="total, sizes, prev, pager, next, jumper"
+                           :total="totalElements">
+            </el-pagination>
+        </div>
+
+    </div>
+</template>
+<script>
+    import { mapState } from "vuex";
+    import pageableTable from "@/mixins/pageableTable";
+
+    export default {
+        name: 'ActivityList',
+        mixins: [pageableTable],
+        data() {
+            return {
+                multipleMode: false,
+                search: "",
+                url: "/activity/all",
+                downloading: false,
+            }
+        },
+        computed: {
+            selection() {
+                return this.$refs.table.selection.map(i => i.id);
+            }
+        },
+        methods: {
+            beforeGetData() {
+                return { search: this.search, query: { del: false } };
+            },
+            toggleMultipleMode(multipleMode) {
+                this.multipleMode = multipleMode;
+                if (!multipleMode) {
+                    this.$refs.table.clearSelection();
+                }
+            },
+            addRow() {
+                this.$router.push({
+                    path: "/activityEdit",
+                    query: {
+                        ...this.$route.query
+                    }
+                });
+            },
+            editRow(row) {
+                this.$router.push({
+                    path: "/activityEdit",
+                    query: {
+                    id: row.id
+                    }
+                });
+            },
+            download() {
+                this.downloading = true;
+                this.$axios
+                    .get("/activity/excel", { 
+                        responseType: "blob",
+                        params: { size: 10000 }
+                    })
+                    .then(res => {
+                        console.log(res);
+                        this.downloading = false;
+                        const downloadUrl = window.URL.createObjectURL(new Blob([res.data]));
+                        const link = document.createElement("a");
+                        link.href = downloadUrl;
+                        link.setAttribute(
+                            "download",
+                            res.headers["content-disposition"].split("filename=")[1]
+                        );
+                        document.body.appendChild(link);
+                        link.click();
+                        link.remove();
+                    })
+                    .catch(e => {
+                        console.log(e);
+                        this.downloading = false;
+                        this.$message.error(e.error);
+                    });
+            },
+            operation1() {
+                this.$notify({
+                    title: '提示',
+                    message: this.selection
+                });
+            },
+            operation2() {
+                this.$message('操作2');
+            },
+            deleteRow(row) {
+                this.$alert('删除将无法恢复,确认要删除么?', '警告', {type: 'error'}).then(() => {
+                    return this.$http.post(`/activity/del/${row.id}`)
+                }).then(() => {
+                    this.$message.success('删除成功');
+                    this.getData();
+                }).catch(e => {
+                    if (e !== 'cancel') {
+                        this.$message.error(e.error);
+                    }
+                })
+            },
+        }
+    }
+</script>
+<style lang="less" scoped>
+</style>

+ 1 - 1
src/test/java/com/izouma/nineth/service/AdapayServiceTest.java

@@ -38,7 +38,7 @@ public class AdapayServiceTest extends ApplicationTests {
 
         paymentParams.put("app_id", "app_f8760acc-f4d8-46f6-8f70-d80e36517075");
         paymentParams.put("order_no", "jsdk_payment" + System.currentTimeMillis());
-        paymentParams.put("pay_channel", "alipay_wap");
+        paymentParams.put("pay_channel", "wx_pub");
         paymentParams.put("pay_amt", "0.10");
         paymentParams.put("goods_title", "your goods title");
         paymentParams.put("goods_desc", "your goods desc");

+ 7 - 2
src/test/java/com/izouma/nineth/service/AssetServiceTest.java

@@ -66,8 +66,13 @@ class AssetServiceTest extends ApplicationTests {
 
     @Test
     public void cancelCon() {
-        for (Asset asset : assetRepo.findByConsignmentTrue()) {
-            assetService.cancelConsignment(asset.getId());
+        for (Asset asset : assetRepo.findNoAccount()) {
+            try {
+                assetService.cancelConsignment(asset.getId());
+            } catch (Exception e) {
+
+            }
         }
     }
+
 }

+ 1 - 1
src/test/java/com/izouma/nineth/service/OrderServiceTest.java

@@ -73,7 +73,7 @@ public class OrderServiceTest extends ApplicationTests {
 
     @Test
     public void cancel() {
-        orderService.cancel(9892L);
+        orderService.cancel(6721L);
     }
 
     @Test

+ 8 - 6
src/test/java/com/izouma/nineth/service/UserServiceTest.java

@@ -54,12 +54,14 @@ public class UserServiceTest extends ApplicationTests {
 
     @Test
     public void a() {
-        for (String s : ("13258143311\n" +
-                "18973159455\n" +
-                "15102854289\n" +
-                "18678772168\n" +
-                "13739463642\n" +
-                "13608236388\n")
+        for (String s : ("13816681152\n" +
+                "15564456867\n" +
+                "13363659367\n" +
+                "18963550881\n" +
+                "13931604318\n" +
+                "13705395943\n" +
+                "13162078752\n" +
+                "13589360751\n")
                 .split("\n")) {
             String name = "9th_" + RandomStringUtils.randomAlphabetic(8);
             User user = userService.create(UserRegister.builder()