|
@@ -2,8 +2,11 @@ package com.jeeplus.modules.projectType.service;
|
|
|
|
|
|
import com.jeeplus.common.persistence.Page;
|
|
import com.jeeplus.common.persistence.Page;
|
|
import com.jeeplus.common.service.CrudService;
|
|
import com.jeeplus.common.service.CrudService;
|
|
|
|
+import com.jeeplus.common.utils.MyBeanUtils;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
import com.jeeplus.common.utils.StringUtils;
|
|
|
|
+import com.jeeplus.modules.projectType.dao.ProjectResultsFileTemplateDao;
|
|
import com.jeeplus.modules.projectType.dao.ProjectTypeDao;
|
|
import com.jeeplus.modules.projectType.dao.ProjectTypeDao;
|
|
|
|
+import com.jeeplus.modules.projectType.entity.ProjectTemplateType;
|
|
import com.jeeplus.modules.projectType.entity.ProjectType;
|
|
import com.jeeplus.modules.projectType.entity.ProjectType;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectBasedData;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectBasedData;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportTreeData;
|
|
import com.jeeplus.modules.projectcontentinfo.entity.ProjectReportTreeData;
|
|
@@ -13,6 +16,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.transaction.annotation.Transactional;
|
|
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
import java.util.Map;
|
|
|
|
|
|
@@ -26,6 +30,8 @@ import java.util.Map;
|
|
public class ProjectTypeService extends CrudService<ProjectTypeDao, ProjectType> {
|
|
public class ProjectTypeService extends CrudService<ProjectTypeDao, ProjectType> {
|
|
@Autowired
|
|
@Autowired
|
|
private ProjectTypeDao projectTypeDao;
|
|
private ProjectTypeDao projectTypeDao;
|
|
|
|
+ @Autowired
|
|
|
|
+ private ProjectResultsFileTemplateDao templateDao;
|
|
|
|
|
|
public ProjectType getProjectType(String id) {
|
|
public ProjectType getProjectType(String id) {
|
|
return projectTypeDao.get(id);
|
|
return projectTypeDao.get(id);
|
|
@@ -80,8 +86,31 @@ public class ProjectTypeService extends CrudService<ProjectTypeDao, ProjectType>
|
|
/* //根据该父类的id获取该父类的类型,插入到该对像的父类parentId中
|
|
/* //根据该父类的id获取该父类的类型,插入到该对像的父类parentId中
|
|
String parentTypeId=dao.getParentTypeId(projectType.getParentId());
|
|
String parentTypeId=dao.getParentTypeId(projectType.getParentId());
|
|
projectType.setParentId(parentTypeId);*/
|
|
projectType.setParentId(parentTypeId);*/
|
|
-
|
|
|
|
- projectType.setTypeId(typeId);
|
|
|
|
|
|
+ if(StringUtils.isBlank(typeId)){
|
|
|
|
+ projectType.setTypeId(projectType.getParentId()+"1");
|
|
|
|
+ }else{
|
|
|
|
+ projectType.setTypeId(typeId);
|
|
|
|
+ }
|
|
|
|
+ if(StringUtils.isNotBlank(projectType.getTypeId())){
|
|
|
|
+ projectType.setId(projectType.getTypeId());
|
|
|
|
+ ProjectTemplateType templateProjectType = new ProjectTemplateType();
|
|
|
|
+ try {
|
|
|
|
+ MyBeanUtils.copyBeanNotNull2Bean(projectType, templateProjectType);//将编辑表单中的非NULL值覆盖数据库记录中的值
|
|
|
|
+ } catch (Exception e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ List<String> idList = templateDao.idList("0");
|
|
|
|
+ if(idList.contains(templateProjectType.getParentId())){
|
|
|
|
+ templateProjectType.setTier(2);
|
|
|
|
+ }else{
|
|
|
|
+ //根据parentId获取父节点tier的值并加1保存
|
|
|
|
+ Integer parentTier = templateDao.getTierByParentId(templateProjectType.getParentId());
|
|
|
|
+ templateProjectType.setTier(parentTier+1);
|
|
|
|
+ }
|
|
|
|
+ if(templateProjectType.getTier() <4){
|
|
|
|
+ templateDao.insert(templateProjectType);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
dao.insert(projectType);
|
|
dao.insert(projectType);
|
|
}
|
|
}
|
|
|
|
|