| | |
| | | import io.swagger.annotations.ApiOperation; |
| | | import lombok.extern.slf4j.Slf4j; |
| | | import org.apache.ibatis.annotations.Options; |
| | | import org.apache.poi.ss.usermodel.Cell; |
| | | import org.apache.poi.ss.usermodel.Row; |
| | | import org.apache.poi.ss.usermodel.Sheet; |
| | | import org.apache.poi.ss.usermodel.Workbook; |
| | | import org.apache.poi.xssf.usermodel.XSSFWorkbook; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.jdbc.datasource.DataSourceTransactionManager; |
| | | import org.springframework.transaction.TransactionDefinition; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | | |
| | |
| | | Collections.sort(list, new Comparator<SpFinancialExpensesFundOut>() { |
| | | @Override |
| | | public int compare(SpFinancialExpensesFundOut o1, SpFinancialExpensesFundOut o2) { |
| | | return o1.getCreateTime().compareTo(o2.getCreateTime()); |
| | | return o1.getApplyTime().compareTo(o2.getApplyTime()); |
| | | } |
| | | }); |
| | | return getCustomDataTable(list, pageNum, pageSize); |
| | |
| | | @GetMapping(value = "/downloadLW/{id}") |
| | | public Map downloadInfoLW(@PathVariable("id") Long id) throws IOException { |
| | | Map dataMap = new HashMap(); |
| | | getDataLW(dataMap, id); |
| | | String dataLW = getDataLW(dataMap, id); |
| | | String filePath = getClass().getResource("/template/").getPath(); |
| | | System.out.println(filePath); |
| | | //设置模本装置方法和路径,FreeMarker支持多种模板装载方法。可以重servlet,classpath,数据库教程装载, |
| | |
| | | e.printStackTrace(); |
| | | } |
| | | String newTime = String.valueOf(Calendar.getInstance().getTimeInMillis()); |
| | | |
| | | String name = "专家劳务费发放申请单_" + dataMap.get("XM") + "_" + newTime; |
| | | if (dataLW.equals("4")) { |
| | | name = "办公费用申请单_" + dataMap.get("XM") + "_" + newTime; |
| | | } |
| | | |
| | | //输出文档路径及名称 |
| | | File outFile = new File(RuoYiConfig.getProfile() + "/download/wordtemplate/" + name + ".doc"); |
| | |
| | | return map; |
| | | } |
| | | |
| | | private void getDataLW(Map dataMap, Long id) { |
| | | private String getDataLW(Map dataMap, Long id) { |
| | | ServiceFund serviceFund = serviceFundService.getById(id); |
| | | if (serviceFund == null) { |
| | | throw new ServiceException("下载失败,用户信息出错", HttpStatus.NO_CONTENT); |
| | |
| | | dataMap.put("KSLJ", kslj); |
| | | dataMap.put("SHLJ", shlj); |
| | | |
| | | return serviceFund.getApplytype(); |
| | | } |
| | | |
| | | |