|
@@ -14,6 +14,7 @@ import com.jeeplus.core.excel.ExcelOptions;
|
|
import com.jeeplus.core.excel.ExportMode;
|
|
import com.jeeplus.core.excel.ExportMode;
|
|
import com.jeeplus.core.excel.utils.EasyPoiUtil;
|
|
import com.jeeplus.core.excel.utils.EasyPoiUtil;
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
import com.jeeplus.core.query.QueryWrapperGenerator;
|
|
|
|
+import com.jeeplus.sys.service.dto.RoleDTO;
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
import com.jeeplus.sys.service.dto.UserDTO;
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
import com.jeeplus.sys.utils.UserUtils;
|
|
import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
import com.jeeplus.test.oss.domain.WorkAttachment;
|
|
@@ -25,6 +26,7 @@ import com.jeeplus.test.projectRecords.constant.enums.YesOrNoEnum;
|
|
import com.jeeplus.test.projectRecords.domain.Project;
|
|
import com.jeeplus.test.projectRecords.domain.Project;
|
|
import com.jeeplus.test.projectRecords.service.ProjectService;
|
|
import com.jeeplus.test.projectRecords.service.ProjectService;
|
|
import com.jeeplus.sys.service.UserService;
|
|
import com.jeeplus.sys.service.UserService;
|
|
|
|
+import com.jeeplus.test.projectRecords.service.dto.FileUploadListDTO;
|
|
import com.jeeplus.test.projectRecords.service.dto.ProjectDTO;
|
|
import com.jeeplus.test.projectRecords.service.dto.ProjectDTO;
|
|
import com.jeeplus.test.projectRecords.service.mapstruct.ProjectWrapper;
|
|
import com.jeeplus.test.projectRecords.service.mapstruct.ProjectWrapper;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
@@ -88,9 +90,19 @@ public class ProjectController {
|
|
public ResponseEntity<IPage<Project>> data(Project project, Page<Project> page) throws Exception {
|
|
public ResponseEntity<IPage<Project>> data(Project project, Page<Project> page) throws Exception {
|
|
QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( project, Project.class );
|
|
QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition ( project, Project.class );
|
|
IPage<Project> result = projectService.selectPage (page,queryWrapper);
|
|
IPage<Project> result = projectService.selectPage (page,queryWrapper);
|
|
|
|
+ UserDTO currentUserDTO = UserUtils.getCurrentUserDTO();
|
|
|
|
+ Boolean bmzrRoleFlag = false;
|
|
|
|
+ if(null != currentUserDTO.getRoleDTOList() && currentUserDTO.getRoleDTOList().size()>0){
|
|
|
|
+ for (RoleDTO roleDTO : currentUserDTO.getRoleDTOList()) {
|
|
|
|
+ if("bmzr".equals(roleDTO.getEnName())){
|
|
|
|
+ bmzrRoleFlag = true;
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
List<Project> list = result.getRecords();
|
|
List<Project> list = result.getRecords();
|
|
for (Project info: list) {
|
|
for (Project info: list) {
|
|
- if(info.getProjectHeadId().equals(UserUtils.getCurrentUserDTO().getId())){
|
|
|
|
|
|
+ if(info.getProjectHeadId().equals(currentUserDTO.getId()) || bmzrRoleFlag){
|
|
info.setPermissionFlag(true);
|
|
info.setPermissionFlag(true);
|
|
}else{
|
|
}else{
|
|
info.setPermissionFlag(false);
|
|
info.setPermissionFlag(false);
|
|
@@ -156,25 +168,35 @@ public class ProjectController {
|
|
|
|
|
|
//判断一下文号是否存在
|
|
//判断一下文号是否存在
|
|
if(StringUtils.isNotBlank(projectDTO.getDocumentNum())){
|
|
if(StringUtils.isNotBlank(projectDTO.getDocumentNum())){
|
|
- if(ObjectUtil.isNotEmpty(projectService.selectByDocumentNum(projectDTO.getDocumentNum()))){
|
|
|
|
|
|
+ if(ObjectUtil.isNotEmpty(projectService.selectByDocumentNum(projectDTO))){
|
|
return ResponseEntity.badRequest().body("不可使用已存在的文号");
|
|
return ResponseEntity.badRequest().body("不可使用已存在的文号");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ //文件状态
|
|
|
|
+ if (CollectionUtils.isNotEmpty(projectDTO.getWorkAttachments())) {
|
|
|
|
+ pro.setFileUploadType("1");
|
|
|
|
+ } else {
|
|
|
|
+ pro.setFileUploadType("0");
|
|
|
|
+ }
|
|
|
|
|
|
projectService.save(pro);//新增
|
|
projectService.save(pro);//新增
|
|
}else{
|
|
}else{
|
|
|
|
|
|
//判断一下文号是否存在
|
|
//判断一下文号是否存在
|
|
if(StringUtils.isNotBlank(projectDTO.getDocumentNum())){
|
|
if(StringUtils.isNotBlank(projectDTO.getDocumentNum())){
|
|
- Project userProjects = projectService.selectByDocumentNum(projectDTO.getDocumentNum());
|
|
|
|
|
|
+ Project userProjects = projectService.selectByDocumentNum(projectDTO);
|
|
if(ObjectUtil.isNotEmpty(userProjects)){
|
|
if(ObjectUtil.isNotEmpty(userProjects)){
|
|
if(!projectDTO.getId().equals(userProjects.getId())){
|
|
if(!projectDTO.getId().equals(userProjects.getId())){
|
|
return ResponseEntity.badRequest().body("不可使用已存在的文号");
|
|
return ResponseEntity.badRequest().body("不可使用已存在的文号");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
LambdaUpdateWrapper<Project> wrapper = projectService.getLambdaUpdateWrapper(projectDTO);
|
|
LambdaUpdateWrapper<Project> wrapper = projectService.getLambdaUpdateWrapper(projectDTO);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(projectDTO.getWorkAttachments())) {
|
|
|
|
+ wrapper.set(Project::getFileUploadType, "1");
|
|
|
|
+ } else {
|
|
|
|
+ wrapper.set(Project::getFileUploadType, "0");
|
|
|
|
+ }
|
|
projectService.update (pro,wrapper);//修改
|
|
projectService.update (pro,wrapper);//修改
|
|
}
|
|
}
|
|
//项目id处理
|
|
//项目id处理
|
|
@@ -184,7 +206,6 @@ public class ProjectController {
|
|
//oss上传文件相关
|
|
//oss上传文件相关
|
|
ossService.saveMsg(projectDTO.getWorkAttachments());
|
|
ossService.saveMsg(projectDTO.getWorkAttachments());
|
|
}
|
|
}
|
|
-
|
|
|
|
return ResponseEntity.ok ("保存项目成功");
|
|
return ResponseEntity.ok ("保存项目成功");
|
|
}
|
|
}
|
|
|
|
|
|
@@ -258,9 +279,9 @@ public class ProjectController {
|
|
return ResponseEntity.badRequest().body ("导入文件格式不正确,建议根据模板来进行数据的导入");
|
|
return ResponseEntity.badRequest().body ("导入文件格式不正确,建议根据模板来进行数据的导入");
|
|
}
|
|
}
|
|
//判断文件中是否有重复的文号
|
|
//判断文件中是否有重复的文号
|
|
- if(hashMap.size() != listA.size() + listB.size()){
|
|
|
|
|
|
+ /*if(hashMap.size() != listA.size() + listB.size()){
|
|
return ResponseEntity.badRequest().body ("文件中存在重复的文号或者多个空文号");
|
|
return ResponseEntity.badRequest().body ("文件中存在重复的文号或者多个空文号");
|
|
- }
|
|
|
|
|
|
+ }*/
|
|
//导入数据
|
|
//导入数据
|
|
projectService.saveBatch(arrayList);
|
|
projectService.saveBatch(arrayList);
|
|
|
|
|
|
@@ -363,12 +384,17 @@ public class ProjectController {
|
|
|
|
|
|
//文号的问题
|
|
//文号的问题
|
|
if(StringUtils.isNotBlank(project.getDocumentNum())) {
|
|
if(StringUtils.isNotBlank(project.getDocumentNum())) {
|
|
- Project userProject = projectService.selectByDocumentNum(project.getDocumentNum());
|
|
|
|
|
|
+ Project userProject = projectService.selectByDocumentNum(project);
|
|
if(ObjectUtil.isNotEmpty(userProject)){
|
|
if(ObjectUtil.isNotEmpty(userProject)){
|
|
return "文件中存在已在档的文号";
|
|
return "文件中存在已在档的文号";
|
|
}
|
|
}
|
|
- }else{
|
|
|
|
|
|
+ }/*else{
|
|
return "文件中存在空的文号,文号不允许为空";
|
|
return "文件中存在空的文号,文号不允许为空";
|
|
|
|
+ }*/
|
|
|
|
+
|
|
|
|
+ //年份的问题
|
|
|
|
+ if(StringUtils.isBlank(project.getYear())) {
|
|
|
|
+ return "文件中存在空年份,请填写年份信息";
|
|
}
|
|
}
|
|
|
|
|
|
//是否开票
|
|
//是否开票
|
|
@@ -605,9 +631,6 @@ public class ProjectController {
|
|
String time=formatter.format(userProjectDTO.getReimbursementDate());
|
|
String time=formatter.format(userProjectDTO.getReimbursementDate());
|
|
userProjectDTO.setReimbursementDateUi(time);
|
|
userProjectDTO.setReimbursementDateUi(time);
|
|
}
|
|
}
|
|
-
|
|
|
|
-
|
|
|
|
-
|
|
|
|
return userProjectDTO;
|
|
return userProjectDTO;
|
|
}
|
|
}
|
|
|
|
|
|
@@ -658,5 +681,39 @@ public class ProjectController {
|
|
return flag;
|
|
return flag;
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @GetMapping("proportion")
|
|
|
|
+ @ApiOperation(value = "项目完成比例")
|
|
|
|
+ public String proportion(Project project) throws Exception{
|
|
|
|
+ QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition(project, Project.class);
|
|
|
|
+ return projectService.proportion(queryWrapper);
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ /**
|
|
|
|
+ * 导出项目数据
|
|
|
|
+ *
|
|
|
|
+ * @param projectDTO
|
|
|
|
+ * @param response
|
|
|
|
+ * @throws Exception
|
|
|
|
+ */
|
|
|
|
+ @GetMapping("exportFileUploadList")
|
|
|
|
+ @ApiOperation(value = "导出项目文件上传比例excel")
|
|
|
|
+ public void exportFileUploadList(ProjectDTO projectDTO, HttpServletResponse response) throws Exception {
|
|
|
|
+ Project project = ProjectWrapper.INSTANCE.toEntity (projectDTO);
|
|
|
|
+ QueryWrapper<Project> queryWrapper = QueryWrapperGenerator.buildQueryCondition( project, Project.class );
|
|
|
|
+ List<FileUploadListDTO> list = projectService.exportFileUploadList(projectDTO);
|
|
|
|
+ if(ProjectTypeEnum.ASSESS.getValue().equals(projectDTO.getItemType())){
|
|
|
|
+ if(StringUtils.isNotBlank(projectDTO.getYear())){
|
|
|
|
+ EasyPoiUtil.exportExcel(list, projectDTO.getYear() + "年评估项目上传比例报告", "评估项目上传比例报告", FileUploadListDTO.class, "", response );
|
|
|
|
+ }else{
|
|
|
|
+ EasyPoiUtil.exportExcel(list, "评估项目上传比例报告", "评估项目上传比例报告", FileUploadListDTO.class, "", response );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if(ProjectTypeEnum.CONSULTATION.getValue().equals(projectDTO.getItemType())){
|
|
|
|
+ if(StringUtils.isNotBlank(projectDTO.getYear())){
|
|
|
|
+ EasyPoiUtil.exportExcel(list, projectDTO.getYear() + "年咨询项目上传比例报告", "咨询项目上传比例报告", FileUploadListDTO.class, "", response );
|
|
|
|
+ }else{
|
|
|
|
+ EasyPoiUtil.exportExcel(list, "咨询项目上传比例报告", "咨询项目上传比例报告", FileUploadListDTO.class, "", response );
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|