diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java index aa4f90018..38ff8e102 100644 --- a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysCustomerCaseController.java @@ -141,36 +141,37 @@ public class SysCustomerCaseController extends BaseController return getDataTable(list); } - /** - * 上传文件到OSS返回URL - */ - @PostMapping("/uploadCaseFile") - @PreAuthorize("@ss.hasPermi('custom:customerCase:list')") - public AjaxResult uploadCseFile(MultipartFile file) throws Exception { - try { - if(file == null){ - return AjaxResult.error("文件不存在"); - } - int fileNameLength = file.getOriginalFilename().length(); - if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) - { - throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); - } - FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); - - String fileUrl = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix, DateUtils.getDate()+"/"+file.getOriginalFilename(), file); - - AjaxResult ajax = null; - if(StringUtils.isNotEmpty(fileUrl)){ - ajax = AjaxResult.success(); - ajax.put("fileUrl", fileUrl); - ajax.put("fileName", file.getOriginalFilename()); - }else{ - ajax = AjaxResult.error("文件上传失败"); - } - return ajax; - } catch (Exception e) { - return AjaxResult.error("文件上传失败"); - } - } +// 转移到SysFileUploadController.java +// /** +// * 上传文件到OSS返回URL +// */ +// @PostMapping("/uploadCaseFile") +// @PreAuthorize("@ss.hasPermi('custom:customerCase:list')") +// public AjaxResult uploadCseFile(MultipartFile file) throws Exception { +// try { +// if(file == null){ +// return AjaxResult.error("文件不存在"); +// } +// int fileNameLength = file.getOriginalFilename().length(); +// if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) +// { +// throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); +// } +// FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); +// +// String fileUrl = AliyunOSSUtils.uploadFileInputSteam(AliyunOSSConfig.casePrefix, DateUtils.getDate()+"/"+file.getOriginalFilename(), file); +// +// AjaxResult ajax = null; +// if(StringUtils.isNotEmpty(fileUrl)){ +// ajax = AjaxResult.success(); +// ajax.put("fileUrl", fileUrl); +// ajax.put("fileName", file.getOriginalFilename()); +// }else{ +// ajax = AjaxResult.error("文件上传失败"); +// } +// return ajax; +// } catch (Exception e) { +// return AjaxResult.error("文件上传失败"); +// } +// } } \ No newline at end of file diff --git a/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFileUploadController.java b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFileUploadController.java new file mode 100644 index 000000000..2745957c1 --- /dev/null +++ b/stdiet-admin/src/main/java/com/stdiet/web/controller/custom/SysFileUploadController.java @@ -0,0 +1,54 @@ +package com.stdiet.web.controller.custom; + +import com.stdiet.common.core.controller.BaseController; +import com.stdiet.common.core.domain.AjaxResult; +import com.stdiet.common.exception.file.FileNameLengthLimitExceededException; +import com.stdiet.common.utils.DateUtils; +import com.stdiet.common.utils.StringUtils; +import com.stdiet.common.utils.file.FileUploadUtils; +import com.stdiet.common.utils.file.MimeTypeUtils; +import com.stdiet.common.utils.oss.AliyunOSSUtils; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.web.bind.annotation.PathVariable; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +@RestController +@RequestMapping("/custom/fileUpload") +public class SysFileUploadController extends BaseController { + + /** + * 上传文件到OSS返回URL + */ + @PostMapping(value = "/{prefix}") + @PreAuthorize("@ss.hasPermi('custom:file:upload')") + public AjaxResult uploadCseFile(MultipartFile file, @PathVariable String prefix) throws Exception { + + try { + if (file == null) { + return AjaxResult.error("文件不存在"); + } + int fileNameLength = file.getOriginalFilename().length(); + if (fileNameLength > FileUploadUtils.DEFAULT_FILE_NAME_LENGTH) { + throw new FileNameLengthLimitExceededException(FileUploadUtils.DEFAULT_FILE_NAME_LENGTH); + } + FileUploadUtils.assertAllowed(file, MimeTypeUtils.DEFAULT_ALLOWED_EXTENSION); + + String fileUrl = AliyunOSSUtils.uploadFileInputSteam(prefix + '/', DateUtils.getDate() + "/" + file.getOriginalFilename(), file); + + AjaxResult ajax = null; + if (StringUtils.isNotEmpty(fileUrl)) { + ajax = AjaxResult.success(); + ajax.put("fileUrl", fileUrl); + ajax.put("fileName", file.getOriginalFilename()); + } else { + ajax = AjaxResult.error("文件上传失败"); + } + return ajax; + } catch (Exception e) { + return AjaxResult.error("文件上传失败"); + } + } +} diff --git a/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java b/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java index 0f2199d0d..0b77da830 100644 --- a/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java +++ b/stdiet-common/src/main/java/com/stdiet/common/utils/oss/AliyunOSSUtils.java @@ -248,7 +248,7 @@ public class AliyunOSSUtils { /** * - * @param fileUrl + * @param fileUrlList * @return */ public static List generatePresignedUrl(List fileUrlList){ diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredentFile.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredentFile.java new file mode 100644 index 000000000..ceab8eccd --- /dev/null +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredentFile.java @@ -0,0 +1,27 @@ +package com.stdiet.custom.domain; + +import lombok.Data; + +import java.util.Date; + +@Data +public class SysIngredentFile { + + Long id; + + Long igdId; + + String fileUrl; + + String fileName; + + Integer delFlag; + + Long createBy; + + Date createTime; + + Long updateBy; + + Date updateTime; +} diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredient.java b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredient.java index c5cd66719..4f52f9902 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredient.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/domain/SysIngredient.java @@ -15,8 +15,6 @@ import java.util.Date; */ @Data public class SysIngredient { - private static final long serialVersionUID = 1L; - /** * id */ @@ -107,4 +105,9 @@ public class SysIngredient { private Long[] notRecIds; + /** + * 食材信息 + */ + private String info; + } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java index d1e8b9d9f..8ac25d4aa 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/mapper/SysIngredientMapper.java @@ -1,6 +1,8 @@ package com.stdiet.custom.mapper; import java.util.List; + +import com.stdiet.custom.domain.SysIngredentFile; import com.stdiet.custom.domain.SysIngredient; import com.stdiet.custom.domain.SysIngredientNotRec; import com.stdiet.custom.domain.SysIngredientRec; @@ -80,4 +82,6 @@ public interface SysIngredientMapper * @return */ public SysIngredient selectSysIngredientByName(@Param("name") String name); + + int batchInsertIngredientImage(List ingredentFiles); } \ No newline at end of file diff --git a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java index 2814d59bd..c37cf6f08 100644 --- a/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java +++ b/stdiet-custom/src/main/java/com/stdiet/custom/service/impl/SysIngredientServiceImpl.java @@ -60,6 +60,9 @@ public class SysIngredientServiceImpl implements ISysIngredientService { insertRecommand(sysIngredient); // insertNotRecommand(sysIngredient); + // + + return rows; } diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml index 9bf06d611..4e4c7bab9 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysCustomerMapper.xml @@ -37,6 +37,7 @@ where del_flag = 0 and name like concat('%', #{name}, '%') and phone like concat('%', #{phone}, '%') + and fans_channel = #{fansChannel} order by create_time desc diff --git a/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml b/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml index 68e4ab886..122e4bf06 100644 --- a/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml +++ b/stdiet-custom/src/main/resources/mapper/custom/SysIngredientMapper.xml @@ -5,21 +5,23 @@ - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + @@ -43,44 +45,44 @@ SELECT * FROM sys_ingredient igd RIGHT JOIN( - SELECT * FROM( - SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_rec - - - physical_signs_id in - - #{item} - - - - ) recId - LEFT JOIN ( - SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM( - SELECT physical_signs_id as id, ingredient_id - FROM sys_ingredient_rec - ) rec JOIN sys_physical_signs phy USING(id) - GROUP BY id - ) recM USING(id) - INNER JOIN ( - SELECT * FROM( - SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_not_rec - - - physical_signs_id in - - #{item} - - - - ) notRecId - LEFT JOIN ( - SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM( - SELECT physical_signs_id as id, ingredient_id - FROM sys_ingredient_not_rec - ) notRec JOIN sys_physical_signs phy USING(id) - GROUP BY id - ) notRecM USING(id) - ) notRecT USING(id) + SELECT * FROM( + SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_rec + + + physical_signs_id in + + #{item} + + + + ) recId + LEFT JOIN ( + SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') rec FROM( + SELECT physical_signs_id as id, ingredient_id + FROM sys_ingredient_rec + ) rec JOIN sys_physical_signs phy USING(id) + GROUP BY id + ) recM USING(id) + INNER JOIN ( + SELECT * FROM( + SELECT DISTINCT(ingredient_id) as id FROM sys_ingredient_not_rec + + + physical_signs_id in + + #{item} + + + + ) notRecId + LEFT JOIN ( + SELECT ingredient_id as id, GROUP_CONCAT(name SEPARATOR ',') not_rec FROM( + SELECT physical_signs_id as id, ingredient_id + FROM sys_ingredient_not_rec + ) notRec JOIN sys_physical_signs phy USING(id) + GROUP BY id + ) notRecM USING(id) + ) notRecT USING(id) ) recT USING(id) @@ -97,10 +99,10 @@ - and name like concat('%', #{name}, '%') - and type = #{type} - and area = #{area} - and review_status = #{reviewStatus} + and name like concat('%', #{name}, '%') + and type = #{type} + and area = #{area} + and review_status = #{reviewStatus} @@ -141,14 +143,14 @@ - + insert into sys_ingredient_rec(ingredient_id, physical_signs_id) values (#{item.ingredientId},#{item.recommandId}) - + insert into sys_ingredient_not_rec(ingredient_id, physical_signs_id) values (#{item.ingredientId},#{item.notRecommandId}) @@ -213,4 +215,28 @@ where name = #{name} limit 1 + + + insert into sys_ingredient_file(igd_id, file_url, file_name, create_by, create_time, update_by, update_time ) + values + + (#{item.ingredientId},#{item.fileUrl},#{item.fileName},#{item.createBy},#{item.createTime},#{item.updateBy},#{item.updateTime}) + + + + + + + + + + + + + + + update sys_ingredent_file set del_flag=1 where id=#{id} + \ No newline at end of file diff --git a/stdiet-ui/src/components/ContractDrawer/index.vue b/stdiet-ui/src/components/ContractDrawer/index.vue index 60dcc8ea8..7be5b4902 100644 --- a/stdiet-ui/src/components/ContractDrawer/index.vue +++ b/stdiet-ui/src/components/ContractDrawer/index.vue @@ -70,7 +70,7 @@ >复制 - + - - + +
将文件拖到此处,或点击上传
-
最多可上传{{upload.limit}}个文件,且每个文件不超过{{upload.fileSize/(1024*1024)}}M
+
+ 最多可上传{{ upload.limit }}个文件,且每个文件不超过{{ + upload.fileSize / (1024 * 1024) + }}M +
diff --git a/stdiet-ui/src/components/FileUpload/DragUploadEdit.vue b/stdiet-ui/src/components/FileUpload/DragUploadEdit.vue index 14da04c39..ed00da5b0 100644 --- a/stdiet-ui/src/components/FileUpload/DragUploadEdit.vue +++ b/stdiet-ui/src/components/FileUpload/DragUploadEdit.vue @@ -1,41 +1,58 @@ diff --git a/stdiet-ui/src/components/HeatStatisticsDrawer/index.vue b/stdiet-ui/src/components/HeatStatisticsDrawer/index.vue index c8af6d54f..05416382c 100644 --- a/stdiet-ui/src/components/HeatStatisticsDrawer/index.vue +++ b/stdiet-ui/src/components/HeatStatisticsDrawer/index.vue @@ -25,7 +25,7 @@ trigger="click" style="margin: 0 12px" > - + - +
{ + const tarData = healthyData.moistureDateArray.find( + (obj) => obj.value === cur + ); + if (tarData) { + arr.push(tarData.name); + } + return arr; + }, []); + detailHealthy.bloodData = detailHealthy.bloodData + .split(",") + .reduce((arr, cur) => { + const tarData = healthyData.bloodDataArray.find( + (obj) => obj.value === cur + ); + if (tarData) { + arr.push(tarData.name); + } + return arr; + }, []); this.detailHealthy = detailHealthy; for (let i = 0; i < this.healthyTitleData.length; i++) { let stepArray = []; diff --git a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue index 664a1d27c..b8547591e 100644 --- a/stdiet-ui/src/components/RecipesPlanDrawer/index.vue +++ b/stdiet-ui/src/components/RecipesPlanDrawer/index.vue @@ -25,7 +25,7 @@ v-if="cusOutId" style="margin: 0 12px" > - + igd.id !== payload.igdId @@ -103,6 +106,9 @@ const mutations = { toggleLeftShow(state, payload) { state.leftShow = !state.leftShow; }, + setNotRecIgds(state, payload) { + state.notRecIgds = payload.data; + }, setDate(state, payload) { state.startDate = payload.startDate; state.endDate = payload.endDate; @@ -152,6 +158,9 @@ const actions = { getDicts("dish_class_small").then(response => { commit("updateStateData", { dishSmallClassOptions: response.data }); }); + getDicts("cus_ing_type").then(response => { + commit("updateStateData", { igdTypeOptions: response.data }); + }); return new Promise((res, rej) => { // 健康数据 @@ -559,6 +568,19 @@ const getters = { }); return arr; }, []), + igdTypeDetial: state => + state.recipesData.reduce((obj, cur) => { + cur.dishes.forEach(dObj => { + dObj.igdList.forEach(iObj => { + if (!obj[iObj.type]) { + obj[iObj.type] = [{ name: iObj.name, id: iObj.id }]; + } else if (!obj[iObj.type].some(tObj => tObj.id === iObj.id)) { + obj[iObj.type].push({ name: iObj.name, id: iObj.id }); + } + }); + }); + return obj; + }, {}), cusUnitDict: state => state.cusUnitOptions.reduce((obj, cur) => { obj[cur.dictValue] = cur.dictLabel; @@ -583,6 +605,11 @@ const getters = { state.dishSmallClassOptions.reduce((obj, cur) => { obj[cur.dictValue] = cur.dictLabel; return obj; + }, {}), + igdTypeDict: state => + state.igdTypeOptions.reduce((obj, cur) => { + obj[cur.dictValue] = cur.dictLabel; + return obj; }, {}) }; diff --git a/stdiet-ui/src/utils/healthyData.js b/stdiet-ui/src/utils/healthyData.js index c788249c5..509d7ecbf 100644 --- a/stdiet-ui/src/utils/healthyData.js +++ b/stdiet-ui/src/utils/healthyData.js @@ -598,6 +598,11 @@ export function dealHealthy(customerHealthy) { ? `,${customerHealthy.otherMotionField}` : ""; } + if (customerHealthy.hasOwnProperty("otherOperationHistory")) { + customerHealthy.operationHistory += customerHealthy.otherOperationHistory + ? `,${customerHealthy.otherOperationHistory}` + : ""; + } if (customerHealthy.hasOwnProperty("defecationNum")) { customerHealthy.defecationNum += "次/天"; } diff --git a/stdiet-ui/src/views/custom/contract/index.vue b/stdiet-ui/src/views/custom/contract/index.vue index 9b82c243d..2c825e0a8 100644 --- a/stdiet-ui/src/views/custom/contract/index.vue +++ b/stdiet-ui/src/views/custom/contract/index.vue @@ -198,7 +198,7 @@ >复制 - + - - + - + @@ -127,7 +161,11 @@ }} - + - +
- - - - - - - - - - - - - + + + + + + + + + + + + + - - - 选择所属客户 - - - - - - + + + + 选择所属客户 + + + + + +
diff --git a/stdiet-ui/src/views/custom/dishes/index.vue b/stdiet-ui/src/views/custom/dishes/index.vue index 481200bda..b01a02a5b 100644 --- a/stdiet-ui/src/views/custom/dishes/index.vue +++ b/stdiet-ui/src/views/custom/dishes/index.vue @@ -12,12 +12,13 @@ v-model="queryParams.name" placeholder="请输入菜品名称" clearable - size="small" + size="mini" @keyup.enter.native="handleQuery" /> - + @@ -199,7 +200,7 @@ :options="dishClassOptions" :props="{ expandTrigger: 'hover' }" placeholder="请选择菜品种类" - > + > @@ -464,8 +465,8 @@ export default { // cusWeightOptions: [], dishClassOptions: [], - dishClassBigOptions:[], - dishClassSmallOptions:[], + dishClassBigOptions: [], + dishClassSmallOptions: [], // 查询参数 queryParams: { pageNum: 1, @@ -473,14 +474,14 @@ export default { name: null, type: null, bigClass: null, - smallClass: null + smallClass: null, }, // 表单参数 form: {}, // 表单校验 rules: {}, //菜品种类查询种类 - dishClassQueryParam:[] + dishClassQueryParam: [], }; }, created() { @@ -512,9 +513,12 @@ export default { /** 查询菜品列表 */ getList() { this.loading = true; - if(this.dishClassQueryParam != null && this.dishClassQueryParam.length > 0){ + if ( + this.dishClassQueryParam != null && + this.dishClassQueryParam.length > 0 + ) { this.queryParams.smallClass = this.dishClassQueryParam[1]; - }else{ + } else { this.queryParams.smallClass = null; } listDishes(this.queryParams).then((response) => { @@ -549,23 +553,25 @@ export default { }); }, //处理菜品大类小类的关系 - dealDishClassBigAndSmall(){ + dealDishClassBigAndSmall() { this.dishClassBigOptions.forEach((item, index) => { - this.dishClassOptions.push({ - 'value': parseInt(item.dictValue), - 'label': item.dictLabel, - 'children': [] + this.dishClassOptions.push({ + value: parseInt(item.dictValue), + label: item.dictLabel, + children: [], + }); + if (index == this.dishClassBigOptions.length - 1) { + this.dishClassSmallOptions.forEach((smallClass, i) => { + if (smallClass.remark) { + this.dishClassOptions[ + parseInt(smallClass.remark - 1) + ].children.push({ + value: parseInt(smallClass.dictValue), + label: smallClass.dictLabel, + }); + } }); - if(index == this.dishClassBigOptions.length - 1){ - this.dishClassSmallOptions.forEach((smallClass, i) => { - if(smallClass.remark){ - this.dishClassOptions[parseInt(smallClass.remark-1)].children.push({ - 'value': parseInt(smallClass.dictValue), - 'label': smallClass.dictLabel - }); - } - }); - } + } }); }, // 菜品类型字典翻译 @@ -587,13 +593,19 @@ export default { return this.selectDictLabel(this.reviewStatusOptions, row.area); }, //菜品种类翻译 - dishClassFormat(row){ - if(row.bigClass > 0 && row.smallClass > 0){ - let bigClassName = this.selectDictLabel(this.dishClassBigOptions, row.bigClass); - let smallClassName = this.selectDictLabel(this.dishClassSmallOptions, row.smallClass); - return bigClassName+"/"+smallClassName; - } - return ""; + dishClassFormat(row) { + if (row.bigClass > 0 && row.smallClass > 0) { + let bigClassName = this.selectDictLabel( + this.dishClassBigOptions, + row.bigClass + ); + let smallClassName = this.selectDictLabel( + this.dishClassSmallOptions, + row.smallClass + ); + return bigClassName + "/" + smallClassName; + } + return ""; }, // 取消按钮 cancel() { @@ -606,7 +618,7 @@ export default { id: null, name: null, type: [], - dishClass:[], + dishClass: [], methods: null, createBy: null, createTime: null, @@ -834,7 +846,7 @@ export default { (arr, cur, idx) => { if (idx > 1) { if (idx === 6) { - arr[6] = arr[3] * 4 + arr[4] * 9 + arr[5] * 4 + ' kcal'; + arr[6] = arr[3] * 4 + arr[4] * 9 + arr[5] * 4 + " kcal"; } else { arr[idx] = data.reduce((acc, dAcc) => { if (idx === 2) { diff --git a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/ConfigDishes.vue b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/ConfigDishes.vue index 8fa47026c..069c2516f 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/ConfigDishes.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/RecipesView/RecipesCom/AddDishesDrawer/ConfigDishes.vue @@ -1,5 +1,5 @@
- + - +