|
|
@ -1,16 +1,16 @@ |
|
|
|
package com.dreamworks.boditech.controller; |
|
|
|
import com.dreamworks.boditech.controller.entity.ApiResponse; |
|
|
|
import com.dreamworks.boditech.entity.ParamFindById; |
|
|
|
import com.dreamworks.boditech.entity.Project; |
|
|
|
import com.dreamworks.boditech.service.ProjectService; |
|
|
|
import com.dreamworks.boditech.utils.MyCommon; |
|
|
|
import jakarta.annotation.Resource; |
|
|
|
import org.springframework.stereotype.Controller; |
|
|
|
import org.springframework.web.bind.annotation.PostMapping; |
|
|
|
import org.springframework.web.bind.annotation.ResponseBody; |
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
|
import java.util.List; |
|
|
|
import java.util.Map; |
|
|
|
|
|
|
|
@Controller |
|
|
|
public class ProjectController extends BaseController { |
|
|
|
@Resource |
|
|
@ -25,17 +25,16 @@ public class ProjectController extends BaseController { |
|
|
|
@ResponseBody |
|
|
|
@PostMapping("/api/project/active-list") |
|
|
|
public ApiResponse activeList() { |
|
|
|
String[] colors = new String[]{"red", "green", "blue", "yellow", "purple", "orange"}; |
|
|
|
String[] names = new String[]{"hsCRP", "NT-proBNP", "D-Dimer", "PCT", "cTnI", "CK-MB"}; |
|
|
|
List<Project> projects = this.projectService.activeProjectGetAll(); |
|
|
|
List<Integer> projectIds = new ArrayList<>(); |
|
|
|
List<Map<String,Object>> list = new ArrayList<>(); |
|
|
|
for ( int i=0; i<6; i++ ) { |
|
|
|
Map<String,Object> item = Map.of( |
|
|
|
"id", i, |
|
|
|
"name", names[i], |
|
|
|
"color", colors[i], |
|
|
|
"maxAmount", 25, |
|
|
|
"availableAmount", i |
|
|
|
); |
|
|
|
for ( Project project : projects ) { |
|
|
|
if ( projectIds.contains(project.id) ) { |
|
|
|
continue ; |
|
|
|
} |
|
|
|
|
|
|
|
projectIds.add(project.id); |
|
|
|
Map<String,Object> item = MyCommon.objectToMap(project); |
|
|
|
list.add(item); |
|
|
|
} |
|
|
|
return this.success(list); |
|
|
|