|
|
|
@ -27,6 +27,7 @@ import com.epmet.commons.tools.page.PageData; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
|
import com.epmet.commons.tools.utils.Result; |
|
|
|
import com.epmet.dao.ProjectCategoryDao; |
|
|
|
import com.epmet.dao.ProjectDao; |
|
|
|
import com.epmet.dao.ProjectTagsDao; |
|
|
|
import com.epmet.dto.ProjectCategoryDTO; |
|
|
|
import com.epmet.dto.form.DelCategoryFormDTO; |
|
|
|
@ -34,6 +35,7 @@ import com.epmet.dto.form.ProjectCategoryTagListFormDTO; |
|
|
|
import com.epmet.dto.form.ProjectSaveCategoryFormDTO; |
|
|
|
import com.epmet.dto.result.*; |
|
|
|
import com.epmet.entity.ProjectCategoryEntity; |
|
|
|
import com.epmet.entity.ProjectEntity; |
|
|
|
import com.epmet.feign.GovIssueOpenFeignClient; |
|
|
|
import com.epmet.redis.ProjectCategoryRedis; |
|
|
|
import com.epmet.service.ProjectCategoryService; |
|
|
|
@ -62,6 +64,8 @@ public class ProjectCategoryServiceImpl extends BaseServiceImpl<ProjectCategoryD |
|
|
|
private ProjectTagsDao projectTagsDao; |
|
|
|
@Autowired |
|
|
|
private GovIssueOpenFeignClient govIssueOpenFeignClient; |
|
|
|
@Autowired |
|
|
|
private ProjectDao projectDao; |
|
|
|
|
|
|
|
@Override |
|
|
|
public PageData<ProjectCategoryDTO> page(Map<String, Object> params) { |
|
|
|
@ -157,6 +161,14 @@ public class ProjectCategoryServiceImpl extends BaseServiceImpl<ProjectCategoryD |
|
|
|
baseDao.delByProjectId(formDTO.getProjectId()); |
|
|
|
return; |
|
|
|
} |
|
|
|
//2021.4.14 sun 兼容项目立项的项目保存分类逻辑 这类项目来源不属于议题
|
|
|
|
ProjectEntity projectEntity = projectDao.selectById(formDTO.getProjectId()); |
|
|
|
if (null == projectEntity) { |
|
|
|
throw new RenException(String.format("保存项目分类,获取项目信息失败,projiectId->%s", formDTO.getProjectId())); |
|
|
|
} |
|
|
|
formDTO.setOrigin(projectEntity.getOrigin()); |
|
|
|
//end
|
|
|
|
|
|
|
|
//1.查询项目所属客户和所属网格信息以及分类对应的分类信息
|
|
|
|
Result<ProjectIssueCategoryResultDTO> result = govIssueOpenFeignClient.getProjectAndCategoryInfo(formDTO); |
|
|
|
if (!result.success()) { |
|
|
|
@ -165,12 +177,12 @@ public class ProjectCategoryServiceImpl extends BaseServiceImpl<ProjectCategoryD |
|
|
|
ProjectIssueDTOResultDTO issue = result.getData().getIssueDTO(); |
|
|
|
List<ProjectCategoryDTOResultDTO> categoryList = result.getData().getCategoryList(); |
|
|
|
|
|
|
|
//2.汇总批量新增数据
|
|
|
|
//2.汇总批量新增项目分类数据
|
|
|
|
List<ProjectCategoryEntity> entityList = new ArrayList<>(); |
|
|
|
formDTO.getCategoryList().forEach(ca -> { |
|
|
|
ProjectCategoryEntity entity = new ProjectCategoryEntity(); |
|
|
|
entity.setCustomerId(issue.getCustomerId()); |
|
|
|
entity.setGridId(issue.getGridId()); |
|
|
|
entity.setCustomerId(formDTO.getCustomerId()); |
|
|
|
if("issue".equals(formDTO.getOrigin())){ entity.setGridId(issue.getGridId()); } |
|
|
|
entity.setProjectId(formDTO.getProjectId()); |
|
|
|
entity.setCategoryId(ca.getId()); |
|
|
|
categoryList.forEach(cl -> { |
|
|
|
@ -182,10 +194,10 @@ public class ProjectCategoryServiceImpl extends BaseServiceImpl<ProjectCategoryD |
|
|
|
entityList.add(entity); |
|
|
|
}); |
|
|
|
|
|
|
|
//3.根据议题Id删除可能存在的分类信息
|
|
|
|
//3.根据项目Id删除可能存在的分类信息
|
|
|
|
baseDao.delByProjectId(formDTO.getProjectId()); |
|
|
|
|
|
|
|
//4.批量保存议题分类信息
|
|
|
|
//4.批量保存项目分类信息
|
|
|
|
if (!insertBatch(entityList)) { |
|
|
|
throw new RenException(String.format("项目分类信息保存失败")); |
|
|
|
} |
|
|
|
|