260115_01_ENH : 대표 템플릿 저장 구현 및 Front 연동 테스트 완료
This commit is contained in:
@@ -4,9 +4,10 @@ import com.kri.common.web.BusinessException;
|
||||
import com.kri.common.webmvc.page.*;
|
||||
import com.kri.contact.server.common.consts.ContactConstant;
|
||||
import com.kri.contact.server.dto.*;;
|
||||
import com.kri.contact.server.persistence.entity.TPrjctMainTmplatEntity;
|
||||
import com.kri.contact.server.persistence.entity.TPrjctEntity;
|
||||
import com.kri.contact.server.persistence.query.ProjectSorts;
|
||||
import com.kri.contact.server.persistence.query.ProjectSpecs;
|
||||
import com.kri.contact.server.persistence.repository.ProjectMainTemplateRepository;
|
||||
import com.kri.contact.server.persistence.repository.ProjectRepository;
|
||||
import org.springframework.dao.DataIntegrityViolationException;
|
||||
import org.springframework.data.domain.*;
|
||||
@@ -25,6 +26,7 @@ public class ProjectService {
|
||||
private final AssignService assignService;
|
||||
private final ResultCodeService resultCodeService;
|
||||
private final ProjectRepository projectRepository;
|
||||
private final ProjectMainTemplateRepository projectMainTemplateRepository;
|
||||
private static final List<Short> STATUS_0_1 = List.of((short) 0, (short) 1);
|
||||
private static final List<Short> STATUS_1 = List.of((short) 1);
|
||||
|
||||
@@ -128,6 +130,12 @@ public class ProjectService {
|
||||
return projectRepository.findDistinctOwnerFw(statusList);
|
||||
}
|
||||
|
||||
public Long getMainTemplateIdx(Long prjctIdx, Short chnnlTy) {
|
||||
return projectMainTemplateRepository.findByIdPrjctIdxAndIdChnnlTy(prjctIdx, chnnlTy)
|
||||
.map(TPrjctMainTmplatEntity::getTmplatIdx)
|
||||
.orElse(null);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updateProject(long prjctIdx, ProjectUpdateRequestDto req, String modUser, LocalDateTime modDt) {
|
||||
// dirty checking 업데이트
|
||||
@@ -143,6 +151,17 @@ public class ProjectService {
|
||||
resultCodeService.updateResultCode(prjctIdx, req.getResultCodeList(), modUser, modDt);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void updateProjectMainTemplate(ProjectMainTemplateUpdateRequestDto req, String modUser, LocalDateTime modDt) {
|
||||
Short chnnlTy = req.getChnnlTy().getCode();
|
||||
projectMainTemplateRepository.deleteByIdPrjctIdxAndIdChnnlTy(req.getPrjctIdx(), chnnlTy);
|
||||
|
||||
if(req.getTmplatIdx() == null) return;
|
||||
|
||||
TPrjctMainTmplatEntity entity = TPrjctMainTmplatEntity.create(req, modUser, modDt);
|
||||
projectMainTemplateRepository.save(entity);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void deleteProject(Long prjctIdx, String delUser, LocalDateTime delDt) {
|
||||
int deleteCount = projectRepository.softDeleteByPrjctIdx(prjctIdx, delUser, delDt);
|
||||
|
||||
Reference in New Issue
Block a user