| | |
| | | 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.*; |
| | | import java.io.FileNotFoundException; |
| | | import java.io.IOException; |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | |
| | | IMaintainService maintainService; |
| | | @Autowired |
| | | ITUserService userService; |
| | | @Autowired |
| | | IMasterModifiedService masterModifiedService; |
| | | |
| | | @Autowired |
| | | IMaintainFieldService maintainFieldService; |
| | | @Value("${img.url}") |
| | | String basePath; |
| | | |
| | | |
| | | @RequestMapping(value = "/list", method = RequestMethod.GET) |
| | | public Result<List<Map<String, Object>>> list(HttpServletRequest request) throws FileNotFoundException { |
| | |
| | | } |
| | | @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; |
| | | InputStream is = repositoryService.getModelImg(modelId); |
| | | |
| | | 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) { |
| | | while ((len = is.read(b, 0, 1024)) != -1) { |
| | | outputStream.write(b, 0, len); |
| | | } |
| | | } |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | finally { |
| | | if (fileInputStream != null) { |
| | | if (is != null) { |
| | | try { |
| | | fileInputStream.close(); |
| | | is.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | |
| | | return Result.error(CodeMsg.ERROR_PARAMS_NOT_MATHED); |
| | | } |
| | | HttpSession session = request.getSession(); |
| | | //todo 判断当前task是否是当前人能审批的 |
| | | |
| | | taskService.setSession(session); |
| | | ActivitiStatus status = flows.getStatus(); |
| | |
| | | flows.setStatus(ActivitiStatus.close); |
| | | } |
| | | |
| | | if (flows.getBusinessType().equals(ActivitiBusinessType.maintain)){ |
| | | String maintainId = flows.getBusinessId(); |
| | | maintainService.dealFlow(maintainId, flows.getStatus()); |
| | | } |
| | | if (flows.getBusinessType().equals(ActivitiBusinessType.field)){ |
| | | String maintainId = flows.getBusinessId(); |
| | | maintainFieldService.dealFlow(maintainId, flows.getStatus()); |
| | | } |
| | | |
| | | flowsService.aduitFinish(flows); |
| | | |
| | | } else { |
| | | if (pass && flows.getStatus().equals(ActivitiStatus.refuse)) { |
| | |
| | | return Result.success(CodeMsg.INSERT_ERROR); |
| | | } |
| | | } |
| | | |
| | | @RequestMapping(value = "/addActUser") |
| | | public Result addActUser(@RequestParam String userId){ |
| | | return identityService.addUser(userId); |
| | | } |
| | | |
| | | @RequestMapping(value = "/addActRole") |
| | | public Result addActRole(@RequestParam String roleId){ |
| | | return identityService.addRole(roleId); |
| | | } |
| | | |
| | | @RequestMapping(value = "/addActUserRole") |
| | | public Result addActUserRole(@RequestParam String roleId, @RequestParam String userId){ |
| | | return identityService.addUserRole(roleId,userId); |
| | | } |
| | | @RequestMapping(value = "/deleteActUserRole") |
| | | public Result deleteActUserRole(@RequestParam String roleId, @RequestParam String userId){ |
| | | return identityService.deleteUserRole(roleId,userId); |
| | | } |
| | | |
| | | @RequestMapping(value = "/deleteActRole") |
| | | public Result deleteActRole(@RequestParam String roleId){ |
| | | return identityService.deleteRole(roleId); |
| | | } |
| | | |
| | | @RequestMapping(value = "/deleteActUser") |
| | | public Result deleteActUser(@RequestParam String userId){ |
| | | return identityService.deleteUser(userId); |
| | | } |
| | | |
| | | } |