|
@@ -1,4 +1,4 @@
|
|
|
-package com.jeeplus.sys.controller;
|
|
|
+package com.jeeplus.test.projectRecords.controller;
|
|
|
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
import cn.hutool.core.util.StrUtil;
|
|
@@ -11,21 +11,20 @@ import com.jeeplus.aop.logging.annotation.ApiLog;
|
|
|
import com.jeeplus.core.excel.ExcelOptions;
|
|
|
import com.jeeplus.core.excel.ExportMode;
|
|
|
import com.jeeplus.core.excel.utils.EasyPoiUtil;
|
|
|
-import com.jeeplus.sys.constant.enums.ProjectStatusEnum;
|
|
|
-import com.jeeplus.sys.constant.enums.ProjectTypeEnum;
|
|
|
-import com.jeeplus.sys.constant.enums.YesOrNoEnum;
|
|
|
-import com.jeeplus.sys.domain.UserProject;
|
|
|
-import com.jeeplus.sys.service.UserProjectService;
|
|
|
+import com.jeeplus.test.projectRecords.constant.enums.ProjectStatusEnum;
|
|
|
+import com.jeeplus.test.projectRecords.constant.enums.ProjectTypeEnum;
|
|
|
+import com.jeeplus.test.projectRecords.constant.enums.YesOrNoEnum;
|
|
|
+import com.jeeplus.test.projectRecords.domain.Project;
|
|
|
+import com.jeeplus.test.projectRecords.service.ProjectService;
|
|
|
import com.jeeplus.sys.service.UserService;
|
|
|
-import com.jeeplus.sys.service.dto.UserProjectDTO;
|
|
|
-import com.jeeplus.sys.service.mapstruct.UserProjectWrapper;
|
|
|
+import com.jeeplus.test.projectRecords.service.dto.ProjectDTO;
|
|
|
+import com.jeeplus.test.projectRecords.service.mapstruct.ProjectWrapper;
|
|
|
import io.swagger.annotations.Api;
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
|
import org.apache.commons.lang3.time.DateUtils;
|
|
|
-import org.apache.poi.hssf.usermodel.HSSFSheet;
|
|
|
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFSheet;
|
|
|
-import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
|
+import org.apache.poi.ss.usermodel.Workbook;
|
|
|
+import org.apache.poi.ss.usermodel.WorkbookFactory;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.http.ResponseEntity;
|
|
|
import org.springframework.security.access.prepost.PreAuthorize;
|
|
@@ -38,11 +37,14 @@ import javax.validation.Valid;
|
|
|
import java.io.IOException;
|
|
|
import java.io.InputStream;
|
|
|
import java.io.OutputStream;
|
|
|
+import java.lang.reflect.Field;
|
|
|
+import java.lang.reflect.Type;
|
|
|
import java.net.URLEncoder;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.HashMap;
|
|
|
import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -55,10 +57,10 @@ import java.util.stream.Collectors;
|
|
|
@Api("项目管理")
|
|
|
@RestController
|
|
|
@RequestMapping(value = "/sys/project")
|
|
|
-public class UserProjectController {
|
|
|
+public class ProjectController {
|
|
|
|
|
|
@Autowired
|
|
|
- private UserProjectService userProjectService;
|
|
|
+ private ProjectService projectService;
|
|
|
|
|
|
@Autowired
|
|
|
private UserService userService;
|
|
@@ -68,8 +70,8 @@ public class UserProjectController {
|
|
|
@ApiLog("查询项目列表")
|
|
|
@PreAuthorize("hasAuthority('sys:project:list')")
|
|
|
@GetMapping("list")
|
|
|
- public ResponseEntity<IPage<UserProject>> data(UserProject userProject, Page<UserProject> page) throws Exception {
|
|
|
- IPage<UserProject> result = userProjectService.selectPage (page,userProject);
|
|
|
+ public ResponseEntity<IPage<Project>> data(Project project, Page<Project> page) throws Exception {
|
|
|
+ IPage<Project> result = projectService.selectPage (page,project);
|
|
|
return ResponseEntity.ok (result);
|
|
|
}
|
|
|
|
|
@@ -82,7 +84,7 @@ public class UserProjectController {
|
|
|
@PreAuthorize ("hasAnyAuthority('sys:project:view','sys:project:add','sys:project:edit')")
|
|
|
@GetMapping("queryById")
|
|
|
public ResponseEntity queryById(@RequestParam("id") String id) {
|
|
|
- UserProject userProject = userProjectService.selectByProjectId ( id );
|
|
|
+ Project userProject = projectService.selectByProjectId ( id );
|
|
|
return ResponseEntity.ok (userProject);
|
|
|
}
|
|
|
|
|
@@ -94,10 +96,10 @@ public class UserProjectController {
|
|
|
@ApiLog("保存项目")
|
|
|
@PreAuthorize ("hasAnyAuthority('sys:post:add','sys:post:edit')")
|
|
|
@PostMapping("save")
|
|
|
- public ResponseEntity save(@Valid @RequestBody UserProjectDTO projectDTO){
|
|
|
+ public ResponseEntity save(@Valid @RequestBody ProjectDTO projectDTO){
|
|
|
//新增或编辑表单保存
|
|
|
- UserProject project = UserProjectWrapper.INSTANCE.toEntity (projectDTO);
|
|
|
- UserProject pro = userProjectService.projectDtoToDate(project,projectDTO);
|
|
|
+ Project project = ProjectWrapper.INSTANCE.toEntity (projectDTO);
|
|
|
+ Project pro = projectService.projectDtoToDate(project,projectDTO);
|
|
|
pro.setItemType(projectDTO.getItemType());
|
|
|
|
|
|
if(StrUtil.isNotEmpty(projectDTO.getProjectHead())){
|
|
@@ -132,17 +134,17 @@ public class UserProjectController {
|
|
|
|
|
|
//判断一下文号是否存在
|
|
|
if(StrUtil.isNotEmpty(projectDTO.getDocumentNum())){
|
|
|
- if(ObjectUtil.isNotEmpty(userProjectService.selectByDocumentNum(projectDTO.getDocumentNum()))){
|
|
|
+ if(ObjectUtil.isNotEmpty(projectService.selectByDocumentNum(projectDTO.getDocumentNum()))){
|
|
|
return ResponseEntity.badRequest().body("不可使用已存在的文号");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- userProjectService.save(pro);//新增
|
|
|
+ projectService.save(pro);//新增
|
|
|
}else{
|
|
|
|
|
|
//判断一下文号是否存在
|
|
|
if(StrUtil.isNotEmpty(projectDTO.getDocumentNum())){
|
|
|
- UserProject userProjects = userProjectService.selectByDocumentNum(projectDTO.getDocumentNum());
|
|
|
+ Project userProjects = projectService.selectByDocumentNum(projectDTO.getDocumentNum());
|
|
|
if(ObjectUtil.isNotEmpty(userProjects)){
|
|
|
if(!projectDTO.getId().equals(userProjects.getId())){
|
|
|
return ResponseEntity.badRequest().body("不可使用已存在的文号");
|
|
@@ -150,8 +152,8 @@ public class UserProjectController {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- LambdaUpdateWrapper<UserProject> wrapper = userProjectService.getLambdaUpdateWrapper(projectDTO);
|
|
|
- userProjectService.update (pro,wrapper);//修改
|
|
|
+ LambdaUpdateWrapper<Project> wrapper = projectService.getLambdaUpdateWrapper(projectDTO);
|
|
|
+ projectService.update (pro,wrapper);//修改
|
|
|
}
|
|
|
|
|
|
return ResponseEntity.ok ("保存项目成功");
|
|
@@ -167,7 +169,7 @@ public class UserProjectController {
|
|
|
@DeleteMapping("delete")
|
|
|
public ResponseEntity delete(String ids) {
|
|
|
String idArray[] =ids.split(",");
|
|
|
- userProjectService.removeByIds (Lists.newArrayList (idArray));
|
|
|
+ projectService.removeByIds (Lists.newArrayList (idArray));
|
|
|
return ResponseEntity.ok ("删除项目成功");
|
|
|
}
|
|
|
|
|
@@ -181,71 +183,88 @@ public class UserProjectController {
|
|
|
@PostMapping("import")
|
|
|
@ApiOperation(value = "导入项目数据excel")
|
|
|
public ResponseEntity importFile(MultipartFile file) throws IOException{
|
|
|
-
|
|
|
+ //用来计数的,计算导入了多少条数据
|
|
|
this.successNum = 0;
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
- ArrayList<UserProject> arrayList = new ArrayList<>();
|
|
|
+ ArrayList<Project> arrayList = new ArrayList<>();
|
|
|
HashMap<String,String> hashMap = new HashMap<>();
|
|
|
|
|
|
- HSSFWorkbook hssfWorkBook=new HSSFWorkbook(file.getInputStream());
|
|
|
-
|
|
|
- List<UserProjectDTO> listA = new ArrayList<>();
|
|
|
- List<UserProjectDTO> listB = new ArrayList<>();
|
|
|
+ //这里通过WorkbookFactory.create的方式来创建workBook,并没有用HSSFWorkbook和XSSFWorkbook,因为这两个局限性太大了,只能通过后缀来进行判断excel的版本
|
|
|
+ //workBook在这里我主要用来判断是否存在“项目明细表”或“咨询报告”的sheet页,不存在会向用户抛提示
|
|
|
+ Workbook workBook = WorkbookFactory.create(file.getInputStream());
|
|
|
|
|
|
- int sheetIndexAs = hssfWorkBook.getSheetIndex("项目明细表");
|
|
|
+ List<ProjectDTO> listA = new ArrayList<>();
|
|
|
+ List<ProjectDTO> listB = new ArrayList<>();
|
|
|
+ //判断是否存在“项目明细表”sheet页
|
|
|
+ int sheetIndexAs = workBook.getSheetIndex("项目明细表");
|
|
|
if(sheetIndexAs != -1){
|
|
|
- //评估项目sheet
|
|
|
- listA = EasyPoiUtil.importSheetExcel(file, 1, 1, sheetIndexAs,1, UserProjectDTO.class);
|
|
|
-
|
|
|
+ //获取评估项目sheet
|
|
|
+ listA = EasyPoiUtil.importSheetExcel(file, 1, 1, sheetIndexAs,1, ProjectDTO.class);
|
|
|
+ //去除excel中的空行
|
|
|
+ listA = getExcelList(listA);
|
|
|
+ //导入前检测数据
|
|
|
String resultA = importDecide(listA, sdf, arrayList, hashMap, successNum, ProjectTypeEnum.ASSESS.getValue());
|
|
|
if(StrUtil.isNotEmpty(resultA)){
|
|
|
+ //有返回值,说明导入的数据不正确。向用户抛提示
|
|
|
return ResponseEntity.badRequest().body (resultA);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- int sheetIndexCo = hssfWorkBook.getSheetIndex("咨询报告");
|
|
|
+ //判断是否存在“咨询报告”sheet页
|
|
|
+ int sheetIndexCo = workBook.getSheetIndex("咨询报告");
|
|
|
if(sheetIndexCo != -1){
|
|
|
//咨询项目sheet
|
|
|
- listB = EasyPoiUtil.importSheetExcel(file, 1, 1, sheetIndexCo,1, UserProjectDTO.class);
|
|
|
-
|
|
|
+ listB = EasyPoiUtil.importSheetExcel(file, 1, 1, sheetIndexCo,1, ProjectDTO.class);
|
|
|
+ //去除excel中的空行
|
|
|
+ listB = getExcelList(listB);
|
|
|
+ //导入前检测数据
|
|
|
String resultB = importDecide(listB, sdf, arrayList, hashMap, successNum, ProjectTypeEnum.CONSULTATION.getValue());
|
|
|
if(StrUtil.isNotEmpty(resultB)){
|
|
|
+ //有返回值,说明导入的数据不正确。向用户抛提示
|
|
|
return ResponseEntity.badRequest().body (resultB);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- if(sheetIndexAs == -1 && sheetIndexCo == -1) return ResponseEntity.badRequest().body ("导入文件格式不正确,建议根据模板来进行数据的导入");
|
|
|
-
|
|
|
-
|
|
|
+ //如果两个sheet页都不存在,说明这个导入的文件不符合要求
|
|
|
+ if(sheetIndexAs == -1 && sheetIndexCo == -1){
|
|
|
+ return ResponseEntity.badRequest().body ("导入文件格式不正确,建议根据模板来进行数据的导入");
|
|
|
+ }
|
|
|
+ //判断文件中是否有重复的文号
|
|
|
if(hashMap.size() != listA.size() + listB.size()){
|
|
|
return ResponseEntity.badRequest().body ("文件中存在重复的文号或者多个空文号");
|
|
|
}
|
|
|
-
|
|
|
- userProjectService.saveBatch(arrayList);
|
|
|
+ //导入数据
|
|
|
+ projectService.saveBatch(arrayList);
|
|
|
|
|
|
return ResponseEntity.ok("已成功导入 " + successNum + " 条数据");
|
|
|
}
|
|
|
- public String importDecide(List<UserProjectDTO> list,SimpleDateFormat sdf,ArrayList<UserProject> arrayList,HashMap<String,String> hashMap,int successNum,String itemType){
|
|
|
-
|
|
|
- for (UserProjectDTO project : list) {
|
|
|
+ public String importDecide(List<ProjectDTO> list, SimpleDateFormat sdf, ArrayList<Project> arrayList, HashMap<String,String> hashMap, int successNum, String itemType){
|
|
|
|
|
|
+ for (ProjectDTO project : list) {
|
|
|
+ if(ObjectUtil.isEmpty(project)){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
try {
|
|
|
if(StrUtil.isNotEmpty(project.getEvaluationReportDateUi())){
|
|
|
+ //EvaluationReportDateUi字段接到的数据符合"yyyy/MM/dd"时间格式的话,正常执行。
|
|
|
+ //不符合的话,就会有异常,进到catch
|
|
|
String format = sdf.format(DateUtils.parseDate(project.getEvaluationReportDateUi(), new String[]{"yyyy/MM/dd"}));
|
|
|
+ //符合要求的时间格式,则会将数据转换为时间格式存到EvaluationReportDate字段中,并且将项目状态设置为”已完成“
|
|
|
project.setEvaluationReportDate(sdf.parse(format));
|
|
|
project.setStatus(ProjectStatusEnum.FINISH.getValue());
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
if(StrUtil.isNotEmpty(project.getEvaluationReportDateUi())){
|
|
|
if(project.getEvaluationReportDateUi().contains("报告已作废")){
|
|
|
+ //当EvaluationReportDateUi字段接收到的值包含”报告已作废“时,项目状态为”作废“,并且将值放到AssessReportMessage字段中
|
|
|
project.setStatus(ProjectStatusEnum.INVALID.getValue());
|
|
|
project.setAssessReportMessage(project.getEvaluationReportDateUi());
|
|
|
}else{
|
|
|
+ //当EvaluationReportDateUi字段接收到的值不包含”报告已作废“时,项目状态为”暂存“,并且将值放到AssessReportMessage字段中
|
|
|
project.setStatus(ProjectStatusEnum.STAGING.getValue());
|
|
|
project.setAssessReportMessage(project.getEvaluationReportDateUi());
|
|
|
}
|
|
|
}else{
|
|
|
+ //当EvaluationReportDateUi字段接收到的值为空时,项目状态为”暂存“
|
|
|
project.setStatus(ProjectStatusEnum.STAGING.getValue());
|
|
|
}
|
|
|
}
|
|
@@ -256,8 +275,10 @@ public class UserProjectController {
|
|
|
project.setEvaluationBaseDate(sdf.parse(format));
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
- if(StrUtil.isNotEmpty(project.getEvaluationBaseDateUi()))
|
|
|
+ if(StrUtil.isNotEmpty(project.getEvaluationBaseDateUi())){
|
|
|
project.setAssessBaseMessage(project.getEvaluationBaseDateUi());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
try {
|
|
@@ -266,8 +287,10 @@ public class UserProjectController {
|
|
|
project.setInvoiceDate(sdf.parse(format));
|
|
|
}
|
|
|
}catch (Exception e){
|
|
|
- if(StrUtil.isNotEmpty(project.getInvoiceDateUi()))
|
|
|
+ if(StrUtil.isNotEmpty(project.getInvoiceDateUi())){
|
|
|
project.setInvoiceMessage(project.getInvoiceDateUi());
|
|
|
+ }
|
|
|
+
|
|
|
}
|
|
|
|
|
|
try {
|
|
@@ -281,7 +304,7 @@ public class UserProjectController {
|
|
|
|
|
|
//项目负责人、签字评估师1、签字评估师2 关联user表的id
|
|
|
if(StrUtil.isNotEmpty(project.getProjectHead())){
|
|
|
- String id = userService.getUserIdByLogin(project.getProjectHead());
|
|
|
+ String id = userService.getUserIdByName(project.getProjectHead());
|
|
|
if(StrUtil.isNotEmpty(id)){
|
|
|
project.setProjectHead(id);
|
|
|
}else{
|
|
@@ -290,7 +313,7 @@ public class UserProjectController {
|
|
|
}
|
|
|
|
|
|
if(StrUtil.isNotEmpty(project.getEvaluationPersonOne())){
|
|
|
- String id = userService.getUserIdByLogin(project.getEvaluationPersonOne());
|
|
|
+ String id = userService.getUserIdByName(project.getEvaluationPersonOne());
|
|
|
if(ObjectUtil.isNotEmpty(id)){
|
|
|
project.setEvaluationPersonOne(id);
|
|
|
}else{
|
|
@@ -299,7 +322,7 @@ public class UserProjectController {
|
|
|
}
|
|
|
|
|
|
if(StrUtil.isNotEmpty(project.getEvaluationPersonTwo())){
|
|
|
- String id = userService.getUserIdByLogin(project.getEvaluationPersonTwo());
|
|
|
+ String id = userService.getUserIdByName(project.getEvaluationPersonTwo());
|
|
|
if(ObjectUtil.isNotEmpty(id)){
|
|
|
project.setEvaluationPersonTwo(id);
|
|
|
}else{
|
|
@@ -309,7 +332,7 @@ public class UserProjectController {
|
|
|
|
|
|
//文号的问题
|
|
|
if(StrUtil.isNotEmpty(project.getDocumentNum())) {
|
|
|
- UserProject userProject = userProjectService.selectByDocumentNum(project.getDocumentNum());
|
|
|
+ Project userProject = projectService.selectByDocumentNum(project.getDocumentNum());
|
|
|
if(ObjectUtil.isNotEmpty(userProject)){
|
|
|
return "文件中存在已在档的文号";
|
|
|
}
|
|
@@ -361,7 +384,7 @@ public class UserProjectController {
|
|
|
|
|
|
hashMap.put(project.getDocumentNum(),null);
|
|
|
|
|
|
- UserProject userProject = UserProjectWrapper.INSTANCE.toEntity(project);
|
|
|
+ Project userProject = ProjectWrapper.INSTANCE.toEntity(project);
|
|
|
//项目类型 1.评估项目 2.咨询项目
|
|
|
userProject.setItemType(itemType);
|
|
|
arrayList.add(userProject);
|
|
@@ -416,37 +439,39 @@ public class UserProjectController {
|
|
|
@PreAuthorize("hasAnyAuthority('sys:project:export')")
|
|
|
@GetMapping("export")
|
|
|
@ApiOperation(value = "导出项目excel")
|
|
|
- public void exportFile(UserProjectDTO userProjectDTO, Page <UserProjectDTO> page, ExcelOptions options, HttpServletResponse response) throws Exception {
|
|
|
+ public void exportFile(ProjectDTO userProjectDTO, Page <ProjectDTO> page, ExcelOptions options, HttpServletResponse response) throws Exception {
|
|
|
String fileName = options.getFilename ( );
|
|
|
- UserProject project = UserProjectWrapper.INSTANCE.toEntity (userProjectDTO);
|
|
|
- Page <UserProject> userProjectPage = pageAToPageB(page);
|
|
|
- List <UserProject> result = new ArrayList<>();
|
|
|
- List <UserProjectDTO> userProjectDTOList = new ArrayList<>();
|
|
|
+ Project project = ProjectWrapper.INSTANCE.toEntity (userProjectDTO);
|
|
|
+ Page <Project> userProjectPage = pageAToPageB(page);
|
|
|
+ List <Project> result = new ArrayList<>();
|
|
|
+ List <ProjectDTO> userProjectDTOList = new ArrayList<>();
|
|
|
if ( ExportMode.current.equals ( options.getMode ( ) ) ) {
|
|
|
- result = userProjectService.selectPage ( userProjectPage, project ).getRecords ( );
|
|
|
+ result = projectService.selectPage ( userProjectPage, project ).getRecords ( );
|
|
|
} else {
|
|
|
userProjectPage.setSize ( -1 );
|
|
|
userProjectPage.setCurrent ( 0 );
|
|
|
- result = userProjectService.selectPage ( userProjectPage, project ).getRecords ( );
|
|
|
+ result = projectService.selectPage ( userProjectPage, project ).getRecords ( );
|
|
|
}
|
|
|
result.stream().forEach(item->{
|
|
|
- UserProjectDTO projectDTO = UserProjectWrapper.INSTANCE.toDTO(item);
|
|
|
+ ProjectDTO projectDTO = ProjectWrapper.INSTANCE.toDTO(item);
|
|
|
userProjectDTOList.add(projectDTO);
|
|
|
});
|
|
|
|
|
|
SimpleDateFormat formatter=new SimpleDateFormat("yyyy/MM/dd");
|
|
|
- List <UserProjectDTO> collect = userProjectDTOList.stream().map(item -> {
|
|
|
+ List <ProjectDTO> collect = userProjectDTOList.stream().map(item -> {
|
|
|
return isChange(item,formatter);
|
|
|
}).collect(Collectors.toList());
|
|
|
- if(ProjectTypeEnum.ASSESS.getValue().equals(userProjectDTO.getItemType()))
|
|
|
- EasyPoiUtil.exportExcel ( collect, "2021年资产评估项目备查登记表", "项目明细表", UserProjectDTO.class, fileName, response );
|
|
|
- if(ProjectTypeEnum.CONSULTATION.getValue().equals(userProjectDTO.getItemType()))
|
|
|
- EasyPoiUtil.exportExcel ( collect, "2021年资产评估项目备查登记表", "咨询报告", UserProjectDTO.class, fileName, response );
|
|
|
+ if(ProjectTypeEnum.ASSESS.getValue().equals(userProjectDTO.getItemType())){
|
|
|
+ EasyPoiUtil.exportExcel ( collect, "2021年资产评估项目备查登记表", "项目明细表", ProjectDTO.class, fileName, response );
|
|
|
+ }
|
|
|
+ if(ProjectTypeEnum.CONSULTATION.getValue().equals(userProjectDTO.getItemType())){
|
|
|
+ EasyPoiUtil.exportExcel ( collect, "2021年资产评估项目备查登记表", "咨询报告", ProjectDTO.class, fileName, response );
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
- public Page<UserProject> pageAToPageB(Page<UserProjectDTO> page){
|
|
|
+ public Page<Project> pageAToPageB(Page<ProjectDTO> page){
|
|
|
|
|
|
- Page<UserProject> pageB = new Page<>();
|
|
|
+ Page<Project> pageB = new Page<>();
|
|
|
pageB.setCurrent(page.getCurrent());
|
|
|
pageB.setSize(page.getSize());
|
|
|
pageB.setOrders(page.getOrders());
|
|
@@ -454,7 +479,7 @@ public class UserProjectController {
|
|
|
return pageB;
|
|
|
}
|
|
|
|
|
|
- public UserProjectDTO isChange(UserProjectDTO userProjectDTO,SimpleDateFormat formatter){
|
|
|
+ public ProjectDTO isChange(ProjectDTO userProjectDTO, SimpleDateFormat formatter){
|
|
|
|
|
|
if(StrUtil.isNotEmpty(userProjectDTO.getIsInvoice())){
|
|
|
//是否开票
|
|
@@ -550,5 +575,52 @@ public class UserProjectController {
|
|
|
return userProjectDTO;
|
|
|
}
|
|
|
|
|
|
+ public ArrayList<ProjectDTO> getExcelList(List<ProjectDTO> list){
|
|
|
+
|
|
|
+ ArrayList<ProjectDTO> projectDTOS = new ArrayList<>();
|
|
|
+
|
|
|
+ list.stream().forEach(item->{
|
|
|
+ if(!objectCheckIsNull(item)){
|
|
|
+ projectDTOS.add(item);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return projectDTOS;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 检查一个对象的所有属性值是否都是null
|
|
|
+ * @param object
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ public boolean objectCheckIsNull(Object object) {
|
|
|
+ boolean flag = true; //定义返回结果,默认为true
|
|
|
+
|
|
|
+ if (Objects.isNull(object)) {
|
|
|
+ flag = true;
|
|
|
+ } else {
|
|
|
+ Class clazz = (Class) object.getClass(); // 得到类对象
|
|
|
+ Field fields[] = clazz.getDeclaredFields(); // 得到所有属性
|
|
|
+ for (Field field : fields) {
|
|
|
+ if("serialVersionUID".equals(field.getName())){
|
|
|
+ continue;
|
|
|
+ }
|
|
|
+ field.setAccessible(true);
|
|
|
+ Object fieldValue = null;
|
|
|
+ try {
|
|
|
+ fieldValue = field.get(object); //得到属性值
|
|
|
+ Type fieldType = field.getGenericType();//得到属性类型
|
|
|
+ String fieldName = field.getName(); // 得到属性名
|
|
|
+ } catch (Exception e){}
|
|
|
+ if (fieldValue != null) { //只要有一个属性值不为null 就返回false 表示对象不为null
|
|
|
+ flag = false;
|
|
|
+ break;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ return flag;
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
}
|