| | |
| | | // éè´åå¯¼åº |
| | | export function procureExport(params) { |
| | | return request({ |
| | | url: '/pc/l/wh/form/procure/list/export', |
| | | url: '/pc/whForm/procure/list/export', |
| | | responseType: 'blob', // æå®ååºæ°æ®ç±»å为Blob |
| | | method: 'get', |
| | | params, |
| | |
| | | import com.walker.infrastructure.tree.TreeNode; |
| | | import com.walker.infrastructure.utils.StringUtils; |
| | | import com.walker.web.ResponseValue; |
| | | import io.swagger.annotations.Api; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.util.CollectionUtils; |
| | | import org.springframework.web.bind.annotation.*; |
| | |
| | | * @Author å¢åºé³ |
| | | * @Date 2023/10/23 |
| | | */ |
| | | @Api(value = "ç©ååç±»", tags = "ç©ååç±»") |
| | | @RestController |
| | | @RequestMapping("/pc/base/category") |
| | | public class BaseCategoryController extends BaseController { |
| | |
| | | } |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | downLoadExcel("111", response, workbook); |
| | | downLoadExcel("éè´éè´§å", response, workbook); |
| | | |
| | | // try (OutputStream outputStream = response.getOutputStream()) { |
| | | // response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | // response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("éè´éè´§å1.xlsx", "utf-8")); |
| | | // workbook.write(outputStream); |
| | | // workbook.close(); |
| | | // } |
| | | } |
| | | |
| | | private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) throws IOException { |
| | | private void downLoadExcel(String fileName, HttpServletResponse response, Workbook workbook) { |
| | | try (OutputStream out = response.getOutputStream()) { |
| | | response.setCharacterEncoding("UTF-8"); |
| | | response.setHeader("content-Type", "application/vnd.ms-excel"); |
| | |
| | | response.setHeader("Content-Length", String.valueOf(baos.size())); |
| | | out.write(baos.toByteArray()); |
| | | } catch (Exception e) { |
| | | try { |
| | | throw new Exception(e.getMessage()); |
| | | } catch (Exception e1) { |
| | | e1.printStackTrace(); |
| | | } |
| | | logger.error("å¯¼åºæä»¶å¤±è´¥", e); |
| | | } |
| | | } |
| | | |
| | |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | TemplateExportParams params = new TemplateExportParams( |
| | | "import/éè´å
¥åºå.xlsx"); |
| | | "import/éè´å
¥åºå.xls"); |
| | | |
| | | FinSysTenantUser sysInfo = this.getSysInfo(); |
| | | String userName = sysInfo.getUserName(); |
| | |
| | | import com.consum.base.pojo.response.FromTransferTemplateInfoVO; |
| | | import com.consum.base.pojo.response.LWHFromTransferExtendVO; |
| | | import com.consum.base.pojo.response.TransferInfoVO; |
| | | import com.consum.base.service.BaseGoodsModelsServiceImpl; |
| | | import com.consum.base.service.BaseWarehouseServiceImpl; |
| | | import com.consum.base.service.LWhFormTransferCoreService; |
| | | import com.consum.base.service.LWhFormTransferServiceImpl; |
| | |
| | | import java.lang.reflect.Field; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | private LWhProcureModelUserServiceImpl lWhProcureModelUserService; |
| | | @Autowired |
| | | private LWhProcureModelUserRecordServiceImpl lWhProcureModelUserRecordService; |
| | | @Autowired |
| | | private BaseGoodsModelsServiceImpl baseGoodsModelsService; |
| | | @Autowired |
| | | private BaseWarehouseServiceImpl baseWarehouseService; |
| | | |
| | |
| | | * @Author å¢åºé³ |
| | | * @Date 2023/10/31 |
| | | */ |
| | | @GetMapping("/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, Integer type, HttpServletResponse response) throws IOException { |
| | | |
| | | TemplateExportParams params = new TemplateExportParams("import/è°æ¨å
¥åºå.xlsx"); |
| | | Map<String, Object> map = this.lWhFormTransferService.export(id); |
| | | TemplateExportParams params; |
| | | if (type == 1) { |
| | | params = new TemplateExportParams("import/è°æ¨å
¥åºå.xls"); |
| | | } else { |
| | | params = new TemplateExportParams("import/è°æ¨åºåºå.xls"); |
| | | } |
| | | Map<String, Object> map = this.lWhFormTransferService.export(id, type); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("è°æ¨å
¥åºå.xlsx", "utf-8")); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("è°æ¨å
¥åºå.xls", "utf-8")); |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | } |
| | |
| | | if (CollectionUtils.isEmpty(useRecordDTOList)) { |
| | | return ResponseValue.error("æªæ¥è¯¢å°ä½¿ç¨è®°å½"); |
| | | } |
| | | List<GoodsUseRecordVO> result = Lists.newArrayList(); |
| | | List<GoodsUseRecordVO> goodsUseRecordList = Lists.newArrayList(); |
| | | //åç» |
| | | Map<Long, Map<Long, List<UseRecordDTO>>> collect = useRecordDTOList.stream() |
| | | .collect(Collectors.groupingBy(UseRecordDTO::getId, Collectors.groupingBy(UseRecordDTO::getBaseGoodsModelsId))); |
| | |
| | | useRecordSkuVO.setRecordUserInfos(recordUserInfoList); |
| | | useRecordSkuList.add(useRecordSkuVO); |
| | | goodsUseRecordVO.setRecordSkuDtoList(useRecordSkuList); |
| | | result.add(goodsUseRecordVO); |
| | | goodsUseRecordList.add(goodsUseRecordVO); |
| | | } |
| | | } |
| | | } |
| | | //åç»ä¹åéæ°æåº |
| | | List<GoodsUseRecordVO> result = goodsUseRecordList.stream() |
| | | .sorted(Comparator.comparing(GoodsUseRecordVO::getUpdateTime |
| | | , Comparator.nullsFirst(Long::compareTo)).reversed()) |
| | | .collect(Collectors.toList()); |
| | | return ResponseValue.success(result); |
| | | } |
| | | |
| | |
| | | import com.walker.web.param.ParamRequest; |
| | | import java.util.List; |
| | | import lombok.Data; |
| | | import lombok.ToString; |
| | | |
| | | @Data |
| | | @ToString |
| | | public class ProjectTreeResult extends ParamRequest { |
| | | |
| | | List<ProjectTreeResult> children; |
| | | List<ProjectTreeResult> children = null; |
| | | |
| | | private Long id; |
| | | |
| | |
| | | private int price; |
| | | |
| | | private String warehouseName; |
| | | |
| | | private Long createTime; |
| | | |
| | | private String operatorName; |
| | | } |
| | |
| | | private String businessFormCode; |
| | | private String operatorName; |
| | | private Long createTime; |
| | | private String inAgencyName; |
| | | private String outAgencyName; |
| | | private String tenantName; |
| | | private String goodsName; |
| | | private String baseGoodsModelsName; |
| | | private Integer num; |
| | |
| | | package com.consum.base.service; |
| | | |
| | | import com.consum.base.Constants; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.base.pojo.BaseCategoryParam; |
| | | import com.consum.base.pojo.ProjectTreeResult; |
| | | import com.consum.base.core.utils.IdUtil; |
| | | import com.consum.model.po.BaseCategory; |
| | | import com.iplatform.model.po.S_user_core; |
| | | import com.walker.db.page.GenericPager; |
| | |
| | | //1级åç±» |
| | | List<ProjectTreeResult> menus = all.stream().filter(entity -> entity.getLevels() == 1).map(entity -> { |
| | | ProjectTreeResult projectTreeResult = new ProjectTreeResult(entity); |
| | | projectTreeResult.setChildren(getChildren(projectTreeResult, all)); |
| | | if (getChildren(projectTreeResult, all).isEmpty()) { |
| | | projectTreeResult.setChildren(null); |
| | | } else { |
| | | projectTreeResult.setChildren(getChildren(projectTreeResult, all)); |
| | | } |
| | | return projectTreeResult; |
| | | }).sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))).collect(Collectors.toList()); |
| | | return menus; |
| | |
| | | |
| | | ProjectTreeResult projectTreeResult = new ProjectTreeResult(entity); |
| | | //éè¿é彿¾å°ååç±» |
| | | projectTreeResult.setChildren(getChildren(projectTreeResult, all)); |
| | | if (getChildren(projectTreeResult, all).isEmpty()) { |
| | | projectTreeResult.setChildren(null); |
| | | } else { |
| | | projectTreeResult.setChildren(getChildren(projectTreeResult, all)); |
| | | } |
| | | return projectTreeResult; |
| | | }).sorted(Comparator.comparingInt(menu -> (menu.getSort() == null ? 0 : menu.getSort()))).collect(Collectors.toList()); |
| | | return children; |
| | |
| | | return 1; |
| | | } |
| | | |
| | | /** |
| | | * 宿çç¹ |
| | | * |
| | | * @author å¢åºé³ |
| | | * @date 2023/10/31 |
| | | */ |
| | | // public int finishPd(LWhFormInventoryParam dto) { |
| | | // //1.æ ¹æ®çç¹åidæ¥è¯¢çç¹å |
| | | // LWhFormInventory lWhFormInventory = this.get(new LWhFormInventory(dto.getId())); |
| | | // if (lWhFormInventory == null) { |
| | | // log.error("æ ¹æ®çç¹åidæ¥è¯¢çç¹å 失败"); |
| | | // return 0; |
| | | // } |
| | | // //2.ä¿®æ¹çç¹å |
| | | // lWhFormInventory.setStates(2); |
| | | // lWhFormInventory.setStopTime(DateUtils.getDateTimeNumber(System.currentTimeMillis())); |
| | | // int flag1 = this.update(lWhFormInventory); |
| | | // if (flag1 == 0) { |
| | | // log.error("ä¿®æ¹çç¹å 失败"); |
| | | // return 0; |
| | | // } |
| | | // //3.æ´æ°çç¹åç©å |
| | | // List<LWhFormInventoryGoods> inventoryGoodsList = dto.getInventoryGoodsList(); |
| | | // if (CollectionUtils.isEmpty(inventoryGoodsList)) { |
| | | // log.error("çç¹åç©å 为空"); |
| | | // return 0; |
| | | // } |
| | | // for (LWhFormInventoryGoods inventoryGoods : inventoryGoodsList) { |
| | | // int errorCounts = inventoryGoods.getInitCounts() - inventoryGoods.getInventoryCounts(); |
| | | // if (errorCounts > 0) { |
| | | // inventoryGoods.setInventoryResult(3); |
| | | // } else if (errorCounts < 0) { |
| | | // inventoryGoods.setInventoryResult(2); |
| | | // } else { |
| | | // inventoryGoods.setInventoryResult(1); |
| | | // } |
| | | // inventoryGoods.setErrorCounts(Math.abs(errorCounts)); |
| | | // } |
| | | // int flag2 = inventoryGoodsService.update(inventoryGoodsList); |
| | | // if (flag2 != inventoryGoodsList.size()) { |
| | | // log.error("æ´æ°çç¹åç©å 失败"); |
| | | // return 0; |
| | | // } |
| | | // return 1; |
| | | // } |
| | | |
| | | /** |
| | | * @return |
| | |
| | | + "\tpm.BASE_GOODS_MODELS_NAME goodsModeName,\n" |
| | | + "\tcounts num,\n" |
| | | + "\ttotal_amount totalAmount,\n" |
| | | + "\tfo.DEAL_TIME createTime,\n" |
| | | + "\tfo.OPERATOR_NAME,\n" |
| | | + "\tBEIZ remark\n" |
| | | + "FROM\n" |
| | | + "\tl_wh_procure_model pm\n" |
| | |
| | | Optional<TemplateExcelExport> first = list.stream().findFirst(); |
| | | TemplateExcelExport templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | | Long createTime = templateExcelExport.getCreateTime(); |
| | | String operatorName = templateExcelExport.getOperatorName(); |
| | | |
| | | String dateForHuman = DateUtils.getDateForHuman(System.currentTimeMillis()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", dateForHuman); |
| | | map.put("name", userName); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("name", operatorName); |
| | | map.put("sum", sum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | |
| | | String sql = "SELECT\n" |
| | | + "\tfp.BUSINESS_FORM_CODE,\n" |
| | | + "\tfp.AGENCY_NAME tenantName,\n" |
| | | + "\tfp.INCOME_TIME createTime,\n" |
| | | + "\tfp.INCOME_NAME operatorName,\n" |
| | | + "\tGOODS_NAME goodsName,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME goodsModeName,\n" |
| | | + "\tcounts num,\n" |
| | |
| | | Optional<TemplateExcelExport> first = list.stream().findFirst(); |
| | | TemplateExcelExport templateExcelExport = first.get(); |
| | | String businessFormCode = templateExcelExport.getBusinessFormCode(); |
| | | Long createTime = templateExcelExport.getCreateTime(); |
| | | String operatorName = templateExcelExport.getOperatorName(); |
| | | |
| | | String dateForHuman = DateUtils.getDateForHuman(System.currentTimeMillis()); |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", dateForHuman); |
| | | map.put("name", userName); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("name", operatorName); |
| | | map.put("sum", sum); |
| | | map.put("totalAmount", totalAmount); |
| | | map.put("data", list); |
| | |
| | | int goodsNum = this.lWhGoodsService.queryGoodsModelNum(0, warehouseId, baseGoodsModelsId, 1, null); |
| | | lWhProcureModel.setWorehouseCount(goodsNum); |
| | | } |
| | | if (businessType == 1) { |
| | | lWhProcureModel.setBusinessType(4); |
| | | } |
| | | lWhProcureModel.setCounts(model.getCounts()); |
| | | lWhProcureModel.setBusinessId(lWhFormTransferId); |
| | | lWhProcureModel.setBaseGoodsModelsId(baseGoodsModelsId); |
| | |
| | | // åæ®ç±»å 1 éè´2 è°æ¨ 3åºåº4é¨é¨åå |
| | | //é¨é¨ååç±»å |
| | | if (businessType == 1 && "A".equals(baseModelMap.get("type"))) { |
| | | lWhProcureModel.setBusinessType(4); |
| | | LWhProcureModelUserRecord lWhProcureModelUserRecord = new LWhProcureModelUserRecord(); |
| | | lWhProcureModelUserRecord.setId(IdUtil.generateId()); |
| | | lWhProcureModelUserRecord.setTransBusinessId(lWhFormTransferId); |
| | |
| | | * @Author å¢åºé³ |
| | | * @Date 2023/10/31 |
| | | */ |
| | | public Map<String, Object> export(Long id) { |
| | | public Map<String, Object> export(Long id, Integer type) { |
| | | String sql = "SELECT\n" |
| | | + "\tft.BUSINESS_FORM_CODE,\n" |
| | | + "\tft.OPERATOR_NAME,\n" |
| | | + "\tft.CREATE_TIME,\n" |
| | | + "\tft.IN_AGENCY_NAME,\n" |
| | | + "\tft.OUT_AGENCY_NAME,\n" |
| | | + "\tGOODS_NAME,\n" |
| | | + "\tpm.BASE_GOODS_MODELS_NAME,\n" |
| | |
| | | List<TemplateExcelTransfer> list = Lists.newArrayList(); |
| | | select.forEach(item -> { |
| | | TemplateExcelTransfer templateExcelTransfer = MapUtils.convertMapToObj(item, TemplateExcelTransfer.class); |
| | | if (type == 1) { |
| | | templateExcelTransfer.setTenantName(templateExcelTransfer.getOutAgencyName()); |
| | | } else { |
| | | templateExcelTransfer.setTenantName(templateExcelTransfer.getInAgencyName()); |
| | | } |
| | | list.add(templateExcelTransfer); |
| | | }); |
| | | |
| | |
| | | String businessFormCode = entity.getBusinessFormCode(); |
| | | Long createTime = entity.getCreateTime(); |
| | | String operatorName = entity.getOperatorName(); |
| | | |
| | | String tenantName; |
| | | if (type == 1) { |
| | | tenantName = entity.getInAgencyName(); |
| | | } else { |
| | | tenantName = entity.getOutAgencyName(); |
| | | } |
| | | Map<String, Object> map = new HashMap<>(); |
| | | map.put("code", businessFormCode); |
| | | map.put("date", DateUtils.toShowDate(createTime)); |
| | | map.put("tenantName", tenantName); |
| | | map.put("name", operatorName); |
| | | map.put("countNum", countNum); |
| | | map.put("totalAmount", totalAmount); |