Browse Source

仅上传

master
han\hanst 4 weeks ago
parent
commit
274a540224
  1. 3
      src/main/java/com/xujie/sys/modules/longchuang/controller/ProductionPlanController.java
  2. 2
      src/main/java/com/xujie/sys/modules/longchuang/data/ProductionPlanNodeReportData.java
  3. 88
      src/main/java/com/xujie/sys/modules/longchuang/service/impl/ProductionPlanServiceImpl.java
  4. 2
      src/main/java/com/xujie/sys/modules/oss/service/impl/SysOssServiceImpl.java

3
src/main/java/com/xujie/sys/modules/longchuang/controller/ProductionPlanController.java

@ -150,7 +150,8 @@ public class ProductionPlanController {
public R reportNodeWithMedia(@ModelAttribute ProductionPlanNodeReportData data, public R reportNodeWithMedia(@ModelAttribute ProductionPlanNodeReportData data,
@RequestParam("file") MultipartFile[] files) { @RequestParam("file") MultipartFile[] files) {
String logNo = productionPlanService.reportNodeWithMedia(data, files); String logNo = productionPlanService.reportNodeWithMedia(data, files);
return R.ok().put("msg", "报工并上传成功").put("logNo", logNo);
boolean reportNode = data == null || !Boolean.FALSE.equals(data.getReportNode());
return R.ok().put("msg", reportNode ? "报工并上传成功" : "影像上传成功").put("logNo", logNo);
} }
@PostMapping("/machiningTask/delete") @PostMapping("/machiningTask/delete")

2
src/main/java/com/xujie/sys/modules/longchuang/data/ProductionPlanNodeReportData.java

@ -15,6 +15,8 @@ public class ProductionPlanNodeReportData {
private String nodeName; private String nodeName;
private BigDecimal reportQty; private BigDecimal reportQty;
private String remark; private String remark;
private Boolean reportNode;
private String mediaStep;
private Long reportUserId; private Long reportUserId;
private String reportUserName; private String reportUserName;
} }

88
src/main/java/com/xujie/sys/modules/longchuang/service/impl/ProductionPlanServiceImpl.java

@ -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 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_STANDARD = "VIDEO_STD_MP4_H264_AAC";
private static final String MEDIA_INFO_VIDEO_RAW = "VIDEO_RAW"; 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 @Autowired
private ProductionPlanMapper productionPlanMapper; private ProductionPlanMapper productionPlanMapper;
@ -216,7 +224,8 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
if (ORDER_TYPE_MACHINING.equals(orderType)) { if (ORDER_TYPE_MACHINING.equals(orderType)) {
throw new XJException("机加工报工无需上传影像"); 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); saveNodeReportMedia(data, orderType, logNo, files);
return logNo; return logNo;
} }
@ -945,6 +954,56 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
.collect(Collectors.toList()); .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) { private String reportOrderNode(ProductionPlanNodeReportData data, String orderType) {
if (data == null || !StringUtils.hasText(data.getOrderNo()) || !StringUtils.hasText(data.getNodeCode())) { if (data == null || !StringUtils.hasText(data.getOrderNo()) || !StringUtils.hasText(data.getNodeCode())) {
throw new I18nException("lc.production.report.param.incomplete"); throw new I18nException("lc.production.report.param.incomplete");
@ -1026,6 +1085,7 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
if (node == null) { if (node == null) {
throw new I18nException("lc.production.report.node.not.exists"); throw new I18nException("lc.production.report.node.not.exists");
} }
String mediaStep = resolveMediaStep(data, node);
String rootPath = StringUtils.hasText(workReportMediaRootPath) ? workReportMediaRootPath : "D:\\longchuang"; String rootPath = StringUtils.hasText(workReportMediaRootPath) ? workReportMediaRootPath : "D:\\longchuang";
File rootDir = new File(rootPath); File rootDir = new File(rootPath);
if (!rootDir.exists() && !rootDir.mkdirs()) { if (!rootDir.exists() && !rootDir.mkdirs()) {
@ -1101,6 +1161,9 @@ public class ProductionPlanServiceImpl implements ProductionPlanService {
ossEntity.setOrderRef5(String.valueOf(userId)); ossEntity.setOrderRef5(String.valueOf(userId));
ossEntity.setOrderRef6(node.getNodeName()); ossEntity.setOrderRef6(node.getNodeName());
ossEntity.setOrderReftype(NODE_MEDIA_REF_TYPE); ossEntity.setOrderReftype(NODE_MEDIA_REF_TYPE);
if (StringUtils.hasText(mediaStep)) {
ossEntity.setOrderRef6(mediaStep);
}
String mediaAdditionalInfo = resolveMediaCategory(file.getContentType()); String mediaAdditionalInfo = resolveMediaCategory(file.getContentType());
if (videoFile) { if (videoFile) {
mediaAdditionalInfo = transcodeVideo ? MEDIA_INFO_VIDEO_STANDARD : MEDIA_INFO_VIDEO_RAW; 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) { private String sanitizeFolderName(String folderName) {
if (!StringUtils.hasText(folderName)) { if (!StringUtils.hasText(folderName)) {
return ""; return "";

2
src/main/java/com/xujie/sys/modules/oss/service/impl/SysOssServiceImpl.java

@ -276,7 +276,7 @@ public class SysOssServiceImpl extends ServiceImpl<SysOssDao, SysOssEntity> impl
return lambdaQuery() return lambdaQuery()
.eq(SysOssEntity::getOrderRef1, oss.getOrderRef1()) .eq(SysOssEntity::getOrderRef1, oss.getOrderRef1())
.eq(SysOssEntity::getOrderRef2, oss.getOrderRef2()) .eq(SysOssEntity::getOrderRef2, oss.getOrderRef2())
.eq(SysOssEntity::getOrderRef3, oss.getOrderRef3())
.eq(StringUtils.isNotBlank(oss.getOrderRef3()), SysOssEntity::getOrderRef3, oss.getOrderRef3())
.list(); .list();
} }

Loading…
Cancel
Save