|
@@ -1,6 +1,7 @@
|
|
package cn.com.qmth.examcloud.core.questions.service.impl;
|
|
package cn.com.qmth.examcloud.core.questions.service.impl;
|
|
|
|
|
|
-import cn.com.qmth.examcloud.api.commons.security.bean.User;
|
|
|
|
|
|
+import cn.com.qmth.examcloud.commons.exception.StatusException;
|
|
|
|
+import cn.com.qmth.examcloud.core.questions.base.Constants;
|
|
import cn.com.qmth.examcloud.core.questions.base.Model;
|
|
import cn.com.qmth.examcloud.core.questions.base.Model;
|
|
import cn.com.qmth.examcloud.core.questions.dao.PropertyRepo;
|
|
import cn.com.qmth.examcloud.core.questions.dao.PropertyRepo;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Property;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.Property;
|
|
@@ -8,6 +9,11 @@ import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PropertyConvert;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PropertyDto;
|
|
import cn.com.qmth.examcloud.core.questions.dao.entity.dto.PropertyDto;
|
|
import cn.com.qmth.examcloud.core.questions.service.PropertyService;
|
|
import cn.com.qmth.examcloud.core.questions.service.PropertyService;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.PropertyAssembler;
|
|
import cn.com.qmth.examcloud.core.questions.service.bean.PropertyAssembler;
|
|
|
|
+import org.apache.commons.collections.CollectionUtils;
|
|
|
|
+import org.apache.commons.compress.utils.Lists;
|
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
|
+import org.slf4j.Logger;
|
|
|
|
+import org.slf4j.LoggerFactory;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
@@ -16,182 +22,249 @@ import java.util.List;
|
|
|
|
|
|
/**
|
|
/**
|
|
* @author weiwenhai
|
|
* @author weiwenhai
|
|
- * @describle 课程属性 coursePropertyServiceImpl
|
|
|
|
|
|
+ * @describle 课程属性
|
|
* @date 2017.11.8
|
|
* @date 2017.11.8
|
|
*/
|
|
*/
|
|
@Service("propertyService")
|
|
@Service("propertyService")
|
|
public class PropertyServiceImpl implements PropertyService {
|
|
public class PropertyServiceImpl implements PropertyService {
|
|
-
|
|
|
|
|
|
+ private static final Logger log = LoggerFactory.getLogger(PropertyServiceImpl.class);
|
|
@Autowired
|
|
@Autowired
|
|
private PropertyRepo propertyRepo;
|
|
private PropertyRepo propertyRepo;
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void saveProperty(List<PropertyDto> propertyDtos, User user) {
|
|
|
|
|
|
+ public void saveProperty(List<PropertyDto> dtoList, Long orgId) {
|
|
|
|
+ if (CollectionUtils.isEmpty(dtoList)) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "属性列表不能为空!");
|
|
|
|
+ }
|
|
|
|
+ if (orgId == null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "机构ID不能为空!");
|
|
|
|
+ }
|
|
|
|
+
|
|
PropertyAssembler propertyAssembler = new PropertyAssembler();
|
|
PropertyAssembler propertyAssembler = new PropertyAssembler();
|
|
- for (int i = 0; i < propertyDtos.size(); i++) {
|
|
|
|
|
|
+ for (int i = 0; i < dtoList.size(); i++) {
|
|
//取到父类节点对象
|
|
//取到父类节点对象
|
|
- Property property = propertyAssembler.toProperty(propertyDtos.get(i));
|
|
|
|
|
|
+ PropertyDto dto = dtoList.get(i);
|
|
|
|
+
|
|
|
|
+ Property property = propertyAssembler.toProperty(dto);
|
|
property.setNumber(i + 1);
|
|
property.setNumber(i + 1);
|
|
- property.setOrgId(user.getRootOrgId());
|
|
|
|
|
|
+ property.setOrgId(orgId);
|
|
property = propertyRepo.save(property);
|
|
property = propertyRepo.save(property);
|
|
- List<Property> properties = propertyAssembler.toPropertySon(propertyDtos.get(i));
|
|
|
|
- if (properties != null && properties.size() > 0) {
|
|
|
|
- for (int j = 0; j < properties.size(); j++) {
|
|
|
|
- properties.get(j).setParentId(property.getId());
|
|
|
|
- properties.get(j).setNumber(j + 1);
|
|
|
|
|
|
+
|
|
|
|
+ List<Property> sonProperties = propertyAssembler.toPropertySon(dto);
|
|
|
|
+ if (CollectionUtils.isNotEmpty(sonProperties)) {
|
|
|
|
+ for (int j = 0; j < sonProperties.size(); j++) {
|
|
|
|
+ Property sonProperty = sonProperties.get(j);
|
|
|
|
+ sonProperty.setParentId(property.getId());
|
|
|
|
+ sonProperty.setNumber(j + 1);
|
|
}
|
|
}
|
|
- propertyRepo.saveAll(properties);
|
|
|
|
|
|
+
|
|
|
|
+ propertyRepo.saveAll(sonProperties);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<PropertyDto> propertyDtos(Long coursePropertyId, User user) {
|
|
|
|
- List<PropertyDto> propertyDtos = new ArrayList<>();
|
|
|
|
- //查询所有父节点对象
|
|
|
|
- List<Property> propertieParents = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, 0l);
|
|
|
|
- if (propertieParents != null && propertieParents.size() > 0) {
|
|
|
|
- for (Property property : propertieParents) {
|
|
|
|
- PropertyDto propertyDtoParent = PropertyConvert.of(property);
|
|
|
|
- //查询所有子节点对象
|
|
|
|
- List<Property> propertiesSons = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, property.getId());
|
|
|
|
- if (propertiesSons != null && propertiesSons.size() > 0) {
|
|
|
|
- List<PropertyDto> propertyDtosSons = new ArrayList<>();
|
|
|
|
- for (Property property2 : propertiesSons) {
|
|
|
|
- PropertyDto propertyDto2 = PropertyConvert.of(property2);
|
|
|
|
- propertyDtosSons.add(propertyDto2);
|
|
|
|
- }
|
|
|
|
- propertyDtoParent.setPropertyDtos(propertyDtosSons);
|
|
|
|
- }
|
|
|
|
- propertyDtos.add(propertyDtoParent);
|
|
|
|
- }
|
|
|
|
|
|
+ public void saveProperty(PropertyDto dto) {
|
|
|
|
+ if (dto.getOrgId() == null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "机构ID不能为空!");
|
|
|
|
+ }
|
|
|
|
+ if (dto.getCoursePropertyId() == null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "课程属性ID不能为空!");
|
|
|
|
+ }
|
|
|
|
+ if (dto.getParentId() == null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "上级ID不能为空!");
|
|
|
|
+ }
|
|
|
|
+ if (StringUtils.isEmpty(dto.getName())) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "属性名不能为空!");
|
|
}
|
|
}
|
|
- return propertyDtos;
|
|
|
|
- }
|
|
|
|
|
|
|
|
- @Override
|
|
|
|
- public void saveProperty(Property property, User user) throws Exception {
|
|
|
|
- //新增
|
|
|
|
|
|
+ if (StringUtils.isBlank(dto.getId())) {
|
|
|
|
+ dto.setId(null);//剔除空字符串ID(导致异常数据)
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ Property property = PropertyConvert.of(dto);
|
|
if (property.getId() == null) {
|
|
if (property.getId() == null) {
|
|
- //检查是否重名
|
|
|
|
- Property sameName = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdAndName(user.getRootOrgId(), property.getCoursePropertyId(), property.getParentId(), property.getName());
|
|
|
|
- if (sameName != null) {
|
|
|
|
- throw new Exception("属性名已经存在");
|
|
|
|
|
|
+ //新增
|
|
|
|
+ Property existProperty = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdAndName(property.getOrgId(), property.getCoursePropertyId(), property.getParentId(), property.getName());
|
|
|
|
+ if (existProperty != null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "属性名已经存在!");
|
|
}
|
|
}
|
|
|
|
+
|
|
Integer number = 0;
|
|
Integer number = 0;
|
|
- List<Property> propertieParents = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), property.getCoursePropertyId(), property.getParentId());
|
|
|
|
- if (propertieParents != null && propertieParents.size() > 0) {
|
|
|
|
- number = propertieParents.get(propertieParents.size() - 1).getNumber();
|
|
|
|
|
|
+ List<Property> parentProperties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(property.getOrgId(), property.getCoursePropertyId(), property.getParentId());
|
|
|
|
+ if (parentProperties != null && parentProperties.size() > 0) {
|
|
|
|
+ number = parentProperties.get(parentProperties.size() - 1).getNumber();
|
|
}
|
|
}
|
|
|
|
+
|
|
property.setNumber(number + 1);
|
|
property.setNumber(number + 1);
|
|
} else {
|
|
} else {
|
|
- //得到原来的对象
|
|
|
|
- Property propertyOld = Model.of(propertyRepo.findById(property.getId()));
|
|
|
|
- if (!propertyOld.getName().equals(property.getName())) {
|
|
|
|
|
|
+ //修改
|
|
|
|
+ Property oldProperty = Model.of(propertyRepo.findById(property.getId()));
|
|
|
|
+ if (oldProperty == null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "当前属性已不存在!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (!oldProperty.getName().equals(property.getName())) {
|
|
//检查是否重名
|
|
//检查是否重名
|
|
- Property sameName = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdAndName(user.getRootOrgId(), property.getCoursePropertyId(), property.getParentId(), property.getName());
|
|
|
|
- if (sameName != null) {
|
|
|
|
- throw new Exception("属性名已经存在");
|
|
|
|
|
|
+ Property existProperty = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdAndName(property.getOrgId(), property.getCoursePropertyId(), property.getParentId(), property.getName());
|
|
|
|
+ if (existProperty != null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "属性名已经存在!");
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- property.setOrgId(user.getRootOrgId());
|
|
|
|
|
|
+
|
|
propertyRepo.save(property);
|
|
propertyRepo.save(property);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void deleteProperty(Long propertyId, Long coursePropertyId, User user) {
|
|
|
|
|
|
+ public void deleteProperty(String propertyId, String coursePropertyId, Long orgId) {
|
|
//查询子节点对象
|
|
//查询子节点对象
|
|
- List<Property> properties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(user.getRootOrgId(), coursePropertyId, propertyId);
|
|
|
|
- if (properties != null && properties.size() > 0) {
|
|
|
|
- for (Property property : properties) {
|
|
|
|
|
|
+ List<Property> childProperties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(orgId, coursePropertyId, propertyId);
|
|
|
|
+ if (childProperties != null && childProperties.size() > 0) {
|
|
|
|
+ for (Property property : childProperties) {
|
|
propertyRepo.delete(property);
|
|
propertyRepo.delete(property);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
propertyRepo.deleteById(propertyId);
|
|
propertyRepo.deleteById(propertyId);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<Property> findAll(Long coursePropertyId, User user) {
|
|
|
|
- List<PropertyDto> propertyDtos = propertyDtos(coursePropertyId, user);
|
|
|
|
|
|
+ public List<Property> findProperties(String coursePropertyId, Long orgId) {
|
|
|
|
+ List<PropertyDto> parentProperties = this.findParentPropertyDtoList(coursePropertyId, orgId);
|
|
|
|
+ if (CollectionUtils.isEmpty(parentProperties)) {
|
|
|
|
+ return Lists.newArrayList();
|
|
|
|
+ }
|
|
|
|
+
|
|
List<Property> properties = new ArrayList<>();
|
|
List<Property> properties = new ArrayList<>();
|
|
- if (propertyDtos != null && propertyDtos.size() > 0) {
|
|
|
|
- for (PropertyDto propertyDto : propertyDtos) {
|
|
|
|
- Property property = PropertyConvert.of(propertyDto);
|
|
|
|
- properties.add(property);
|
|
|
|
- if (propertyDto.getPropertyDtos() != null && propertyDto.getPropertyDtos().size() > 0) {
|
|
|
|
- for (PropertyDto propertyDtoSon : propertyDto.getPropertyDtos()) {
|
|
|
|
- Property propertySon = PropertyConvert.of(propertyDtoSon);
|
|
|
|
- properties.add(propertySon);
|
|
|
|
- }
|
|
|
|
|
|
+
|
|
|
|
+ for (PropertyDto parentDto : parentProperties) {
|
|
|
|
+ Property parentProperty = PropertyConvert.of(parentDto);
|
|
|
|
+ properties.add(parentProperty);
|
|
|
|
+
|
|
|
|
+ if (parentDto.getPropertyList() != null && parentDto.getPropertyList().size() > 0) {
|
|
|
|
+ for (PropertyDto sonDto : parentDto.getPropertyList()) {
|
|
|
|
+ Property sonProperty = PropertyConvert.of(sonDto);
|
|
|
|
+ properties.add(sonProperty);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
return properties;
|
|
return properties;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<Property> findPropertySons(Property property) {
|
|
|
|
- List<Property> properySonsList = propertyRepo.findByParentIdOrderByNumber(property.getId());
|
|
|
|
- return properySonsList;
|
|
|
|
|
|
+ public List<Property> findSonProperties(String propertyId) {
|
|
|
|
+ return propertyRepo.findByParentIdOrderByNumber(propertyId);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<Property> findPropertySons(Long propertyId) {
|
|
|
|
- List<Property> properySonsList = propertyRepo.findByParentIdOrderByNumber(propertyId);
|
|
|
|
- return properySonsList;
|
|
|
|
|
|
+ public List<Property> findParentProperties(String coursePropertyId, Long orgId) {
|
|
|
|
+ return propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(orgId, coursePropertyId, Property.ROOT_PARENT_ID);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public List<Property> findPropertyParents(Long coursePropertyId, Long orgId) {
|
|
|
|
- List<Property> properties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(orgId, coursePropertyId, 0l);
|
|
|
|
- return properties;
|
|
|
|
|
|
+ public List<PropertyDto> findParentPropertyDtoList(String coursePropertyId, Long orgId) {
|
|
|
|
+ //查询所有父节点对象
|
|
|
|
+ List<Property> parentProperties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(orgId, coursePropertyId, Property.ROOT_PARENT_ID);
|
|
|
|
+
|
|
|
|
+ List<PropertyDto> dtoList = new ArrayList<>();
|
|
|
|
+ if (CollectionUtils.isEmpty(parentProperties)) {
|
|
|
|
+ return dtoList;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (Property parentProperty : parentProperties) {
|
|
|
|
+ PropertyDto parentDto = PropertyConvert.of(parentProperty);
|
|
|
|
+
|
|
|
|
+ //查询所有子节点对象
|
|
|
|
+ List<Property> sonProperties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(orgId, coursePropertyId, parentProperty.getId());
|
|
|
|
+
|
|
|
|
+ if (CollectionUtils.isNotEmpty(sonProperties)) {
|
|
|
|
+ List<PropertyDto> list = new ArrayList<>();
|
|
|
|
+ for (Property sonProperty : sonProperties) {
|
|
|
|
+ PropertyDto sonDto = PropertyConvert.of(sonProperty);
|
|
|
|
+ list.add(sonDto);
|
|
|
|
+ }
|
|
|
|
+ parentDto.setPropertyList(list);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ dtoList.add(parentDto);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return dtoList;
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void moveUp(Property property) throws Exception {
|
|
|
|
|
|
+ public void moveUp(PropertyDto dto) {
|
|
|
|
+ Property curProperty = Model.of(propertyRepo.findById(dto.getId()));
|
|
|
|
+ if (curProperty == null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "当前属性已不存在!");
|
|
|
|
+ }
|
|
|
|
+
|
|
//查询所有一级属性
|
|
//查询所有一级属性
|
|
- List<Property> properties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(property.getOrgId(), property.getCoursePropertyId(), 0L);
|
|
|
|
- if (properties.size() < 2) {
|
|
|
|
- throw new Exception("无法上移");
|
|
|
|
- } else {
|
|
|
|
- for (int i = 0; i < properties.size(); i++) {
|
|
|
|
- if (property.getId().equals(properties.get(i).getId())) {
|
|
|
|
- if (i == 0) {
|
|
|
|
- throw new Exception("无法上移");
|
|
|
|
- } else {
|
|
|
|
- Integer number = property.getNumber();
|
|
|
|
- property.setNumber(properties.get(i - 1).getNumber());
|
|
|
|
- properties.get(i - 1).setNumber(number);
|
|
|
|
- propertyRepo.save(property);
|
|
|
|
- propertyRepo.save(properties.get(i - 1));
|
|
|
|
- }
|
|
|
|
|
|
+ List<Property> parentProperties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(curProperty.getOrgId(), curProperty.getCoursePropertyId(), Property.ROOT_PARENT_ID);
|
|
|
|
+ if (CollectionUtils.isEmpty(parentProperties)) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "无法上移!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (parentProperties.size() == 1) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "无法上移!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < parentProperties.size(); i++) {
|
|
|
|
+ if (curProperty.getId().equals(parentProperties.get(i).getId())) {
|
|
|
|
+ if (i == 0) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "无法上移!");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ Property nearProperty = parentProperties.get(i - 1);
|
|
|
|
+
|
|
|
|
+ //交换编号
|
|
|
|
+ Integer curNumber = curProperty.getNumber();
|
|
|
|
+ curProperty.setNumber(nearProperty.getNumber());
|
|
|
|
+ nearProperty.setNumber(curNumber);
|
|
|
|
+
|
|
|
|
+ propertyRepo.save(curProperty);
|
|
|
|
+ propertyRepo.save(nearProperty);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public void moveDown(Property property) throws Exception {
|
|
|
|
|
|
+ public void moveDown(PropertyDto dto) {
|
|
|
|
+ Property curProperty = Model.of(propertyRepo.findById(dto.getId()));
|
|
|
|
+ if (curProperty == null) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "当前属性已不存在!");
|
|
|
|
+ }
|
|
|
|
+
|
|
//查询所有一级属性
|
|
//查询所有一级属性
|
|
- List<Property> properties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(property.getOrgId(), property.getCoursePropertyId(), 0l);
|
|
|
|
- if (properties.size() < 2) {
|
|
|
|
- throw new Exception("无法下移");
|
|
|
|
- } else {
|
|
|
|
- for (int i = 0; i < properties.size(); i++) {
|
|
|
|
- if (property.getId().equals(properties.get(i).getId())) {
|
|
|
|
- if (i == (properties.size() - 1)) {
|
|
|
|
- throw new Exception("无法下移");
|
|
|
|
- } else {
|
|
|
|
- Integer number = property.getNumber();
|
|
|
|
- property.setNumber(properties.get(i + 1).getNumber());
|
|
|
|
- properties.get(i + 1).setNumber(number);
|
|
|
|
- propertyRepo.save(property);
|
|
|
|
- propertyRepo.save(properties.get(i + 1));
|
|
|
|
- }
|
|
|
|
|
|
+ List<Property> parentProperties = propertyRepo.findByOrgIdAndCoursePropertyIdAndParentIdOrderByNumber(curProperty.getOrgId(), curProperty.getCoursePropertyId(), Property.ROOT_PARENT_ID);
|
|
|
|
+
|
|
|
|
+ if (CollectionUtils.isEmpty(parentProperties)) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "无法下移!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ if (parentProperties.size() == 1) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "无法下移!");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < parentProperties.size(); i++) {
|
|
|
|
+ if (curProperty.getId().equals(parentProperties.get(i).getId())) {
|
|
|
|
+ if (i == (parentProperties.size() - 1)) {
|
|
|
|
+ throw new StatusException(Constants.SYS_CODE_500, "无法下移!");
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+ Property nearProperty = parentProperties.get(i + 1);
|
|
|
|
+
|
|
|
|
+ //交换编号
|
|
|
|
+ Integer curNumber = curProperty.getNumber();
|
|
|
|
+ curProperty.setNumber(nearProperty.getNumber());
|
|
|
|
+ nearProperty.setNumber(curNumber);
|
|
|
|
+
|
|
|
|
+ propertyRepo.save(curProperty);
|
|
|
|
+ propertyRepo.save(nearProperty);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
-}
|
|
|
|
|
|
+}
|