| | |
| | | package me.zhengjie.modules.attendance.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.sun.xml.internal.messaging.saaj.util.ByteInputStream; |
| | | import lombok.RequiredArgsConstructor; |
| | | import me.zhengjie.modules.api.Api; |
| | | import me.zhengjie.modules.attendance.service.AttendanceLeaveFlowableService; |
| | |
| | | import me.zhengjie.modules.system.repository.UserRepository; |
| | | import me.zhengjie.modules.system.service.RoleService; |
| | | import me.zhengjie.modules.system.service.dto.RoleSmallDto; |
| | | import me.zhengjie.utils.FileUtil; |
| | | import me.zhengjie.utils.HttpUtil; |
| | | import me.zhengjie.utils.ObjectUtil; |
| | | import me.zhengjie.utils.SecurityUtils; |
| | | import org.springframework.beans.factory.annotation.Value; |
| | | import org.springframework.http.HttpHeaders; |
| | | import org.springframework.http.ResponseEntity; |
| | | import org.springframework.stereotype.Service; |
| | | import org.springframework.transaction.annotation.Transactional; |
| | | |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.*; |
| | | import java.util.Collections; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | List<AttendanceLeaveDto> attendanceLeaveDtoList = ((JSONArray) returnObject).toJavaList(AttendanceLeaveDto.class); |
| | | return attendanceLeaveDtoList; |
| | | } |
| | | |
| | | /** |
| | | * 流程图 |
| | | * @return |
| | | */ |
| | | @Override |
| | | @Transactional(rollbackFor = Exception.class) |
| | | public void processDiagram(HttpServletRequest request, HttpServletResponse response, String processInstanceId) throws Exception { |
| | | // 发起通信 |
| | | byte[] obj = api.postStream(flowableUrl + "/api/common/processDiagram?processInstanceId=" + processInstanceId, new HashMap<>()); |
| | | // 输入流 |
| | | InputStream in = new ByteArrayInputStream(obj); |
| | | // inputStream 转 File |
| | | File file = FileUtil.inputStreamToFile(in, "流程图.png"); |
| | | // 下载文件 |
| | | FileUtil.downloadFile(request, response, file, true); |
| | | } |
| | | } |