diff --git a/running/pdf/contract.pdf b/running/pdf/contract.pdf index f3cf0193e..f2fa70d9f 100644 Binary files a/running/pdf/contract.pdf and b/running/pdf/contract.pdf differ diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesPlanController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesPlanController.java index 4980da27f..9f5e96e84 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesPlanController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysRecipesPlanController.java @@ -9,6 +9,7 @@ import com.stdiet.common.utils.StringUtils; import com.stdiet.common.utils.poi.ExcelUtil; import com.stdiet.custom.domain.SysRecipesPlan; import com.stdiet.custom.service.ISysRecipesPlanService; +import org.aspectj.weaver.loadtime.Aj; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.web.bind.annotation.*; @@ -101,4 +102,16 @@ public class SysRecipesPlanController extends BaseController { ExcelUtil<SysRecipesPlan> util = new ExcelUtil<SysRecipesPlan>(SysRecipesPlan.class); 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(); + } } \ No newline at end of file diff --git a/stdiet-ui/src/api/custom/recipesPlan.js b/stdiet-ui/src/api/custom/recipesPlan.js index ea79d67dc..e2e2fff28 100644 --- a/stdiet-ui/src/api/custom/recipesPlan.js +++ b/stdiet-ui/src/api/custom/recipesPlan.js @@ -49,3 +49,11 @@ export function listRecipesPlanByCusId(id) { method: "get" }); } + +export function refreshRecipesPlan(cusId){ + return request({ + url: "/recipes/recipesPlan/refreshRecipesPlan", + method: "get", + params: {"cusId": cusId} + }); +} diff --git a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue index c024ae6e4..2836afa41 100644 --- a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue +++ b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue @@ -46,6 +46,14 @@ > 生成7天体验计划 </el-button> + <el-button + size="mini" + type="primary" + v-hasPermi="['recipes:plan:refresh']" + @click="refreshRecipesPlan()" + > + 刷新食谱计划 + </el-button> </section> <section> <el-button @@ -154,6 +162,7 @@ import { listRecipesPlanByCusId, addRecipesPlan, updateRecipesPlan, + refreshRecipesPlan } from "@/api/custom/recipesPlan"; import PlanPauseDrawer from "./PlanPauseDrawer"; import VueQr from "vue-qr"; @@ -188,6 +197,7 @@ export default { return time.getTime() < Date.now() - 24 * 60 * 60 * 1000; }, }, + refreshFlag: false }; }, methods: { @@ -223,6 +233,25 @@ export default { 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() { this.form = { startDate: null,