xiongzhu 3 år sedan
förälder
incheckning
3be2ac30e6

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

@@ -21,7 +21,6 @@ public class EventMgmtService {
 
     private final UserPropertyRepo userPropertyRepo;
     private final UserService      userService;
-    private final EventMgmtService eventMgmtService;
     private final UserRepo         userRepo;
     private final CacheService     cacheService;
 
@@ -46,7 +45,7 @@ public class EventMgmtService {
 
     @Data
     public class VipPointDTO {
-        @ExcelProperty("userId")
+        @ExcelProperty("用户ID")
         private Long userId;
 
         @ExcelProperty("num")

+ 82 - 2
src/main/vue/src/views/Cache.vue

@@ -9,11 +9,19 @@
                 <el-button @click="clean('userMy')">all userMy</el-button>
                 <el-button @click="clean('collection')">all collection</el-button>
                 <el-button @click="clean('recommend')">all recommend</el-button>
+                <el-divider></el-divider>
+                <div>
+                    <el-button @click="clearUserProperty">清除UserProperty</el-button>
+                    <el-button @click="importUserProperty">导入UserProperty</el-button>
+                    <el-button @click="clearVipPoint">清除VipPoint</el-button>
+                    <el-button @click="importVipPoint">导入VipPoint</el-button>
+                </div>
             </div>
         </div>
     </div>
 </template>
 <script>
+import SingleUpload from '../components/SingleUpload.vue';
 export default {
     data() {
         return {
@@ -34,8 +42,80 @@ export default {
                     this.loading = false;
                     this.$message.error(e.error || '失败');
                 });
+        },
+        clearUserProperty() {
+            this.loading = true;
+            this.$http
+                .get('/eventMgmt/clearUserProperty')
+                .then(res => {
+                    this.loading = false;
+                    this.$message.success('成功');
+                })
+                .catch(e => {
+                    this.loading = false;
+                    this.$message.error(e.error || '失败');
+                });
+        },
+        clearVipPoint() {
+            this.loading = true;
+            this.$http
+                .get('/eventMgmt/clearVipPoint')
+                .then(res => {
+                    this.loading = false;
+                    this.$message.success('成功');
+                })
+                .catch(e => {
+                    this.loading = false;
+                    this.$message.error(e.error || '失败');
+                });
+        },
+        importUserProperty() {
+            const i = document.createElement('input');
+            i.type = 'file';
+            i.accept =
+                'application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel';
+            i.onchange = () => {
+                console.log(i.files[0]);
+                const form = new FormData();
+                form.append('file', i.files[0]);
+                this.loading = true;
+                this.$http
+                    .post('/eventMgmt/importUserProperty', form)
+                    .then(res => {
+                        this.loading = false;
+                        this.$message.success('成功');
+                    })
+                    .catch(e => {
+                        this.loading = false;
+                        this.$message.error(e.error || '失败');
+                    });
+            };
+            i.click();
+        },
+        importVipPoint() {
+            const i = document.createElement('input');
+            i.type = 'file';
+            i.accept =
+                'application/vnd.ms-excel, application/vnd.openxmlformats-officedocument.spreadsheetml.sheet, application/vnd.ms-excel';
+            i.onchange = () => {
+                const form = new FormData();
+                form.append('file', i.files[0]);
+                this.loading = true;
+                this.$http
+                    .post('/eventMgmt/importVipPoint', form)
+                    .then(res => {
+                        this.loading = false;
+                        this.$message.success('成功');
+                    })
+                    .catch(e => {
+                        this.loading = false;
+                        this.$message.error(e.error || '失败');
+                    });
+            };
+            i.click();
         }
-    }
+    },
+    components: { SingleUpload }
 };
 </script>
 <style lang="less" scoped>
@@ -47,4 +127,4 @@ export default {
 .el-button {
     margin-bottom: 20px;
 }
-</style>
+</style>