| | |
| | | import com.walker.db.page.GenericPager; |
| | | import com.walker.infrastructure.utils.CollectionUtils; |
| | | import com.walker.infrastructure.utils.DateUtils; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.io.File; |
| | | import java.io.FileOutputStream; |
| | | import java.io.IOException; |
| | | import java.io.OutputStream; |
| | | import java.net.URLEncoder; |
| | | import java.text.SimpleDateFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | |
| | | param = query; |
| | | |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | |
| | | return depFormScrappedService.add(param, this.getCurrentUser(), sysInfo); |
| | | } |
| | | |
| | |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(dealTime)); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", 0); |
| | | map.put("totalAmount", 0); |
| | | map.put("dataList", export); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(exportParams, map); |
| | |
| | | } |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | TemplateExportParams exportParams = new TemplateExportParams("D:\\MyProjects\\jmy\\低值易耗品\\low-consum-manage\\deploy-jar-single\\src\\main\\resources\\import\\deptScrapped.xlsx"); |
| | | exportParams.setHeadingStartRow(2); |
| | | @GetMapping("/deptListByModel") |
| | | public ResponseValue export() { |
| | | LDeptFormScrappedQry param = CommonUtil.getObjFromReq(LDeptFormScrappedQry.class); |
| | | LDeptFormScrappedQry query = new LDeptFormScrappedQry(); |
| | | CommonUtil.copyProperties(param, query); |
| | | param = query; |
| | | |
| | | List<Map<String, Object>> export = new ArrayList<>(); |
| | | |
| | | // 创建第一条数据 |
| | | Map<String, Object> data1 = new HashMap<>(); |
| | | data1.put("agencyName", 1); |
| | | data1.put("baseGoodsTemplateName", "Bob"); |
| | | data1.put("scrappedName", "Bob"); |
| | | data1.put("bz", "Bob"); |
| | | data1.put("baseGoodsModelsName", 30); |
| | | data1.put("counts", 30); |
| | | data1.put("totalPrice", 30); |
| | | export.add(data1); |
| | | |
| | | // 创建第二条数据 |
| | | Map<String, Object> data2 = new HashMap<>(); |
| | | data2.put("agencyName", 2); |
| | | data2.put("baseGoodsTemplateName", "Bob"); |
| | | data2.put("scrappedName", "Bob"); |
| | | data2.put("bz", "Bob"); |
| | | data2.put("baseGoodsModelsName", 30); |
| | | data2.put("counts", 30); |
| | | data2.put("totalPrice", 30); |
| | | export.add(data2); |
| | | |
| | | |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", "2023"); |
| | | map.put("date", "2023"); |
| | | map.put("name", "operatorName"); |
| | | map.put("countNum", 0); |
| | | map.put("totalAmount", 0); |
| | | map.put("maplist", export); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(exportParams, map); |
| | | |
| | | File file = new File("C:\\Users\\cy\\Desktop\\新建文件夹"); |
| | | OutputStream stream = null; |
| | | try { |
| | | SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd"); |
| | | stream = new FileOutputStream(new File(file, "机构客户信息表.xls")); |
| | | //document.write(stream); |
| | | workbook.write(stream); |
| | | } catch (Exception e) { |
| | | e.printStackTrace(); |
| | | } finally { |
| | | if (stream != null) ; |
| | | try { |
| | | stream.close(); |
| | | } catch (IOException e) { |
| | | e.printStackTrace(); |
| | | } |
| | | FinSysTenantUser sysInfo = getSysInfo(); |
| | | if (sysInfo == null) { |
| | | throw new RuntimeException("登录用户信息不存在"); |
| | | } |
| | | /*当前登录人只能看到自己机构下的列表*/ |
| | | String tenantId = sysInfo.getTenantId(); |
| | | String paramAgencyId = param.getAgencyId(); |
| | | if (StringUtils.isEmpty(paramAgencyId) || !paramAgencyId.startsWith(tenantId)) { |
| | | param.setAgencyId(tenantId); |
| | | } |
| | | |
| | | List<Map<String, Object>> export = depFormScrappedService.listByModel(param); |
| | | return ResponseValue.success(export); |
| | | } |
| | | |
| | | @GetMapping("/deptListByModel2") |
| | | public ResponseValue deptListByModel2() { |
| | | LDeptFormScrappedQry param = CommonUtil.getObjFromReq(LDeptFormScrappedQry.class); |
| | | LDeptFormScrappedQry query = new LDeptFormScrappedQry(); |
| | | CommonUtil.copyProperties(param, query); |
| | | param = query; |
| | | |
| | | FinSysTenantUser sysInfo = getSysInfo(); |
| | | if (sysInfo == null) { |
| | | throw new RuntimeException("登录用户信息不存在"); |
| | | } |
| | | /*当前登录人只能看到自己机构下的列表*/ |
| | | String tenantId = sysInfo.getTenantId(); |
| | | String paramAgencyId = param.getAgencyId(); |
| | | if (StringUtils.isEmpty(paramAgencyId) || !paramAgencyId.startsWith(tenantId)) { |
| | | param.setAgencyId(tenantId); |
| | | } |
| | | return ResponseValue.success(depFormScrappedService.listByModel2(param)); |
| | | } |
| | | |
| | | |
| | | // public static void main(String[] args) { |
| | | // TemplateExportParams exportParams = new TemplateExportParams("D:\\MyProjects\\jmy\\低值易耗品\\low-consum-manage\\deploy-jar-single\\src\\main\\resources\\import\\deptScrapped.xlsx"); |
| | | // exportParams.setHeadingStartRow(2); |
| | | // |
| | | // List<Map<String, Object>> export = new ArrayList<>(); |
| | | // |
| | | // // 创建第一条数据 |
| | | // Map<String, Object> data1 = new HashMap<>(); |
| | | // data1.put("agencyName", 1); |
| | | // data1.put("baseGoodsTemplateName", "Bob"); |
| | | // data1.put("scrappedName", "Bob"); |
| | | // data1.put("bz", "Bob"); |
| | | // data1.put("baseGoodsModelsName", 30); |
| | | // data1.put("counts", 30); |
| | | // data1.put("totalPrice", 30); |
| | | // export.add(data1); |
| | | // |
| | | // // 创建第二条数据 |
| | | // Map<String, Object> data2 = new HashMap<>(); |
| | | // data2.put("agencyName", 2); |
| | | // data2.put("baseGoodsTemplateName", "Bob"); |
| | | // data2.put("scrappedName", "Bob"); |
| | | // data2.put("bz", "Bob"); |
| | | // data2.put("baseGoodsModelsName", 30); |
| | | // data2.put("counts", 30); |
| | | // data2.put("totalPrice", 30); |
| | | // export.add(data2); |
| | | // |
| | | // |
| | | // Map<String, Object> map = new HashMap<>(); |
| | | // map.put("code", "2023"); |
| | | // map.put("date", "2023"); |
| | | // map.put("name", "operatorName"); |
| | | // map.put("countNum", 0); |
| | | // map.put("totalAmount", 0); |
| | | // map.put("maplist", export); |
| | | // |
| | | // Workbook workbook = ExcelExportUtil.exportExcel(exportParams, map); |
| | | // |
| | | // File file = new File("C:\\Users\\cy\\Desktop\\新建文件夹"); |
| | | // OutputStream stream = null; |
| | | // try { |
| | | // SimpleDateFormat sdf = new SimpleDateFormat("yyyy_MM_dd"); |
| | | // stream = new FileOutputStream(new File(file, "机构客户信息表.xls")); |
| | | // //document.write(stream); |
| | | // workbook.write(stream); |
| | | // } catch (Exception e) { |
| | | // e.printStackTrace(); |
| | | // } finally { |
| | | // if (stream != null) ; |
| | | // try { |
| | | // stream.close(); |
| | | // } catch (IOException e) { |
| | | // e.printStackTrace(); |
| | | // } |
| | | // } |
| | | // } |
| | | } |