| | |
| | | |
| | | import com.github.pagehelper.PageHelper; |
| | | import com.github.pagehelper.PageInfo; |
| | | import com.whyc.constant.UserOperation; |
| | | import com.whyc.dto.Response; |
| | | import com.whyc.mapper.ProcedureDocMapper; |
| | | import com.whyc.pojo.ProcedureDoc; |
| | | import com.whyc.util.ActionUtil; |
| | | import com.whyc.util.CommonUtil; |
| | | import com.whyc.util.FileUtil; |
| | | import com.whyc.util.Word2PdfAsposeUtil; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletRequest; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.util.Date; |
| | | import java.util.List; |
| | | |
| | | @Service |
| | |
| | | |
| | | @Resource |
| | | private ProcedureDocMapper mapper; |
| | | |
| | | @Autowired |
| | | private DocLogService logService; |
| | | |
| | | public void insert(ProcedureDoc procedureDoc) { |
| | | mapper.insert(procedureDoc); |
| | |
| | | return new Response().setII(1,suffixOutFilePath); |
| | | } |
| | | |
| | | public void download(String filePath, HttpServletResponse response) { |
| | | public void download(String filePath, HttpServletRequest req, HttpServletResponse response) { |
| | | String projectDir = CommonUtil.getProjectDir(); |
| | | String absolutePath = projectDir + File.separator + filePath; |
| | | String filename = filePath.substring(filePath.lastIndexOf(File.separator)+1); |
| | | FileUtil.download(response,absolutePath,filename); |
| | | //记录日志 |
| | | logService.recordOperationLog(ActionUtil.getUser().getId(),ActionUtil.getUser().getName(), UserOperation.TYPE_DOWNLOAD.getType(),new Date(),req.getRemoteAddr(),filename,absolutePath); |
| | | } |
| | | |
| | | public Response getListPage(ProcedureDoc procedureDoc, int pageNum, int pageSize) { |