From 6cfff55d44314e88fefd6e3adb290ec16b303f89 Mon Sep 17 00:00:00 2001 From: 黎星凯 <13949086503@163.com> Date: 星期五, 05 一月 2024 10:42:53 +0800 Subject: [PATCH] 1、供产品导数据临时用(用户,机构,部门,仓库,库管员 可删) 2、选择库管员增加过滤参数 --- consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java | 161 ++++++++++++++++++++--------------------------------- 1 files changed, 60 insertions(+), 101 deletions(-) diff --git a/consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java b/consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java index 2c12646..d9c8074 100644 --- a/consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java +++ b/consum-base/src/main/java/com/consum/base/controller/DepFormScrappedController.java @@ -1,38 +1,41 @@ package com.consum.base.controller; -import cn.afterturn.easypoi.excel.ExcelExportUtil; -import cn.afterturn.easypoi.excel.entity.TemplateExportParams; -import cn.hutool.core.convert.Convert; -import cn.hutool.core.util.ReflectUtil; -import com.consum.base.BaseController; -import com.consum.base.core.utils.CommonUtil; -import com.consum.base.pojo.LDeptFormScrappedParam; -import com.consum.base.pojo.query.LDeptFormScrappedQry; -import com.consum.base.service.DepFormScrappedServiceImpl; -import com.consum.model.po.FinSysTenantUser; -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 io.swagger.annotations.ApiImplicitParams; -import io.swagger.annotations.ApiOperation; -import org.apache.poi.ss.usermodel.Workbook; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import java.io.OutputStream; import java.net.URLEncoder; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; + +import javax.annotation.Resource; +import javax.servlet.http.HttpServletResponse; + +import org.apache.poi.ss.usermodel.Workbook; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import com.consum.base.BaseController; +import com.consum.base.core.utils.CommonUtil; +import com.consum.base.pojo.LDeptFormScrappedParam; +import com.consum.base.pojo.query.LDeptFormScrappedQry; +import com.consum.base.service.DepFormScrappedService; +import com.consum.model.po.FinSysTenantUser; +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 cn.afterturn.easypoi.excel.ExcelExportUtil; +import cn.afterturn.easypoi.excel.entity.TemplateExportParams; +import cn.hutool.core.convert.Convert; +import cn.hutool.core.util.ReflectUtil; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiImplicitParam; +import io.swagger.annotations.ApiImplicitParams; +import io.swagger.annotations.ApiOperation; /** * @ClassName DepFormScrappedController @@ -41,16 +44,16 @@ * @Description * @Version 1.0 **/ -@Api(value = "搴撶鍛�", tags = "搴撶鍛�") +@Api(value = "閮ㄩ棬鎶ュ簾", tags = "閮ㄩ棬鎶ュ簾") @RestController @RequestMapping("/pc/l/wh/form/scrapped") public class DepFormScrappedController extends BaseController { @Resource - private DepFormScrappedServiceImpl depFormScrappedService; + private DepFormScrappedService depFormScrappedService; @ApiOperation(value = "鏂板鎶ュ簾鍗�", notes = "鏂板鎶ュ簾鍗�") @PostMapping("/deptAdd") - public ResponseValue deptAdd() { + public ResponseValue deptAdd() throws Exception { LDeptFormScrappedParam param = CommonUtil.getObjFromReqBody(LDeptFormScrappedParam.class); LDeptFormScrappedParam query = new LDeptFormScrappedParam(); CommonUtil.copyProperties(param, query); @@ -58,18 +61,17 @@ FinSysTenantUser sysInfo = this.getSysInfo(); - return depFormScrappedService.add(param, this.getCurrentUser(), sysInfo); + depFormScrappedService.add(param, this.getCurrentUser(), sysInfo); + return ResponseValue.success(); } /** - * @Description 鍒楄〃鏌ヨ - * 1.鏌ヨ鎶ュ簾鍗� 2.鏌ヨ鎶ュ簾鍗曠墿鍝� + * @Description 鍒楄〃鏌ヨ 1.鏌ヨ鎶ュ簾鍗� 2.鏌ヨ鎶ュ簾鍗曠墿鍝� * @Date */ @ApiOperation(value = "鍒楄〃鏌ヨ", notes = "鍒楄〃鏌ヨ") @ApiImplicitParams({ - @ApiImplicitParam(name = "param", value = "鏌ヨ鏉′欢", dataType = "LWhFormScrappedQry", paramType = "query") - }) + @ApiImplicitParam(name = "param", value = "鏌ヨ鏉′欢", dataType = "LWhFormScrappedQry", paramType = "query")}) @GetMapping("/deptList") public ResponseValue queryList() { LDeptFormScrappedQry param = CommonUtil.getObjFromReq(LDeptFormScrappedQry.class); @@ -120,7 +122,7 @@ } else { // 濡傛灉id鍦ㄥ悎骞舵暟鎹腑宸插瓨鍦紝鍒欏皢k3杩藉姞鍒板凡瀛樺湪璁板綍鐨刱3鍒楄〃涓� Map<String, Object> mergedMap = mergedDataMap.get(id); - ArrayList<HashMap> goodsList = (ArrayList<HashMap>) mergedMap.get("goods"); + ArrayList<HashMap> goodsList = (ArrayList<HashMap>)mergedMap.get("goods"); goodsList.add(hashMap); } } @@ -132,9 +134,7 @@ * @Description 鏍规嵁id鏌ヨ璇︽儏 */ @ApiOperation(value = "鏍规嵁id鏌ヨ璇︽儏", notes = "鏍规嵁id鏌ヨ璇︽儏") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query") - }) + @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) @GetMapping("/deptDetail") public ResponseValue getById(Long id) { if (id == null) { @@ -144,9 +144,7 @@ } @ApiOperation(value = "瀵煎嚭鎶ュ簾鍗�", notes = "瀵煎嚭鎶ュ簾鍗�") - @ApiImplicitParams({ - @ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query") - }) + @ApiImplicitParams({@ApiImplicitParam(name = "id", value = "鎶ュ簾鍗昳d", dataType = "Long", paramType = "query")}) @GetMapping("/deptList/export") public void export(Long id, HttpServletResponse response) throws Exception { if (id == null) { @@ -172,8 +170,6 @@ 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); @@ -208,61 +204,24 @@ return ResponseValue.success(export); } -// 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(); -// } -// } -// } + @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)); + } + } -- Gitblit v1.9.1