Browse Source

ams social modlue test

master
zhangyeguang 3 months ago
parent
commit
36aadb3c1c
  1. 7
      social/src/main/java/com/jiagutech/ams/controller/JobController.java
  2. 19
      social/src/main/java/com/jiagutech/ams/model/request/JobStatusRequest.java
  3. 7
      social/src/main/java/com/jiagutech/ams/service/JobServiceImpl.java
  4. 1
      web/src/main/resources/application.yml

7
social/src/main/java/com/jiagutech/ams/controller/JobController.java

@ -12,6 +12,7 @@ import com.jiagutech.ams.model.dto.JobTypeDTO;
import com.jiagutech.ams.model.dto.TrackImageDTO;
import com.jiagutech.ams.model.request.JobCreateRequest;
import com.jiagutech.ams.model.request.JobPageRequest;
import com.jiagutech.ams.model.request.JobStatusRequest;
import com.jiagutech.ams.model.response.JobCreateResponse;
import com.jiagutech.ams.model.response.JobItem;
import com.jiagutech.ams.model.response.JobTypeItem;
@ -53,9 +54,9 @@ public class JobController {
@Operation(summary = "更新作业状态")
@SaCheckRole(value = {"machinist", "admin"}, mode = SaMode.OR)
@PutMapping("/status")
public R<Void> updateJobStatus(@RequestParam("jobId") String jobId, @RequestParam("status") Integer status) {
jobService.updateJobStatus(Long.parseLong(jobId), status);
@PutMapping(value = "/status", consumes = "application/json")
public R<Void> updateJobStatus(@RequestBody JobStatusRequest request) {
jobService.updateJobStatus(Long.parseLong(request.getJobId()), request.getStatus());
return R.ok();
}

19
social/src/main/java/com/jiagutech/ams/model/request/JobStatusRequest.java

@ -0,0 +1,19 @@
package com.jiagutech.ams.model.request;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.jiagutech.ams.utils.StringToLongDeserializer;
import lombok.Data;
/**
* @ClassName JobPageRequest
* @author: zhangyeguang
* @create: 2024-09-02 15:18
* @Version 1.0
* @description:
**/
@Data
public class JobStatusRequest {
private String jobId;
private Integer status;
}

7
social/src/main/java/com/jiagutech/ams/service/JobServiceImpl.java

@ -29,6 +29,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Optional;
import java.util.function.Predicate;
import java.util.stream.Collectors;
@ -136,7 +137,11 @@ public class JobServiceImpl implements JobService {
List<TrackItem> trackItems = new ArrayList<>(locusList.size());
for (Locus locus : locusList) {
TrackItem trackItem = TrackMapping.INSTANCE.convertToTrackItemByLocus(locus);
trackItem.setImageUrl(trackImageDTOS.stream().filter(t -> t.getTs() == locus.getTimestamp()).findFirst().map(t -> t.getImageUrl()).orElse(null));
Optional<TrackImageDTO> imageDTOOptional = trackImageDTOS.stream().filter(t -> t.getTs() .equals( locus.getTimestamp())).findFirst();
if (imageDTOOptional.isPresent()) {
trackItem.setImageUrl(imageDTOOptional.get().getImageUrl());
}
trackItems.add(trackItem);
}
return trackItems;

1
web/src/main/resources/application.yml

@ -24,6 +24,7 @@ spring:
maxLifetime: 1800000
# 多久检查一次连接的活性
keepaliveTime: 30000
connection-test-query: SELECT 1
data:
redis:
timeout: 10s

Loading…
Cancel
Save