| | |
| | | import com.ycl.common.utils.SecurityUtils; |
| | | import com.ycl.domain.entity.File; |
| | | import com.ycl.domain.entity.ProjectInfo; |
| | | import com.ycl.domain.form.DocumentInfoForm; |
| | | import com.ycl.domain.form.ProjectInfoForm; |
| | | import com.ycl.domain.query.ProjectInfoQuery; |
| | | import com.ycl.domain.vo.*; |
| | |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | import org.springframework.util.Assert; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | item.setType(FileTypeEnum.PROJECT_INFO); |
| | | }); |
| | | fileService.saveBatch(fileList); |
| | | return Result.ok("添加成功"); |
| | | return Result.ok("添加成功").data(entity.getId()); |
| | | } |
| | | |
| | | /** |
| | |
| | | ProjectInfoForm.getEntityByForm(form,entity); |
| | | Long userId = SecurityUtils.getUserId(); |
| | | entity.setUpdateBy(userId); |
| | | |
| | | //更新项目信息 |
| | | baseMapper.updateById(entity); |
| | | List<File> fileList = form.getFileList(); |
| | | fileList.forEach(item->{ |
| | | item.setBusId(entity.getId()); |
| | |
| | | fileMapper.delete(fileQueryWrapper); |
| | | //替换成现有 |
| | | fileService.saveBatch(fileList); |
| | | //更新项目信息 |
| | | baseMapper.updateById(entity); |
| | | return Result.ok("修改成功"); |
| | | } |
| | | |
| | |
| | | map.put("processExceptionProject", 0); |
| | | return map; |
| | | } |
| | | |
| | | @Override |
| | | public Result docDetail(Integer id) { |
| | | DocumentInfoForm documentInfoForm = new DocumentInfoForm(); |
| | | QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); |
| | | fileQueryWrapper.eq("type",FileTypeEnum.DOCUMENT_INFO.getType()); |
| | | fileQueryWrapper.eq("bus_id",id); |
| | | List<File> files = fileMapper.selectList(fileQueryWrapper); |
| | | documentInfoForm.setFileList(files); |
| | | return Result.ok().data(documentInfoForm); |
| | | } |
| | | |
| | | @Override |
| | | public Result addDoc(DocumentInfoForm form) { |
| | | List<File> fileList = form.getFileList(); |
| | | fileList.forEach(item->{ |
| | | item.setBusId(form.getProjectId()); |
| | | item.setType(FileTypeEnum.DOCUMENT_INFO); |
| | | }); |
| | | //删除原有文件 |
| | | QueryWrapper<File> fileQueryWrapper = new QueryWrapper<>(); |
| | | fileQueryWrapper.eq("type",FileTypeEnum.DOCUMENT_INFO.getType()); |
| | | fileQueryWrapper.eq("bus_id",form.getProjectId()); |
| | | fileMapper.delete(fileQueryWrapper); |
| | | //替换成现有 |
| | | fileService.saveBatch(fileList); |
| | | return Result.ok(); |
| | | } |
| | | |
| | | @Override |
| | | public Result getManagerFlag(Integer recordId) { |
| | | ProjectInfo projectInfo = baseMapper.selectById(recordId); |
| | | // 判断当前用户id是否在主管列表中 |
| | | String competentDepartment = projectInfo.getCompetentDepartment(); |
| | | List<String> list = Arrays.asList(competentDepartment.split(",")); |
| | | // 获得当前用户id |
| | | Long userId = SecurityUtils.getUserId(); |
| | | if (list.contains(userId.toString())) { |
| | | return Result.ok().data(true); |
| | | } else { |
| | | return Result.ok().data(false); |
| | | } |
| | | } |
| | | } |