TASK:模块化;
This commit is contained in:
@@ -18,6 +18,8 @@ public interface LibraryModelPointService extends IService<LibraryModelPoint> {
|
||||
|
||||
LibraryModelPointVO saveOrEditTemplatePoint(LibraryModelPointDTO libraryModelPoint);
|
||||
|
||||
LibraryModelPointVO saveOrEditTemplatePointOld(LibraryModelPointDTO libraryModelPointDTO);
|
||||
|
||||
List<LibraryModelPointVO> selectByLibraryIds(List<Long> libraryIds);
|
||||
|
||||
/**
|
||||
|
||||
@@ -12,6 +12,7 @@ import com.ai.da.mapper.primary.entity.*;
|
||||
import com.ai.da.model.dto.LibraryModelPointDTO;
|
||||
import com.ai.da.model.dto.ModelsDotDTO;
|
||||
import com.ai.da.model.enums.ModelType;
|
||||
import com.ai.da.model.enums.Sex;
|
||||
import com.ai.da.model.vo.LibraryModelPointVO;
|
||||
import com.ai.da.python.PythonService;
|
||||
import com.ai.da.python.vo.DesignPythonObjects;
|
||||
@@ -30,6 +31,7 @@ import org.springframework.util.CollectionUtils;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.Collections;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
@@ -145,6 +147,44 @@ public class LibraryModelPointServiceImpl extends ServiceImpl<LibraryModelPointM
|
||||
return libraryModelPointVO;
|
||||
}
|
||||
|
||||
@Override
|
||||
public LibraryModelPointVO saveOrEditTemplatePointOld(LibraryModelPointDTO libraryModelPointDTO) {
|
||||
// Library library = libraryService.getById(libraryModelPointDTO.getLibraryId());
|
||||
// Assert.notNull(library,"library does not exist!");
|
||||
LibraryModelPointVO libraryModelPointVO = CopyUtil.copyObject(libraryModelPointDTO, LibraryModelPointVO.class);
|
||||
if (Objects.isNull(libraryModelPointDTO.getTemplateId())) {
|
||||
//新增
|
||||
LibraryModelPoint libraryModelPoint = resolvePoint(libraryModelPointDTO);
|
||||
libraryModelPoint.setCreateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
||||
save(libraryModelPoint);
|
||||
libraryModelPointVO.setTemplateId(libraryModelPoint.getId());
|
||||
} else {
|
||||
//编辑
|
||||
if (!StringUtils.isEmpty(libraryModelPointDTO.getModelSex())) {
|
||||
Library byId = libraryService.getById(libraryModelPointDTO.getLibraryId());
|
||||
if (!byId.getLevel2Type().equals(libraryModelPointDTO.getModelSex())) {
|
||||
if (byId.getLevel2Type().equals(Sex.FEMALE.getValue())) {
|
||||
libraryService.checkModel(Sex.FEMALE.getValue(), Collections.singletonList(byId.getId()), 1);
|
||||
}else {
|
||||
libraryService.checkModel(Sex.MALE.getValue(), Collections.singletonList(byId.getId()), 1);
|
||||
}
|
||||
byId.setLevel2Type(libraryModelPointDTO.getModelSex());
|
||||
libraryService.updateById(byId);
|
||||
}
|
||||
}
|
||||
LibraryModelPoint modelPoint = getById(libraryModelPointDTO.getTemplateId());
|
||||
if (Objects.isNull(modelPoint)) {
|
||||
throw new BusinessException("modelPoint.not.found");
|
||||
}
|
||||
modelPoint = resolvePoint(libraryModelPointDTO);
|
||||
modelPoint.setUpdateDate(DateUtil.getByTimeZone(libraryModelPointDTO.getTimeZone()));
|
||||
modelPoint.setId(libraryModelPointDTO.getTemplateId());
|
||||
updateById(modelPoint);
|
||||
libraryModelPointVO.setTemplateId(modelPoint.getId());
|
||||
}
|
||||
return libraryModelPointVO;
|
||||
}
|
||||
|
||||
private LibraryModelPoint resolvePoint(LibraryModelPointDTO libraryModelPointDTO) {
|
||||
LibraryModelPoint libraryModelPoint = CopyUtil.copyObject(libraryModelPointDTO, LibraryModelPoint.class);
|
||||
libraryModelPoint.setRelationId(libraryModelPointDTO.getLibraryId());
|
||||
|
||||
@@ -752,7 +752,6 @@ public class LibraryServiceImpl extends ServiceImpl<LibraryMapper, Library> impl
|
||||
}
|
||||
sysFile.setLevel1Type("Models");
|
||||
sysFile.setLevel2Type(uploadDTO.getModelSex());
|
||||
sysFile.setLevel3Type(uploadDTO.getAgeGroup());
|
||||
sysFile.setUrl(filePath);
|
||||
sysFile.setMd5(uploadDTO.getMd5());
|
||||
sysFile.setCreateDate(new Date());
|
||||
|
||||
Reference in New Issue
Block a user