| | |
| | | import org.activiti.engine.task.Task; |
| | | import org.apache.commons.lang3.StringUtils; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import javax.servlet.http.HttpSession; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.*; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | IMaintainService maintainService; |
| | | @Autowired |
| | | ITUserService userService; |
| | | |
| | | @Value("${img.url}") |
| | | String basePath; |
| | | |
| | | @RequestMapping(value = "/list", method = RequestMethod.GET) |
| | | public Result<List<Map<String, Object>>> list(HttpServletRequest request) throws FileNotFoundException { |
| | |
| | | List<Map<String, Object>> list = flowsMapper.selectVersion(filterSegment); |
| | | for (Map<String, Object> one : list) { |
| | | String newModelId = (String) one.get(Constant.ID); |
| | | String url = "processes/" + newModelId + "/" + newModelId + ".png"; |
| | | String url = "act/img/" + newModelId; |
| | | one.put("imgurl",url); |
| | | } |
| | | return Result.success(list); |
| | | } |
| | | @RequestMapping(value = "/img/{modelId}", method = RequestMethod.GET) |
| | | public void image(@PathVariable String modelId, HttpServletResponse response) { |
| | | String filePath = basePath + modelId +"/"+ modelId + ".png"; |
| | | File file = new File(filePath); |
| | | FileInputStream fileInputStream = null; |
| | | response.setHeader("Content-Type", "image/png"); |
| | | try{ |
| | | fileInputStream = new FileInputStream(file); |
| | | OutputStream outputStream = response.getOutputStream(); |
| | | byte[] b = new byte[1024]; |
| | | int len; |
| | | while ((len = fileInputStream.read(b, 0, 1024)) != -1) { |
| | | outputStream.write(b, 0, len); |
| | | } |
| | | } |
| | | catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } |
| | | finally { |
| | | if (fileInputStream != null) { |
| | | try { |
| | | fileInputStream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | @RequestMapping(value = "/deleteModel/{modelId}", method = RequestMethod.GET) |
| | | public Result deleteModel(@PathVariable String modelId) { |
| | | boolean b = repositoryService.deleteModel(modelId); |
| | | if (b) { |
| | | return Result.success(null); |
| | | } else { |
| | | return Result.error(CodeMsg.DELETE_ERROR); |
| | | } |
| | | } |
| | | @RequestMapping(value = "/processlist", method = RequestMethod.GET) |
| | | public Result<Result<JSONArray>> processlist(HttpServletRequest request) { |
| | | Result<JSONArray> processList = repositoryService.getProcessList(); |
| | |
| | | } else { |
| | | flows.setStatus(ActivitiStatus.open); |
| | | } |
| | | |
| | | if (!pass) { |
| | | flows.setStatus(ActivitiStatus.close); |
| | | } |
| | | |
| | | if (flows.getBusinessType().equals(ActivitiBusinessType.maintain)){ |
| | | String maintainId = flows.getBusinessId(); |
| | | maintainService.dealFlow(maintainId, flows.getStatus()); |