diff --git a/hyp-admin/src/main/java/com/hyp/web/controller/manager/ApplyInfoListManager.java b/hyp-admin/src/main/java/com/hyp/web/controller/manager/ApplyInfoListManager.java index 264af9a..d7c4410 100644 --- a/hyp-admin/src/main/java/com/hyp/web/controller/manager/ApplyInfoListManager.java +++ b/hyp-admin/src/main/java/com/hyp/web/controller/manager/ApplyInfoListManager.java @@ -2,6 +2,8 @@ package com.hyp.web.controller.manager; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.convert.Convert; +import com.hyp.common.core.domain.AjaxResult; +import com.hyp.common.core.domain.entity.SysDictData; import com.hyp.common.core.domain.entity.SysUser; import com.hyp.common.core.domain.model.LoginUser; import com.hyp.common.enums.ApplyStatusEnum; @@ -14,11 +16,9 @@ import com.hyp.system.domain.dto.ApplyInfoListDTO; import com.hyp.system.domain.dto.ApplyInfoListSaveDTO; import com.hyp.system.domain.vo.ApplyInfoListVO; import com.hyp.system.domain.vo.FileRelationVO; -import com.hyp.system.service.ISysDictDataService; -import com.hyp.system.service.RewApplyInfoListService; -import com.hyp.system.service.RewFileRelationService; -import com.hyp.system.service.RewScoreInfoService; +import com.hyp.system.service.*; import org.apache.commons.lang3.StringUtils; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Component; import org.springframework.transaction.annotation.Transactional; @@ -51,6 +51,11 @@ public class ApplyInfoListManager { @Resource private RewFileRelationService relationService; + + @Autowired + private ISysDictTypeService dictTypeService; + + /** * * 奖项类型 @@ -209,6 +214,30 @@ public class ApplyInfoListManager { } + /** + * + * 文件上传校验 + * @param applyId + * @param applyType + * @return com.hyp.common.core.domain.AjaxResult + */ + + public AjaxResult checkUploadFile(String applyId,String applyType){ + List list = dictTypeService.selectDictDataByType(applyType); + if(CollUtil.isNotEmpty(list)){ + for(SysDictData sysDictData : list){ + List fileRelations = relationService.lambdaQuery() + .eq(RewFileRelation::getApplyId, applyId) + .eq(RewFileRelation::getFileCode, sysDictData.getDictValue()).list(); + if(CollUtil.isEmpty(fileRelations)){ + return AjaxResult.error("《"+sysDictData.getDictLabel()+"》"+"材料存在未上传情况,请检查"); + } + } + } + return AjaxResult.success(); + } + + } diff --git a/hyp-admin/src/main/java/com/hyp/web/controller/reward/ApplyController.java b/hyp-admin/src/main/java/com/hyp/web/controller/reward/ApplyController.java index 7f06615..41fe29e 100644 --- a/hyp-admin/src/main/java/com/hyp/web/controller/reward/ApplyController.java +++ b/hyp-admin/src/main/java/com/hyp/web/controller/reward/ApplyController.java @@ -70,4 +70,11 @@ public class ApplyController extends BaseController { return success(applyInfoListManager.detail(applyId)); } + @ApiOperation("材料上传校验") + @GetMapping("/checkUploadFile") + public AjaxResult checkUploadFile(@RequestParam String applyId, + @RequestParam String applyType){ + return applyInfoListManager.checkUploadFile(applyId,applyType); + } + }