刷新食谱计划
This commit is contained in:
		@@ -9,6 +9,7 @@ import com.stdiet.common.utils.StringUtils;
 | 
				
			|||||||
import com.stdiet.common.utils.poi.ExcelUtil;
 | 
					import com.stdiet.common.utils.poi.ExcelUtil;
 | 
				
			||||||
import com.stdiet.custom.domain.SysRecipesPlan;
 | 
					import com.stdiet.custom.domain.SysRecipesPlan;
 | 
				
			||||||
import com.stdiet.custom.service.ISysRecipesPlanService;
 | 
					import com.stdiet.custom.service.ISysRecipesPlanService;
 | 
				
			||||||
 | 
					import org.aspectj.weaver.loadtime.Aj;
 | 
				
			||||||
import org.springframework.beans.factory.annotation.Autowired;
 | 
					import org.springframework.beans.factory.annotation.Autowired;
 | 
				
			||||||
import org.springframework.security.access.prepost.PreAuthorize;
 | 
					import org.springframework.security.access.prepost.PreAuthorize;
 | 
				
			||||||
import org.springframework.web.bind.annotation.*;
 | 
					import org.springframework.web.bind.annotation.*;
 | 
				
			||||||
@@ -101,4 +102,16 @@ public class SysRecipesPlanController extends BaseController {
 | 
				
			|||||||
        ExcelUtil<SysRecipesPlan> util = new ExcelUtil<SysRecipesPlan>(SysRecipesPlan.class);
 | 
					        ExcelUtil<SysRecipesPlan> util = new ExcelUtil<SysRecipesPlan>(SysRecipesPlan.class);
 | 
				
			||||||
        return util.exportExcel(list, "recipesPlan");
 | 
					        return util.exportExcel(list, "recipesPlan");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    /**
 | 
				
			||||||
 | 
					     * 刷新食谱计划
 | 
				
			||||||
 | 
					     * @param cusId
 | 
				
			||||||
 | 
					     * @return
 | 
				
			||||||
 | 
					     */
 | 
				
			||||||
 | 
					    @PreAuthorize("@ss.hasPermi('recipes:plan:refresh')")
 | 
				
			||||||
 | 
					    @GetMapping("/refreshRecipesPlan")
 | 
				
			||||||
 | 
					    public AjaxResult refreshRecipesPlan(@RequestParam("cusId")Long cusId) {
 | 
				
			||||||
 | 
					        sysRecipesPlanService.regenerateRecipesPlan(cusId);
 | 
				
			||||||
 | 
					        return AjaxResult.success();
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@@ -49,3 +49,11 @@ export function listRecipesPlanByCusId(id) {
 | 
				
			|||||||
    method: "get"
 | 
					    method: "get"
 | 
				
			||||||
  });
 | 
					  });
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					export function refreshRecipesPlan(cusId){
 | 
				
			||||||
 | 
					  return request({
 | 
				
			||||||
 | 
					    url: "/recipes/recipesPlan/refreshRecipesPlan",
 | 
				
			||||||
 | 
					    method: "get",
 | 
				
			||||||
 | 
					    params: {"cusId": cusId}
 | 
				
			||||||
 | 
					  });
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 
 | 
				
			|||||||
@@ -46,6 +46,14 @@
 | 
				
			|||||||
          >
 | 
					          >
 | 
				
			||||||
            生成7天体验计划
 | 
					            生成7天体验计划
 | 
				
			||||||
          </el-button>
 | 
					          </el-button>
 | 
				
			||||||
 | 
					          <el-button
 | 
				
			||||||
 | 
					            size="mini"
 | 
				
			||||||
 | 
					            type="primary"
 | 
				
			||||||
 | 
					            v-hasPermi="['recipes:plan:refresh']"
 | 
				
			||||||
 | 
					            @click="refreshRecipesPlan()"
 | 
				
			||||||
 | 
					          >
 | 
				
			||||||
 | 
					            刷新食谱计划
 | 
				
			||||||
 | 
					          </el-button>
 | 
				
			||||||
        </section>
 | 
					        </section>
 | 
				
			||||||
        <section>
 | 
					        <section>
 | 
				
			||||||
          <el-button
 | 
					          <el-button
 | 
				
			||||||
@@ -154,6 +162,7 @@ import {
 | 
				
			|||||||
  listRecipesPlanByCusId,
 | 
					  listRecipesPlanByCusId,
 | 
				
			||||||
  addRecipesPlan,
 | 
					  addRecipesPlan,
 | 
				
			||||||
  updateRecipesPlan,
 | 
					  updateRecipesPlan,
 | 
				
			||||||
 | 
					  refreshRecipesPlan
 | 
				
			||||||
} from "@/api/custom/recipesPlan";
 | 
					} from "@/api/custom/recipesPlan";
 | 
				
			||||||
import PlanPauseDrawer from "./PlanPauseDrawer";
 | 
					import PlanPauseDrawer from "./PlanPauseDrawer";
 | 
				
			||||||
import VueQr from "vue-qr";
 | 
					import VueQr from "vue-qr";
 | 
				
			||||||
@@ -188,6 +197,7 @@ export default {
 | 
				
			|||||||
          return time.getTime() < Date.now() - 24 * 60 * 60 * 1000;
 | 
					          return time.getTime() < Date.now() - 24 * 60 * 60 * 1000;
 | 
				
			||||||
        },
 | 
					        },
 | 
				
			||||||
      },
 | 
					      },
 | 
				
			||||||
 | 
					      refreshFlag: false
 | 
				
			||||||
    };
 | 
					    };
 | 
				
			||||||
  },
 | 
					  },
 | 
				
			||||||
  methods: {
 | 
					  methods: {
 | 
				
			||||||
@@ -223,6 +233,25 @@ export default {
 | 
				
			|||||||
        this.planLoading = false;
 | 
					        this.planLoading = false;
 | 
				
			||||||
      });
 | 
					      });
 | 
				
			||||||
    },
 | 
					    },
 | 
				
			||||||
 | 
					    refreshRecipesPlan(){
 | 
				
			||||||
 | 
					      if(this.refreshFlag){
 | 
				
			||||||
 | 
					            //请勿重复刷新
 | 
				
			||||||
 | 
					           this.$message.error("请勿重复刷新,十秒后重试");
 | 
				
			||||||
 | 
					           return;
 | 
				
			||||||
 | 
					      }else{
 | 
				
			||||||
 | 
					        this.refreshFlag = true;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					      refreshRecipesPlan(this.data.id).then((response) => {
 | 
				
			||||||
 | 
					          //十秒之后刷新页面
 | 
				
			||||||
 | 
					          this.$message.success("正在刷新,大概需要十秒");
 | 
				
			||||||
 | 
					      });
 | 
				
			||||||
 | 
					      var self = this;
 | 
				
			||||||
 | 
					      let t = setTimeout(function(){
 | 
				
			||||||
 | 
					          self.getList();
 | 
				
			||||||
 | 
					           self.$message.success("食谱计划刷新成功");
 | 
				
			||||||
 | 
					          self.refreshFlag = false;
 | 
				
			||||||
 | 
					      }, 10000);
 | 
				
			||||||
 | 
					    },
 | 
				
			||||||
    reset() {
 | 
					    reset() {
 | 
				
			||||||
      this.form = {
 | 
					      this.form = {
 | 
				
			||||||
        startDate: null,
 | 
					        startDate: null,
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user