fix:文件上传校验接口开发

dev
wangxy 12 months ago
parent 161750b1c0
commit 60db10f47e

@ -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<SysDictData> list = dictTypeService.selectDictDataByType(applyType);
if(CollUtil.isNotEmpty(list)){
for(SysDictData sysDictData : list){
List<RewFileRelation> 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();
}
}

@ -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);
}
}

Loading…
Cancel
Save