|
|
|
@ -80,6 +80,14 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
|
private static final String NODE_MEDIA_REF_TYPE = "LONGCHUANG_NODE_REPORT_MEDIA"; |
|
|
|
private static final String MEDIA_INFO_VIDEO_STANDARD = "VIDEO_STD_MP4_H264_AAC"; |
|
|
|
private static final String MEDIA_INFO_VIDEO_RAW = "VIDEO_RAW"; |
|
|
|
private static final List<String> PACK_MEDIA_STEP_LIST = Arrays.asList( |
|
|
|
"1平台箱", |
|
|
|
"2门箱", |
|
|
|
"3背景墙箱", |
|
|
|
"4框架箱", |
|
|
|
"5钣金箱", |
|
|
|
"6铝型材箱" |
|
|
|
); |
|
|
|
|
|
|
|
@Autowired |
|
|
|
private ProductionPlanMapper productionPlanMapper; |
|
|
|
@ -216,7 +224,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
|
if (ORDER_TYPE_MACHINING.equals(orderType)) { |
|
|
|
throw new XJException("机加工报工无需上传影像"); |
|
|
|
} |
|
|
|
String logNo = reportOrderNode(data, orderType); |
|
|
|
boolean reportNode = !Boolean.FALSE.equals(data.getReportNode()); |
|
|
|
String logNo = reportNode ? reportOrderNode(data, orderType) : validateMediaUploadOnly(data, orderType); |
|
|
|
saveNodeReportMedia(data, orderType, logNo, files); |
|
|
|
return logNo; |
|
|
|
} |
|
|
|
@ -945,6 +954,56 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
|
.collect(Collectors.toList()); |
|
|
|
} |
|
|
|
|
|
|
|
private String validateMediaUploadOnly(ProductionPlanNodeReportData data, String orderType) { |
|
|
|
if (data == null || !StringUtils.hasText(data.getOrderNo()) || !StringUtils.hasText(data.getNodeCode())) { |
|
|
|
throw new I18nException("lc.production.report.param.incomplete"); |
|
|
|
} |
|
|
|
ProductionPlanOrderRowData order = productionPlanMapper.queryOrderByOrderNo(data.getOrderNo(), orderType); |
|
|
|
if (order == null) { |
|
|
|
throw new I18nException("lc.production.order.not.exists.or.deleted"); |
|
|
|
} |
|
|
|
if (STATUS_DONE.equals(order.getStatus())) { |
|
|
|
throw new I18nException("lc.production.order.done.cannot.report"); |
|
|
|
} |
|
|
|
if (ORDER_TYPE_CABLE_COP.equals(orderType)) { |
|
|
|
String allowedNodeCode = resolveCableCopNodeCodeByTaskType(order.getTaskType()); |
|
|
|
if (StringUtils.hasText(allowedNodeCode) && !allowedNodeCode.equals(data.getNodeCode())) { |
|
|
|
throw new XJException("当前任务类型仅允许报工节点:" + resolveCableCopNodeNameByNodeCode(allowedNodeCode)); |
|
|
|
} |
|
|
|
} |
|
|
|
ProductionPlanOrderNodeData node = productionPlanMapper.queryOrderNodeByCode(data.getOrderNo(), data.getNodeCode()); |
|
|
|
if (node == null) { |
|
|
|
throw new I18nException("lc.production.report.node.not.exists"); |
|
|
|
} |
|
|
|
String nodeReportMode = normalizeNodeReportMode(order.getNodeReportMode()); |
|
|
|
if (NODE_REPORT_MODE_SEQUENTIAL.equals(nodeReportMode)) { |
|
|
|
List<ProductionPlanOrderNodeData> nodeList = productionPlanMapper.queryOrderNodeList(Collections.singletonList(data.getOrderNo())); |
|
|
|
ProductionPlanOrderNodeData firstUnDoneNode = null; |
|
|
|
for (ProductionPlanOrderNodeData item : nodeList) { |
|
|
|
if (!NODE_STATUS_DONE.equals(item.getStatus())) { |
|
|
|
firstUnDoneNode = item; |
|
|
|
break; |
|
|
|
} |
|
|
|
} |
|
|
|
if (firstUnDoneNode != null && !firstUnDoneNode.getNodeCode().equals(data.getNodeCode())) { |
|
|
|
throw new I18nException("lc.production.report.sequential.need.first.node", firstUnDoneNode.getNodeName()); |
|
|
|
} |
|
|
|
} |
|
|
|
if (NODE_STATUS_DONE.equals(node.getStatus())) { |
|
|
|
throw new I18nException("lc.production.node.already.done"); |
|
|
|
} |
|
|
|
checkNodeRolePermission(orderType, data.getNodeCode()); |
|
|
|
checkNodeAssigneePermission(data.getOrderNo(), orderType, data.getNodeCode()); |
|
|
|
Long userId = getCurrentUserId(); |
|
|
|
String userName = getCurrentUserName(); |
|
|
|
data.setOrderType(orderType); |
|
|
|
data.setProjectNo(order.getProjectNo()); |
|
|
|
data.setNodeName(node.getNodeName()); |
|
|
|
data.setReportUserId(userId); |
|
|
|
data.setReportUserName(userName); |
|
|
|
return generateLogNo(orderType); |
|
|
|
} |
|
|
|
|
|
|
|
private String reportOrderNode(ProductionPlanNodeReportData data, String orderType) { |
|
|
|
if (data == null || !StringUtils.hasText(data.getOrderNo()) || !StringUtils.hasText(data.getNodeCode())) { |
|
|
|
throw new I18nException("lc.production.report.param.incomplete"); |
|
|
|
@ -1026,6 +1085,7 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
|
if (node == null) { |
|
|
|
throw new I18nException("lc.production.report.node.not.exists"); |
|
|
|
} |
|
|
|
String mediaStep = resolveMediaStep(data, node); |
|
|
|
String rootPath = StringUtils.hasText(workReportMediaRootPath) ? workReportMediaRootPath : "D:\\longchuang"; |
|
|
|
File rootDir = new File(rootPath); |
|
|
|
if (!rootDir.exists() && !rootDir.mkdirs()) { |
|
|
|
@ -1101,6 +1161,9 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
|
ossEntity.setOrderRef5(String.valueOf(userId)); |
|
|
|
ossEntity.setOrderRef6(node.getNodeName()); |
|
|
|
ossEntity.setOrderReftype(NODE_MEDIA_REF_TYPE); |
|
|
|
if (StringUtils.hasText(mediaStep)) { |
|
|
|
ossEntity.setOrderRef6(mediaStep); |
|
|
|
} |
|
|
|
String mediaAdditionalInfo = resolveMediaCategory(file.getContentType()); |
|
|
|
if (videoFile) { |
|
|
|
mediaAdditionalInfo = transcodeVideo ? MEDIA_INFO_VIDEO_STANDARD : MEDIA_INFO_VIDEO_RAW; |
|
|
|
@ -1128,6 +1191,29 @@ public class ProductionPlanServiceImpl implements ProductionPlanService { |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
private String resolveMediaStep(ProductionPlanNodeReportData data, ProductionPlanOrderNodeData node) { |
|
|
|
if (node == null) { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
String nodeCode = StringUtils.hasText(node.getNodeCode()) ? node.getNodeCode().trim() : ""; |
|
|
|
String nodeName = StringUtils.hasText(node.getNodeName()) ? node.getNodeName().replaceAll("\\s+", "") : ""; |
|
|
|
boolean packNode = "pack".equals(nodeCode) || "打包".equals(nodeName); |
|
|
|
if (!packNode) { |
|
|
|
return ""; |
|
|
|
} |
|
|
|
String mediaStep = data == null ? "" : data.getMediaStep(); |
|
|
|
if (!StringUtils.hasText(mediaStep)) { |
|
|
|
throw new XJException("请先选择打包步骤"); |
|
|
|
} |
|
|
|
String normalizedStep = mediaStep.replaceAll("\\s+", ""); |
|
|
|
for (String step : PACK_MEDIA_STEP_LIST) { |
|
|
|
if (step.replaceAll("\\s+", "").equals(normalizedStep)) { |
|
|
|
return step; |
|
|
|
} |
|
|
|
} |
|
|
|
throw new XJException("打包步骤不正确,请重新选择"); |
|
|
|
} |
|
|
|
|
|
|
|
private String sanitizeFolderName(String folderName) { |
|
|
|
if (!StringUtils.hasText(folderName)) { |
|
|
|
return ""; |
|
|
|
|