mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
移除板材库属性限制中的纹理
This commit is contained in:
+1
-1
@@ -181,7 +181,7 @@ public interface PlateGoodMapper extends BaseMapperX<PlateGoodDO> {
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询机构下名称、材质、颜色、厚度、品牌、纹路的分组
|
||||
* 查询机构下名称、材质、颜色、厚度、品牌的分组
|
||||
*
|
||||
* @param organId
|
||||
* @return
|
||||
|
||||
+6
-4
@@ -16,6 +16,8 @@ import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.cf.imes.module.system.enums.ErrorCodeConstants.PLATE_ATTR_GROUP_EXISTS;
|
||||
|
||||
@Slf4j
|
||||
public final class PlateExcelListener<T> extends ExcelListener<PlateImportExcelVO> {
|
||||
|
||||
@@ -43,7 +45,7 @@ public final class PlateExcelListener<T> extends ExcelListener<PlateImportExcelV
|
||||
// 查询机构下的所有板材商品编号
|
||||
plateGoodsId = plateManageService.getOrgPlateGoodsId(organId);
|
||||
|
||||
// 查询机构下名称、材质、颜色、厚度、品牌、纹路的分组
|
||||
// 查询机构下名称、材质、颜色、厚度、品牌的分组
|
||||
List<LinkedHashMap<String, Object>> orgAttrGroup = plateManageService.getOrgAttrGroup(organId);
|
||||
|
||||
orgAttrGroupList = orgAttrGroup.stream()
|
||||
@@ -96,15 +98,15 @@ public final class PlateExcelListener<T> extends ExcelListener<PlateImportExcelV
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查属性组合(名称、材质、颜色、厚度、品牌、纹路)是否存在
|
||||
* 检查属性组合(名称、材质、颜色、厚度、品牌)是否存在
|
||||
*
|
||||
* @param data
|
||||
*/
|
||||
private void checkAttrGroup(PlateImportExcelVO data) {
|
||||
String checkKey = data.getGoodsName() + "-" + data.getMaterial() + "-" + data.getColor() + "-" + Double.valueOf(data.getThickness()) + "-" + (StringUtils.isNotEmpty(data.getBrand()) ? data.getBrand() : "") + "-" + data.getTexture();
|
||||
String checkKey = data.getGoodsName() + "-" + data.getMaterial() + "-" + data.getColor() + "-" + Double.valueOf(data.getThickness()) + "-" + (StringUtils.isNotEmpty(data.getBrand()) ? data.getBrand() : "");
|
||||
if (orgAttrGroupList.contains(checkKey)) {
|
||||
this.flag = false;
|
||||
data.setResult(data.getResult() + "," + "名称、材质、颜色、厚度、品牌、纹路的组合已存在");
|
||||
data.setResult(data.getResult() + "," + PLATE_ATTR_GROUP_EXISTS.getMsg());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -114,7 +114,7 @@ public interface PlateManageService {
|
||||
Set<String> getOrgPlateGoodsId(Long organId);
|
||||
|
||||
/**
|
||||
* 查询机构下名称、材质、颜色、厚度、品牌、纹路的分组
|
||||
* 查询机构下名称、材质、颜色、厚度、品牌的分组
|
||||
*
|
||||
* @param organId
|
||||
* @return
|
||||
|
||||
+4
-8
@@ -93,7 +93,7 @@ public class PlateManageServiceImpl implements PlateManageService {
|
||||
// 判断板材是否存在
|
||||
validateGoodExists(plate.getGoodsId(), organId);
|
||||
|
||||
// 校验板材名称、材质、颜色、厚度、品牌、纹路在组织内唯一
|
||||
// 校验板材名称、材质、颜色、厚度、品牌在组织内唯一
|
||||
validateGoodAttr(plate, organId);
|
||||
|
||||
plateGoodMapper.insert(plate);// 组织id未传输
|
||||
@@ -118,20 +118,17 @@ public class PlateManageServiceImpl implements PlateManageService {
|
||||
throw exception(PLATE_GOODS_ID_NOT_SAME);
|
||||
}
|
||||
|
||||
// 校验板材名称、材质、颜色、厚度、品牌、纹路在组织内唯一
|
||||
// 校验板材名称、材质、颜色、厚度、品牌在组织内唯一
|
||||
validateGoodAttr(updateObj, organId);
|
||||
plateGoodMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
/**
|
||||
* 校验板材名称、材质、颜色、厚度、品牌、纹路在组织内唯一
|
||||
* 校验板材名称、材质、颜色、厚度、品牌在组织内唯一
|
||||
*
|
||||
* @param plate
|
||||
*/
|
||||
private void validateGoodAttr(PlateGoodDO plate, Long organId) {
|
||||
if (ObjectUtil.isNull(plate.getTexture())) {
|
||||
plate.setTexture(false);
|
||||
}
|
||||
Long count = plateGoodMapper.selectCount(new LambdaQueryWrapperX<PlateGoodDO>()
|
||||
.eq(PlateGoodDO::getGoodsName, plate.getGoodsName())
|
||||
.eq(PlateGoodDO::getOrganId, organId)
|
||||
@@ -139,8 +136,7 @@ public class PlateManageServiceImpl implements PlateManageService {
|
||||
.eq(PlateGoodDO::getColor, plate.getColor())
|
||||
.eq(PlateGoodDO::getThickness, plate.getThickness())
|
||||
.eqIfPresent(PlateGoodDO::getBrand, plate.getBrand())
|
||||
.neIfPresent(PlateGoodDO::getId, plate.getId())
|
||||
.eq(PlateGoodDO::getTexture, plate.getTexture()));
|
||||
.neIfPresent(PlateGoodDO::getId, plate.getId()));
|
||||
if (count > 0) {
|
||||
throw exception(PLATE_ATTR_GROUP_EXISTS);
|
||||
}
|
||||
|
||||
+2
-2
@@ -28,10 +28,10 @@
|
||||
</select>
|
||||
|
||||
<select id="getOrgAttrGroup" resultType="java.util.LinkedHashMap">
|
||||
select goods_name, material, color, thickness, brand, texture
|
||||
select goods_name, material, color, thickness, brand
|
||||
from plate
|
||||
where organ_id = #{organId}
|
||||
and deleted = false
|
||||
group by goods_name, material, color, thickness, brand, texture;
|
||||
group by goods_name, material, color, thickness, brand;
|
||||
</select>
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user