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..fa7eef4a4 --- /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; + + String createBy; + + Date createTime; + + String 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..0898611a0 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 @@ -6,6 +6,7 @@ import lombok.Data; import java.math.BigDecimal; import java.util.Date; +import java.util.List; /** * 食材对象 sys_ingredient @@ -15,8 +16,6 @@ import java.util.Date; */ @Data public class SysIngredient { - private static final long serialVersionUID = 1L; - /** * id */ @@ -107,4 +106,11 @@ public class SysIngredient { private Long[] notRecIds; + /** + * 食材信息 + */ + private String info; + + private List imgList; + } \ 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..c8655fe19 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 list); } \ 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..fbfa31886 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 @@ -1,7 +1,9 @@ package com.stdiet.custom.service.impl; import com.stdiet.common.utils.DateUtils; +import com.stdiet.common.utils.SecurityUtils; import com.stdiet.common.utils.StringUtils; +import com.stdiet.custom.domain.SysIngredentFile; import com.stdiet.custom.domain.SysIngredient; import com.stdiet.custom.domain.SysIngredientNotRec; import com.stdiet.custom.domain.SysIngredientRec; @@ -60,24 +62,35 @@ public class SysIngredientServiceImpl implements ISysIngredientService { insertRecommand(sysIngredient); // insertNotRecommand(sysIngredient); + // + if (StringUtils.isNotNull(sysIngredient.getImgList())) { + List fileList = sysIngredient.getImgList(); + for (SysIngredentFile file : fileList) { + file.setId(sysIngredient.getId()); + file.setCreateBy(SecurityUtils.getUsername()); + file.setCreateTime(DateUtils.getNowDate()); + } + sysIngredientMapper.batchInsertIngredientImage(fileList); + } return rows; } /** * 新增推荐标签 + * * @param ingredient */ public void insertRecommand(SysIngredient ingredient) { Long[] recIds = ingredient.getRecIds(); - if(StringUtils.isNotNull(recIds)) { + if (StringUtils.isNotNull(recIds)) { List list = new ArrayList(); - for(Long recId: recIds) { + for (Long recId : recIds) { SysIngredientRec rec = new SysIngredientRec(); rec.setIngredientId(ingredient.getId()); rec.setRecommandId(recId); list.add(rec); } - if(list.size() > 0) { + if (list.size() > 0) { sysIngredientMapper.batchIngredientRec(list); } } @@ -85,19 +98,20 @@ public class SysIngredientServiceImpl implements ISysIngredientService { /** * 新增不推荐标签 + * * @param ingredient */ public void insertNotRecommand(SysIngredient ingredient) { Long[] notRecIds = ingredient.getNotRecIds(); - if(StringUtils.isNotNull(notRecIds)) { + if (StringUtils.isNotNull(notRecIds)) { List list = new ArrayList(); - for(Long recId: notRecIds) { + for (Long recId : notRecIds) { SysIngredientNotRec notRec = new SysIngredientNotRec(); notRec.setIngredientId(ingredient.getId()); notRec.setRecommandId(recId); list.add(notRec); } - if(list.size() > 0) { + if (list.size() > 0) { sysIngredientMapper.batchIngredientNotRec(list); } } @@ -148,11 +162,12 @@ public class SysIngredientServiceImpl implements ISysIngredientService { /** * 根据食材名称查询食材信息 + * * @param name * @return */ @Override - public SysIngredient selectSysIngredientByName(String name){ + public SysIngredient selectSysIngredientByName(String name) { return sysIngredientMapper.selectSysIngredientByName(name); } } \ No newline at end of file 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..4e6ad6777 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} @@ -124,6 +126,7 @@ update_by, update_time, review_status, + info, #{name}, @@ -138,17 +141,18 @@ #{updateBy}, #{updateTime}, #{reviewStatus}, + #{info}, - + 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}) @@ -192,6 +196,7 @@ update_by = #{updateBy}, update_time = #{updateTime}, review_status = #{reviewStatus}, + info = #{info}, where id = #{id} @@ -213,4 +218,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/FileUpload/index.vue b/stdiet-ui/src/components/FileUpload/index.vue new file mode 100644 index 000000000..4fe046dee --- /dev/null +++ b/stdiet-ui/src/components/FileUpload/index.vue @@ -0,0 +1,60 @@ + + 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" > - + 复制 - + - - + - + @@ -127,7 +161,11 @@ }} - + - +
- - - - - - - - - - - - - + + + + + + + + + + + + + - - - 选择所属客户 - - - - - - + + + + 选择所属客户 + + + + + +
diff --git a/stdiet-ui/src/views/custom/ingredient/index.vue b/stdiet-ui/src/views/custom/ingredient/index.vue index 61fbff02c..4c58c211a 100644 --- a/stdiet-ui/src/views/custom/ingredient/index.vue +++ b/stdiet-ui/src/views/custom/ingredient/index.vue @@ -245,55 +245,17 @@ /> - - + + - + - + - - - - /100g - - - - - - /100g - - - - - - /100g - - - - - + + + - - + + + + + + + + + + + + + + + + + - + - + - - + + + + + + +
+ 将文件拖到此处,或点击上传 +
+
+ 最多可上传5个文件,且每个文件不超过10M +
+
+
+
+ + + + + diff --git a/stdiet-ui/src/views/custom/recipesBuild/VerifyView/index.vue b/stdiet-ui/src/views/custom/recipesBuild/VerifyView/index.vue index d5ae09756..bb423afbc 100644 --- a/stdiet-ui/src/views/custom/recipesBuild/VerifyView/index.vue +++ b/stdiet-ui/src/views/custom/recipesBuild/VerifyView/index.vue @@ -87,7 +87,7 @@ export default { this.setNotRecIgds({ data: [] }); } - this.selectedIgd = data.id; + this.selectedIgd = data.id === this.selectedIgd ? 0 : data.id; this.setNotRecIgds({ data: [this.selectedIgd] }); }, diff --git a/stdiet-ui/src/views/custom/recipesPlan/index.vue b/stdiet-ui/src/views/custom/recipesPlan/index.vue index 3f15d2125..1d1ee402a 100644 --- a/stdiet-ui/src/views/custom/recipesPlan/index.vue +++ b/stdiet-ui/src/views/custom/recipesPlan/index.vue @@ -200,6 +200,7 @@ export default { orderDialog: undefined, reviewStatusOptions: [ { dictValue: 0, dictLabel: "未制作" }, + { dictValue: 3, dictLabel: "制作中" }, { dictValue: 1, dictLabel: "未审核" }, { dictValue: 2, dictLabel: "已审核" }, ],