TASK:male sketch style逻辑添加;
This commit is contained in:
@@ -6,6 +6,7 @@ import com.ai.da.common.utils.SendEmailUtil;
|
|||||||
import com.ai.da.mapper.primary.*;
|
import com.ai.da.mapper.primary.*;
|
||||||
import com.ai.da.mapper.primary.entity.*;
|
import com.ai.da.mapper.primary.entity.*;
|
||||||
import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
|
import com.ai.da.mapper.secondary.AttributeRetrievalMapper;
|
||||||
|
import com.ai.da.model.enums.StyleEnum;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||||
import lombok.extern.slf4j.Slf4j;
|
import lombok.extern.slf4j.Slf4j;
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
@@ -220,29 +221,47 @@ public class MyTaskScheduler {
|
|||||||
private AttributeRetrievalMapper attributeRetrievalMapper;
|
private AttributeRetrievalMapper attributeRetrievalMapper;
|
||||||
|
|
||||||
public void addSystemFileStyle() {
|
public void addSystemFileStyle() {
|
||||||
ExecutorService executorService = Executors.newFixedThreadPool(5);
|
// ExecutorService executorService = Executors.newFixedThreadPool(5);
|
||||||
|
|
||||||
try {
|
// try {
|
||||||
String[] filePaths = {
|
// String[] filePaths = {
|
||||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Blouse style output updated25.6.2024.xlsx",
|
// "C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens bottom style output.xlsx",
|
||||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Dress style output updated25.6.2024.xlsx",
|
// "C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens outer style output.xlsx",
|
||||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Outerwear style output.xlsx",
|
// "C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens top style output.xlsx"
|
||||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Skirt style output .xlsx",
|
//// "/workspace/shb/Mens_bottom_style_output.xlsx",
|
||||||
"C:\\Users\\10233\\Documents\\WeChat Files\\wxid_h7l9im0r8ql922\\FileStorage\\File\\2024-06\\style\\Trousers style output.xlsx"
|
//// "/workspace/shb/Mens_outer_style_output.xlsx",
|
||||||
};
|
//// "/workspace/shb/Mens_top_style_output.xlsx"
|
||||||
|
// };
|
||||||
|
//
|
||||||
|
// for (String filePath : filePaths) {
|
||||||
|
//// executorService.submit(() -> processExcelFile(filePath));
|
||||||
|
// processExcelFile(filePath);
|
||||||
|
// }
|
||||||
|
// }catch (Exception e) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
|
// } finally {
|
||||||
|
// executorService.shutdown();
|
||||||
|
// try {
|
||||||
|
// if (!executorService.awaitTermination(60, TimeUnit.MINUTES)) {
|
||||||
|
// executorService.shutdownNow();
|
||||||
|
// }
|
||||||
|
// } catch (InterruptedException e) {
|
||||||
|
// executorService.shutdownNow();
|
||||||
|
// }
|
||||||
|
// }
|
||||||
|
String[] filePaths = {
|
||||||
|
"C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens bottom style output.xlsx",
|
||||||
|
"C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens outer style output.xlsx",
|
||||||
|
"C:\\Users\\10233\\Downloads\\OneDrive_1_2024-10-3\\Mens top style output.xlsx"
|
||||||
|
// "/workspace/shb/Mens_bottom_style_output.xlsx",
|
||||||
|
// "/workspace/shb/Mens_outer_style_output.xlsx",
|
||||||
|
// "/workspace/shb/Mens_top_style_output.xlsx"
|
||||||
|
};
|
||||||
|
|
||||||
for (String filePath : filePaths) {
|
for (String filePath : filePaths) {
|
||||||
executorService.submit(() -> processExcelFile(filePath));
|
// executorService.submit(() -> processExcelFile(filePath));
|
||||||
}
|
processExcelFile(filePath);
|
||||||
} finally {
|
|
||||||
executorService.shutdown();
|
|
||||||
try {
|
|
||||||
if (!executorService.awaitTermination(60, TimeUnit.MINUTES)) {
|
|
||||||
executorService.shutdownNow();
|
|
||||||
}
|
|
||||||
} catch (InterruptedException e) {
|
|
||||||
executorService.shutdownNow();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -264,6 +283,37 @@ public class MyTaskScheduler {
|
|||||||
attributeRetrievalMapper.updateStyleByFileName("X", prefix + fileName, tableName);
|
attributeRetrievalMapper.updateStyleByFileName("X", prefix + fileName, tableName);
|
||||||
System.out.println(fileName);
|
System.out.println(fileName);
|
||||||
} else {
|
} else {
|
||||||
|
// if (style.equals("Y2K 风")) {
|
||||||
|
// StyleEnum.COUNTRY_STYLE
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }else if (style.equals("")) {
|
||||||
|
//
|
||||||
|
// }
|
||||||
attributeRetrievalMapper.updateStyleByFileName(style, prefix + fileName, tableName);
|
attributeRetrievalMapper.updateStyleByFileName(style, prefix + fileName, tableName);
|
||||||
System.out.println(fileName);
|
System.out.println(fileName);
|
||||||
}
|
}
|
||||||
@@ -285,6 +335,12 @@ public class MyTaskScheduler {
|
|||||||
return "female_skirt";
|
return "female_skirt";
|
||||||
} else if (filePath.contains("Trousers")) {
|
} else if (filePath.contains("Trousers")) {
|
||||||
return "female_pants";
|
return "female_pants";
|
||||||
|
} else if (filePath.contains("bottom")) {
|
||||||
|
return "male_bottom";
|
||||||
|
} else if (filePath.contains("outer")) {
|
||||||
|
return "male_outwear";
|
||||||
|
} else if (filePath.contains("top")) {
|
||||||
|
return "male_top";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
@@ -300,6 +356,12 @@ public class MyTaskScheduler {
|
|||||||
return "skirt/";
|
return "skirt/";
|
||||||
} else if (filePath.contains("Trousers")) {
|
} else if (filePath.contains("Trousers")) {
|
||||||
return "trousers/";
|
return "trousers/";
|
||||||
|
} else if (filePath.contains("bottom")) {
|
||||||
|
return "bottom/";
|
||||||
|
} else if (filePath.contains("outer")) {
|
||||||
|
return "outer/";
|
||||||
|
} else if (filePath.contains("top")) {
|
||||||
|
return "top/";
|
||||||
}
|
}
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.ai.da.common.utils;
|
package com.ai.da.common.utils;
|
||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
import org.apache.poi.ss.usermodel.Cell;
|
||||||
import org.apache.poi.ss.usermodel.Row;
|
import org.apache.poi.ss.usermodel.Row;
|
||||||
import org.apache.poi.ss.usermodel.Sheet;
|
import org.apache.poi.ss.usermodel.Sheet;
|
||||||
import org.apache.poi.ss.usermodel.Workbook;
|
import org.apache.poi.ss.usermodel.Workbook;
|
||||||
@@ -23,9 +24,28 @@ public class ExcelReader {
|
|||||||
for (int i = 0; i < numberOfColumns; i++) {
|
for (int i = 0; i < numberOfColumns; i++) {
|
||||||
List<String> columnData = new ArrayList<>();
|
List<String> columnData = new ArrayList<>();
|
||||||
for (Row row : sheet) {
|
for (Row row : sheet) {
|
||||||
columnData.add(row.getCell(i).getStringCellValue());
|
Cell cell = row.getCell(i);
|
||||||
|
if (cell != null) {
|
||||||
|
switch (cell.getCellType()) {
|
||||||
|
case STRING:
|
||||||
|
columnData.add(cell.getStringCellValue());
|
||||||
|
break;
|
||||||
|
case NUMERIC:
|
||||||
|
columnData.add(String.valueOf(cell.getNumericCellValue()));
|
||||||
|
break;
|
||||||
|
case BOOLEAN:
|
||||||
|
columnData.add(String.valueOf(cell.getBooleanCellValue()));
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
// 跳过空单元格或其他类型(比如错误类型)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 只有当这一列有数据时,才添加到结果列表中
|
||||||
|
if (!columnData.isEmpty()) {
|
||||||
|
data.add(columnData);
|
||||||
}
|
}
|
||||||
data.add(columnData);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return data;
|
return data;
|
||||||
|
|||||||
@@ -17,11 +17,11 @@ import java.util.List;
|
|||||||
public interface AttributeRetrievalMapper {
|
public interface AttributeRetrievalMapper {
|
||||||
|
|
||||||
|
|
||||||
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style, @Param("isFemaleTable") boolean isFemaleTable);
|
List<AttributeRetrieval> getSystemSketchPool(@Param("attributeRetrievalAttrDict") AttributeRetrieval attributeRetrievalAttrDict, @Param("tableName") String tableName, @Param("poolNum") int poolNum, @Param("style") String style);
|
||||||
|
|
||||||
AttributeRetrieval getSystemRandom(String tableName, String style, boolean isFemaleTable);
|
AttributeRetrieval getSystemRandom(String tableName, String style);
|
||||||
|
|
||||||
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style, boolean isFemaleTable);
|
List<AttributeRetrieval> getSystemSketchPoolBySameCategory(AttributeRetrieval attributeRetrievalAttrDict, String tableName, String style);
|
||||||
|
|
||||||
Long getIdByFileName(String fileName, String tableName);
|
Long getIdByFileName(String fileName, String tableName);
|
||||||
|
|
||||||
|
|||||||
@@ -646,22 +646,18 @@ public class PythonService {
|
|||||||
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
|
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
|
||||||
String tableName;
|
String tableName;
|
||||||
tableName = getTableName(modelSex, styleCategory);
|
tableName = getTableName(modelSex, styleCategory);
|
||||||
boolean isFemaleTable = false;
|
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||||
if (tableName.contains("female")) {
|
|
||||||
isFemaleTable = true;
|
|
||||||
}
|
|
||||||
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
|
|
||||||
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
||||||
attributeRetrievalAttrDict.setDesign(null);
|
attributeRetrievalAttrDict.setDesign(null);
|
||||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
|
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
||||||
attributeRetrievalAttrDict.setSilhouette(null);
|
attributeRetrievalAttrDict.setSilhouette(null);
|
||||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
|
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||||
}
|
}
|
||||||
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
if (CollectionUtil.isEmpty(attributeRetrievalList) || attributeRetrievalList.size() < poolNum) {
|
||||||
style = null;
|
style = null;
|
||||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style, isFemaleTable);
|
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPool(attributeRetrievalAttrDict, tableName, poolNum, style);
|
||||||
}
|
}
|
||||||
return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex);
|
return toColoectionElementList(attributeRetrievalList, styleCategory, modelSex);
|
||||||
}
|
}
|
||||||
@@ -680,10 +676,7 @@ public class PythonService {
|
|||||||
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
|
AttributeRetrieval attributeRetrievalAttrDict = toAttrDict(attrDictJSON);
|
||||||
String tableName;
|
String tableName;
|
||||||
tableName = getTableName(modelSex, styleCategory);
|
tableName = getTableName(modelSex, styleCategory);
|
||||||
boolean isFemaleTable = false;
|
|
||||||
if (tableName.contains("female")) {
|
|
||||||
isFemaleTable = true;
|
|
||||||
}
|
|
||||||
// 存储非空字段的列表
|
// 存储非空字段的列表
|
||||||
List<String> nonNullFields = new ArrayList<>();
|
List<String> nonNullFields = new ArrayList<>();
|
||||||
if (attributeRetrievalAttrDict.getType() != null) {
|
if (attributeRetrievalAttrDict.getType() != null) {
|
||||||
@@ -725,7 +718,7 @@ public class PythonService {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
|
List<AttributeRetrieval> attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style);
|
||||||
if (CollectionUtil.isEmpty(attributeRetrievalList)) {
|
if (CollectionUtil.isEmpty(attributeRetrievalList)) {
|
||||||
System.out.println(attributeRetrievalAttrDict);
|
System.out.println(attributeRetrievalAttrDict);
|
||||||
System.out.println(tableName);
|
System.out.println(tableName);
|
||||||
@@ -733,12 +726,12 @@ public class PythonService {
|
|||||||
attributeRetrievalAttrDict.setType(null);
|
attributeRetrievalAttrDict.setType(null);
|
||||||
attributeRetrievalAttrDict.setOpeningType(null);
|
attributeRetrievalAttrDict.setOpeningType(null);
|
||||||
attributeRetrievalAttrDict.setSubtype(null);
|
attributeRetrievalAttrDict.setSubtype(null);
|
||||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
|
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (CollectionUtil.isEmpty(attributeRetrievalList)) {
|
if (CollectionUtil.isEmpty(attributeRetrievalList)) {
|
||||||
style = null;
|
style = null;
|
||||||
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style, isFemaleTable);
|
attributeRetrievalList = attributeRetrievalMapper.getSystemSketchPoolBySameCategory(attributeRetrievalAttrDict, tableName, style);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -960,11 +953,7 @@ public class PythonService {
|
|||||||
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
||||||
String category = dressings.get(randomNum).getStyleCategory();
|
String category = dressings.get(randomNum).getStyleCategory();
|
||||||
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||||
boolean isFemaleTable = false;
|
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||||
if (tableName.contains("female")) {
|
|
||||||
isFemaleTable = true;
|
|
||||||
}
|
|
||||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle(), isFemaleTable);
|
|
||||||
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||||
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||||
}
|
}
|
||||||
@@ -1004,11 +993,8 @@ public class PythonService {
|
|||||||
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
Integer randomNum = RandomsUtil.randomSysFile(dressings.size());
|
||||||
String category = dressings.get(randomNum).getStyleCategory();
|
String category = dressings.get(randomNum).getStyleCategory();
|
||||||
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
String tableName = getTableName(validateElementVO.getModelSex(), category);
|
||||||
boolean isFemaleTable = false;
|
|
||||||
if (tableName.contains("female")) {
|
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle());
|
||||||
isFemaleTable = true;
|
|
||||||
}
|
|
||||||
AttributeRetrieval attributeRetrieval = attributeRetrievalMapper.getSystemRandom(tableName, validateElementVO.getStyle(), isFemaleTable);
|
|
||||||
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
CollectionElement collectionElement = toCollectionElement(attributeRetrieval, category, validateElementVO.getModelSex());
|
||||||
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
return coverSketchToDesignPythonItem(null, collectionElement, validateElementVO);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -32,9 +32,7 @@
|
|||||||
<if test="style != null">
|
<if test="style != null">
|
||||||
AND style = #{style}
|
AND style = #{style}
|
||||||
</if>
|
</if>
|
||||||
<if test="isFemaleTable">
|
AND deprecated = 0
|
||||||
AND deprecated = 0
|
|
||||||
</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
RAND()
|
RAND()
|
||||||
@@ -50,9 +48,7 @@
|
|||||||
<if test="style != null">
|
<if test="style != null">
|
||||||
AND style = #{style}
|
AND style = #{style}
|
||||||
</if>
|
</if>
|
||||||
<if test="isFemaleTable">
|
AND deprecated = 0
|
||||||
AND deprecated = 0
|
|
||||||
</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
RAND()
|
RAND()
|
||||||
@@ -77,9 +73,7 @@
|
|||||||
<if test="style != null">
|
<if test="style != null">
|
||||||
AND style = #{style}
|
AND style = #{style}
|
||||||
</if>
|
</if>
|
||||||
<if test="isFemaleTable">
|
AND deprecated = 0
|
||||||
AND deprecated = 0
|
|
||||||
</if>
|
|
||||||
</trim>
|
</trim>
|
||||||
ORDER BY
|
ORDER BY
|
||||||
RAND()
|
RAND()
|
||||||
@@ -106,6 +100,6 @@
|
|||||||
SET
|
SET
|
||||||
style = #{style}
|
style = #{style}
|
||||||
WHERE
|
WHERE
|
||||||
image_name = #{fileName}
|
img_name = #{fileName}
|
||||||
</update>
|
</update>
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user