forked from ezreal/BI-FR-MIX-FRONT
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
51 lines
2.0 KiB
51 lines
2.0 KiB
package com.fr.plugin.bi.fusion.web.handler; |
|
|
|
import com.fr.decision.webservice.Response; |
|
import com.fr.decision.webservice.annotation.LoginStatusChecker; |
|
import com.fr.decision.webservice.v10.login.TokenResource; |
|
import com.fr.io.repository.FineFileEntry; |
|
import com.fr.io.utils.ResourceIOUtils; |
|
import com.fr.plugin.bi.fusion.web.handler.bean.ReportItemBean; |
|
import com.fr.third.springframework.stereotype.Controller; |
|
import com.fr.third.springframework.web.bind.annotation.RequestMapping; |
|
import com.fr.third.springframework.web.bind.annotation.RequestMethod; |
|
import com.fr.third.springframework.web.bind.annotation.RequestParam; |
|
import com.fr.third.springframework.web.bind.annotation.ResponseBody; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
import javax.servlet.http.HttpServletResponse; |
|
import java.util.ArrayList; |
|
import java.util.List; |
|
|
|
/** |
|
* @Author ezreal |
|
* @Date 2023/5/22 21:29 |
|
* @Version 10.0 |
|
*/ |
|
|
|
@Controller |
|
@LoginStatusChecker(required = true, |
|
tokenResource = TokenResource.COOKIE |
|
) |
|
@RequestMapping("/front/subject") |
|
public class SubjectReportResouce { |
|
@RequestMapping(value = "/report", |
|
method = {RequestMethod.GET}) |
|
@ResponseBody |
|
public Response getSubjectCpt(HttpServletRequest req, HttpServletResponse res, @RequestParam(value = "subjectid") String subjectid) throws Exception { |
|
List<ReportItemBean> itemBeans = new ArrayList<>(); |
|
FineFileEntry[] fineFileEntries = ResourceIOUtils.listEntry("/reportlets/" + subjectid); |
|
for (FineFileEntry fineFileEntry : fineFileEntries) { |
|
if (fineFileEntry.isDirectory()) { |
|
continue; |
|
} |
|
String name = fineFileEntry.getName(); |
|
if (name.endsWith(".cpt")) { |
|
itemBeans.add(new ReportItemBean(name, name.substring(0, name.lastIndexOf(".")), "cpt")); |
|
} else if (name.endsWith(".frm")) { |
|
itemBeans.add(new ReportItemBean(name, name.substring(0, name.lastIndexOf(".")), "frm")); |
|
} |
|
} |
|
return Response.ok(itemBeans); |
|
} |
|
}
|
|
|