| | |
| | | import java.io.InputStream; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | param.setAgencyId(Long.valueOf(tenantId)); |
| | | } |
| | | param.setStates((short) 1); |
| | | param.setWarehouseType((short) 0); |
| | | GenericPager pager = finWarehouseLedgerService.ledgerList(param); |
| | | return ResponseValue.success(pager); |
| | | } |
| | |
| | | param.setAgencyId(Long.valueOf(tenantId)); |
| | | } |
| | | param.setStates((short) 1); |
| | | param.setWarehouseType((short) 0); |
| | | param.setPageNum(1); |
| | | param.setPageSize(Integer.MAX_VALUE); |
| | | GenericPager<Map<String, Object>> pager = finWarehouseLedgerService.ledgerList(param); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @Description 分页列表查询 |
| | | * @Author wh |
| | | * @Date 2023/7/11 13:59 |
| | | */ |
| | | @RequestMapping("/getDeptLedgerList") |
| | | public ResponseValue getDeptLedgerList() { |
| | | LWhLedgerQry param = CommonUtil.getObjFromReq(LWhLedgerQry.class); |
| | | LWhLedgerQry query = new LWhLedgerQry(); |
| | | CommonUtil.copyProperties(param, query); |
| | | param = query; |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return ResponseValue.error("登录用户信息不存在"); |
| | | } |
| | | /*当前登录人只能看到自己机构下的列表*/ |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String tenantId = sysInfo.getTenantId(); |
| | | Long paramAgencyId = param.getAgencyId(); |
| | | if (paramAgencyId == null || !paramAgencyId.toString().startsWith(tenantId)) { |
| | | param.setAgencyId(Long.valueOf(tenantId)); |
| | | } |
| | | ArrayList<Short> statesList = new ArrayList<>(); |
| | | statesList.add((short)1); |
| | | statesList.add((short)2); |
| | | param.setStatesList(statesList); |
| | | param.setWarehouseType((short) 1); |
| | | GenericPager pager = finWarehouseLedgerService.depLedgerList(param); |
| | | return ResponseValue.success(pager); |
| | | } |
| | | |
| | | @RequestMapping("/getDeptListExport") |
| | | public void getDeptListExport(HttpServletResponse response) throws Exception { |
| | | LWhLedgerQry param = CommonUtil.getObjFromReq(LWhLedgerQry.class); |
| | | LWhLedgerQry query = new LWhLedgerQry(); |
| | | CommonUtil.copyProperties(param, query); |
| | | param = query; |
| | | S_user_core currentUser = this.getCurrentUser(); |
| | | if (currentUser == null) { |
| | | return; |
| | | } |
| | | /*当前登录人只能看到自己机构下的列表*/ |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String tenantId = sysInfo.getTenantId(); |
| | | Long paramAgencyId = param.getAgencyId(); |
| | | if (paramAgencyId == null || !paramAgencyId.toString().startsWith(tenantId)) { |
| | | param.setAgencyId(Long.valueOf(tenantId)); |
| | | } |
| | | ArrayList<Short> statesList = new ArrayList<>(); |
| | | statesList.add((short)1); |
| | | statesList.add((short)2); |
| | | param.setStatesList(statesList); |
| | | param.setWarehouseType((short) 1); |
| | | param.setPageNum(1); |
| | | param.setPageSize(Integer.MAX_VALUE); |
| | | GenericPager<Map<String, Object>> pager = finWarehouseLedgerService.depLedgerList(param); |
| | | List<Map<String, Object>> datas = pager.getDatas(); |
| | | org.springframework.core.io.Resource resource = new ClassPathResource("import/depTaiZhangExpTemp.xlsx"); |
| | | // 获取文件输入流 |
| | | InputStream inputStream = resource.getInputStream(); |
| | | Workbook wb = new XSSFWorkbook(inputStream); |
| | | TemplateExportParams params = new TemplateExportParams(); |
| | | params.setTemplateWb(wb); |
| | | |
| | | Map<String, Object> map = new HashMap<String, Object>(); |
| | | map.put("dataList", datas); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | // 设置响应头 |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("库存查询.xlsx", "utf-8")); |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | } |
| | | |
| | | } |
| | | |
| | | } |