Browse Source

feat(all): 增加pda货位查询

1 增加pda货位查询接口
2 修改价格逻辑
3 增加价格导入
pull/2/head
zhaoqiaobo 1 year ago
parent
commit
d76a067cfc
  1. 13
      blade-biz-common/src/main/java/org/springblade/common/constant/CommonConstant.java
  2. 27
      blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java
  3. 25
      blade-biz-common/src/main/java/org/springblade/common/constant/ExcelConstants.java
  4. 6
      blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java
  5. 69
      blade-biz-common/src/main/java/org/springblade/common/constant/factorydata/FactoryDataConstants.java
  6. 11
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFreightEntity.java
  7. 2
      blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/BasicdataFreightApiVO.java
  8. 62
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/app/BasicdataGoodsAllocationPDAlController.java
  9. 33
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataFreightController.java
  10. 38
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/GoodsAllocationSelectDTO.java
  11. 75
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataFreightCheckListener.java
  12. 118
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataFreightExcel.java
  13. 72
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataFreightSaveListener.java
  14. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.java
  15. 18
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.xml
  16. 13
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataFreightService.java
  17. 1
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataGoodsAllocationService.java
  18. 389
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataFreightServiceImpl.java
  19. 20
      blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAllocationServiceImpl.java

13
blade-biz-common/src/main/java/org/springblade/common/constant/CommonConstant.java

@ -50,11 +50,10 @@ public interface CommonConstant {
String DEFAULT_PASSWORD = "123456";
// /**
// /**
// * 默认缓存文件地址
// */
String SYSTEMFILEPATH ="/home/java_works/logpm_temp_file/";
String SYSTEMFILEPATH = "/home/java_works/logpm_temp_file/";
/**
@ -62,7 +61,15 @@ public interface CommonConstant {
*/
// String SYSTEMFILEPATH ="F:/logs/";
/**
* http 请求成功返回 code
*/
Integer HTTP_SUCCESS_CODE = 200;
/**
* 数据库逻辑删除-未删除标记 code
*/
Integer DB_UN_DELETED_CODE = 0;
}

27
blade-biz-common/src/main/java/org/springblade/common/constant/DictBizConstant.java

@ -20,7 +20,6 @@ public class DictBizConstant {
public static final String RESERVATION_STATUS = "reservation_status";//预约状态
public static final String ORDER_PACKAGE_STATUS = "order_package_status";//配送包件状态
public static final String ORDER_PACKAGE_FREEZE_STATUS = "order_package_freeze_status";//包件冻结状态
public static final String ORDER_PACKAGE_STOCKUP_STATUS = "order_package_stockup_status";//包件备货状态
@ -33,7 +32,6 @@ public class DictBizConstant {
public static final String LOGPM_UNIT = "logpm_unit";//包件上架状态
public static final String PDA_AUDIO = "pda_audio";//PDA扫码语音
//--------------2023-08-02 ---------------------
@ -55,8 +53,7 @@ public class DictBizConstant {
// --------------2023-08-09 ---------------------
public static final String RESERVATION_STOCKUP_STATUS= "reservation_stockup_status";//配送种类
public static final String RESERVATION_STOCKUP_STATUS = "reservation_stockup_status";//配送种类
// 自提任务
@ -64,19 +61,17 @@ public class DictBizConstant {
/**
* 自提任务状态
*/
public static final String BILL_CONDITIONS_STATUS= "bill_conditions_status";
public static final String BILL_CONDITIONS_STATUS = "bill_conditions_status";
/**
* 自提通知
*/
public static final String BILL_NOTIFICATION_STATUS= "bill_notification_status";
public static final String BILL_NOTIFICATION_STATUS = "bill_notification_status";
/**
* 证件类型
*/
public static final String CERTIFICATE_TYPE= "certificate_type";
public static final String CERTIFICATE_TYPE = "certificate_type";
//---------------2023-08-08 仓库模块
@ -92,7 +87,6 @@ public class DictBizConstant {
public static final String WAREHOUSE_TRAY_ENTRY_TYPE = "warehouse_tray_entry_type";//托盘货物录入类型
// --------------2023-08-24 ---------------------
public static final String DELIVERY_LIST_LOADING_STATUS = "delivery_list_loading_status";//配送任务装车状态
public static final String DISTRIBUTION_SIGNFOR_STATUS = "distribution_signfor_status";//文员签收状态
@ -113,15 +107,15 @@ public class DictBizConstant {
public static final String BILLLADING_CHARGE_TYPE = "billlading_charge_type"; //提货单计费方式
//---------------2023-11-18
public static final String OPEN_ORDER_PAY_TYPE = "open_order_pay_type";
public static final String OPEN_ORDER_PAY_TYPE = "open_order_pay_type";
public static final String OPEN_ORDER_PAY_WAY = "open_order_pay_way";
public static final String OPEN_ORDER_DELIVERY_WAY = "open_order_delivery_way";
public static final String OPEN_ORDER_URGENCY = "open_order_urgency";
public static final String OPEN_ORDER_RECEIPT = "open_order_receipt";
public static final String OPEN_ORDER_TRANSPORT_TYPE = "open_order_transport_type";
/* 异常工单状态 */
public static final String PC_WORK_ORDER = "pc_work_order"; //PC工单异常类型
/* 异常工单状态 */
public static final String PC_WORK_ORDER = "pc_work_order"; //PC工单异常类型
public static final String PC_DISCOVERY_NODE = "pc_discovery_node"; //PC发现环节
public static final String PDA_LINK_LNITIATION = "pda_link_lnitiation"; //PDA环节发起
public static final String RESULT_HANDLING = "result_handling"; //异常处理结果
@ -140,4 +134,11 @@ public class DictBizConstant {
public static final String CARS_CUSTOMER_TYPE = "cars_customer_type";//客户类型
public static final String CARS_SETTLEMENT_STATUS = "cars_settlement_status";//结算状态
// ----------运费类型---------------------
public static final String CARRIAGE_ARTERY = "artery";
public static final String CARRIAGE_ENTREPOT = "entrepot";
public static final String CARRIAGE_DELIVERY = "delivery";
// 运费计件单位
public static final String BASIC_FREIGHT_FORMULAMODE = "basic_freight_formulamode";
}

25
blade-biz-common/src/main/java/org/springblade/common/constant/ExcelConstants.java

@ -0,0 +1,25 @@
package org.springblade.common.constant;
/**
* excel处理常量类
*
* @author zhaoqiaobo
* @create 2024-03-18 10:30
*/
public class ExcelConstants {
/**
* 是否下载模板
*/
public static final String TEMPLATE_FLAG = "1";
/**
* 是否下载模板标识字段
*/
public static final String TEMPLATE_FLAG_FIELD = "templateFlag";
/**
* 导入 excel 批量提交数量
*/
public static final int BATCH_COUNT = 3000;
}

6
blade-biz-common/src/main/java/org/springblade/common/constant/ModuleNameConstant.java

@ -73,7 +73,9 @@ public interface ModuleNameConstant {
*/
String APPLICATION_SUPERVISE_NAME = "logpm-supervise"+DEVAUTH;
String APPLICATION_REPORT_NAME = "logpm-report"+DEVAUTH;
/**
* 报表模块
*/
String APPLICATION_REPORT_NAME = "logpm-report" + DEVAUTH;
}

69
blade-biz-common/src/main/java/org/springblade/common/constant/factorydata/FactoryDataConstants.java

@ -0,0 +1,69 @@
package org.springblade.common.constant.factorydata;
/**
* 工厂数据常量类
*
* @author zhaoqiaobo
* @create 2024-03-17 22:23
*/
public abstract class FactoryDataConstants {
public interface Mq {
/**
* 定义交换机
*/
interface Exchanges {
/**
* 作业节点数据推送
*/
String NODE_DATA_PUSH = "factory.data.exchange.topic.nodeDataPush";
}
/**
* 定义消息队列
*/
interface Queues {
/**
* 志邦作业节点数据推送
*/
String ZBOM_NODE_DATA_PUSH = "factory.data.queue.zbom.nodeDataPush";
/**
* 皮阿诺作业节点数据推送
*/
String PIANO_NODE_DATA_PUSH = "factory.data.queue.piano.nodeDataPush";
/**
* 梦天作业节点数据推送
*/
String MENGTIAN_NODE_DATA_PUSH = "factory.data.queue.mengtian.nodeDataPush";
/**
* 欧派作业节点数据推送
*/
String OPPEIN_NODE_DATA_PUSH = "factory.data.queue.oppein.nodeDataPush";
}
/**
* 定义路由key
*/
interface RoutingKeys {
/**
* 志邦作业节点数据推送
*/
String ZBOM_NODE_DATA_PUSH = "zbom.nodeDataPush";
/**
* 皮阿诺作业节点数据推送
*/
String PIANO_NODE_DATA_PUSH = "piano.nodeDataPush";
/**
* 梦天作业节点数据推送
*/
String MENGTIAN_NODE_DATA_PUSH = "mengtian.nodeDataPush";
/**
* 欧派作业节点数据推送
*/
String OPPEIN_NODE_DATA_PUSH = "oppein.nodeDataPush";
}
}
}

11
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/entity/BasicdataFreightEntity.java

@ -24,6 +24,7 @@ import lombok.EqualsAndHashCode;
import org.springblade.core.tenant.mp.TenantEntity;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.NotNull;
import java.math.BigDecimal;
import java.util.Date;
@ -68,11 +69,17 @@ public class BasicdataFreightEntity extends TenantEntity {
/**
* 物品名称
*/
@NotBlank(message = "户名称必填")
@NotBlank(message = "户名称必填")
@ApiModelProperty(value = "物品名称")
private String itemName;
@ApiModelProperty(value = "物品名称")
private String name;
@NotBlank(message = "发货单位必填")
@ApiModelProperty(value = "发货单位id")
private String forwardingUnitId;
@ApiModelProperty(value = "发货单位名称")
private String forwardingUnitName;
/**
* 客户id
*/
@ -91,6 +98,7 @@ public class BasicdataFreightEntity extends TenantEntity {
/**
* 品牌
*/
@NotNull(message = "品牌不能为空")
@ApiModelProperty(value = "品牌")
private Long brand;
@ApiModelProperty(value = "品牌名称")
@ -98,6 +106,7 @@ public class BasicdataFreightEntity extends TenantEntity {
/**
* 品类
*/
@NotBlank(message = "品类不能为空")
@ApiModelProperty(value = "品类")
private String category;
@ApiModelProperty(value = "品类名称")

2
blade-service-api/logpm-basicdata-api/src/main/java/com/logpm/basicdata/vo/BasicdataFreightApiVO.java

@ -34,4 +34,6 @@ public class BasicdataFreightApiVO implements Serializable {
private String issueWarehouse;//发站仓
private String destination;//到站
private String arrivalWarehouse;//目的仓
private String brand;//品牌
private String forwardingUnitName;//发货单位
}

62
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/app/BasicdataGoodsAllocationPDAlController.java

@ -0,0 +1,62 @@
package com.logpm.basicdata.app;
import cn.hutool.core.collection.CollUtil;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
import com.logpm.basicdata.dto.GoodsAllocationSelectDTO;
import com.logpm.basicdata.service.IBasicdataGoodsAllocationService;
import com.logpm.basicdata.vo.BasicdataGoodsAllocationVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springblade.core.tool.api.R;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@AllArgsConstructor
@RequestMapping("/app/goodsAllocation")
@Api(value = "货位", tags = "货位接口")
public class BasicdataGoodsAllocationPDAlController {
private IBasicdataGoodsAllocationService goodsAllocationService;
@GetMapping("/list")
@ApiOperationSupport(order = 1)
@ApiOperation(value = "查询货位接口列表", notes = "查询货位接口列表")
public R<List<GoodsAllocationSelectDTO>> list(@RequestParam Map<String, Object> basicdataGoodsAllocation) {
List<BasicdataGoodsAllocationVO> records = goodsAllocationService.selectGoodsAllocationList(basicdataGoodsAllocation);
List<GoodsAllocationSelectDTO> ls = new ArrayList<>();
Map<String, List<GoodsAllocationSelectDTO>> map = new HashMap<>();
if (CollUtil.isNotEmpty(records)) {
for (BasicdataGoodsAllocationVO record : records) {
GoodsAllocationSelectDTO goodsAllocationSelectDTO = new GoodsAllocationSelectDTO();
goodsAllocationSelectDTO.setId(record.getId().toString());
goodsAllocationSelectDTO.setName(record.getGoodsAllocationName());
if (map.containsKey(record.getGoodsShelfId().toString())) {
map.get(record.getGoodsShelfId().toString()).add(goodsAllocationSelectDTO);
} else {
ArrayList<GoodsAllocationSelectDTO> objects = new ArrayList<>();
objects.add(goodsAllocationSelectDTO);
map.put(record.getGoodsShelfId().toString(), objects);
GoodsAllocationSelectDTO goodsShelf = new GoodsAllocationSelectDTO();
goodsShelf.setId(record.getGoodsShelfId().toString());
goodsShelf.setName(record.getGoodsShelfName());
ls.add(goodsShelf);
}
}
for (GoodsAllocationSelectDTO l : ls) {
l.setGoodsAllocations(map.get(l.getId()));
}
return R.data(ls);
}
return R.data(ls);
}
}

33
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/controller/BasicdataFreightController.java

@ -16,6 +16,7 @@
*/
package com.logpm.basicdata.controller;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
@ -27,9 +28,12 @@ import com.logpm.basicdata.service.IBasicdataFreightDetailService;
import com.logpm.basicdata.service.IBasicdataFreightService;
import com.logpm.basicdata.vo.BasicdataFreightVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
import io.swagger.annotations.ApiImplicitParams;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import lombok.AllArgsConstructor;
import org.springblade.common.constant.ExcelConstants;
import org.springblade.core.boot.ctrl.BladeController;
import org.springblade.core.excel.util.ExcelUtil;
import org.springblade.core.mp.support.Condition;
@ -39,16 +43,20 @@ import org.springblade.core.tool.api.R;
import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.utils.DateUtil;
import org.springblade.core.tool.utils.Func;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;
import springfox.documentation.annotations.ApiIgnore;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
@ -126,7 +134,7 @@ public class BasicdataFreightController extends BladeController {
@PostMapping("/submit")
@ApiOperationSupport(order = 6)
@ApiOperation(value = "新增或修改", notes = "传入basicdataFreight")
public R submit(@Valid @RequestBody BasicdataFreightDTO basicdataFreight) {
public R submit(@Validated @RequestBody BasicdataFreightDTO basicdataFreight) {
return R.status(basicdataFreightService.ownSaveOrUpdate(basicdataFreight));
}
@ -145,6 +153,15 @@ public class BasicdataFreightController extends BladeController {
return R.status(b);
}
@PostMapping("/import")
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导入数据", notes = "导入数据")
@ApiImplicitParams({
@ApiImplicitParam(name = "file", value = "文件", dataType = "MultipartFile")
})
public R<String> importFreight(@RequestPart("file") MultipartFile file) {
return R.success(basicdataFreightService.importFreight(file));
}
/**
* 导出数据
@ -153,12 +170,14 @@ public class BasicdataFreightController extends BladeController {
@ApiOperationSupport(order = 9)
@ApiOperation(value = "导出数据", notes = "传入basicdataFreight")
public void exportBasicdataFreight(@ApiIgnore @RequestParam Map<String, Object> basicdataFreight, BladeUser bladeUser, HttpServletResponse response) {
QueryWrapper<BasicdataFreightEntity> queryWrapper = Condition.getQueryWrapper(basicdataFreight, BasicdataFreightEntity.class);
//if (!AuthUtil.isAdministrator()) {
// queryWrapper.lambda().eq(BasicdataFreight::getTenantId, bladeUser.getTenantId());
//}
queryWrapper.lambda().eq(BasicdataFreightEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
List<BasicdataFreightExcel> list = basicdataFreightService.exportBasicdataFreight(queryWrapper);
List<BasicdataFreightExcel> list = new ArrayList<>();
if (basicdataFreight.containsKey(ExcelConstants.TEMPLATE_FLAG_FIELD) && StrUtil.equals(ExcelConstants.TEMPLATE_FLAG, (String) basicdataFreight.get(ExcelConstants.TEMPLATE_FLAG_FIELD))) {
} else {
QueryWrapper<BasicdataFreightEntity> queryWrapper = Condition.getQueryWrapper(basicdataFreight, BasicdataFreightEntity.class);
queryWrapper.lambda().eq(BasicdataFreightEntity::getIsDeleted, BladeConstant.DB_NOT_DELETED);
list = basicdataFreightService.exportBasicdataFreight(queryWrapper);
}
ExcelUtil.export(response, "基础客户品牌类型表数据" + DateUtil.time(), "基础客户品牌类型表数据表", list, BasicdataFreightExcel.class);
}

38
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/dto/GoodsAllocationSelectDTO.java

@ -0,0 +1,38 @@
/*
* Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
*
* Redistributions of source code must retain the above copyright notice,
* this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
* Neither the name of the dreamlu.net developer nor the names of its
* contributors may be used to endorse or promote products derived from
* this software without specific prior written permission.
* Author: Chill 庄骞 (smallchill@163.com)
*/
package com.logpm.basicdata.dto;
import lombok.Data;
import java.io.Serializable;
import java.util.List;
/**
* 基础客户品牌类型表 数据传输对象实体类
*
* @author cyz
* @since 2023-06-08
*/
@Data
public class GoodsAllocationSelectDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
private String name;
private List<GoodsAllocationSelectDTO> goodsAllocations;
}

75
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataFreightCheckListener.java

@ -0,0 +1,75 @@
package com.logpm.basicdata.excel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.logpm.basicdata.service.IBasicdataFreightService;
import lombok.NoArgsConstructor;
import org.springblade.common.constant.ExcelConstants;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
/**
* @author zhaoqiaobo
* @create 2024-03-18 11:35
*/
@Service
@NoArgsConstructor
public class BasicdataFreightCheckListener extends AnalysisEventListener<BasicdataFreightExcel> {
List<BasicdataFreightExcel> list = new ArrayList<>();
AtomicLong num = new AtomicLong(3);
/**
* 假设这个是一个DAO当然有业务逻辑这个也可以是一个service当然如果不用存储这个对象没用
*/
private IBasicdataFreightService service;
private StringBuilder message;
private Map<String, Long> brandMap;
private Map<String, Long> clientMap;
private Map<String, Long> categoryMap;
private Map<String, String> arteryMap;
private Map<String, String> entrepotMap;
private Map<String, String> deliveryMap;
private Map<String, String> formulaModeMap;
public BasicdataFreightCheckListener(IBasicdataFreightService service, StringBuilder message, Map<String, Long> brandMap,
Map<String, Long> clientMap, Map<String, Long> categoryMap, Map<String, String> arteryMap, Map<String, String> entrepotMap,
Map<String, String> deliveryMap, Map<String, String> formulaModeMap
) {
this.service = service;
this.message = message;
this.brandMap = brandMap;
this.clientMap = clientMap;
this.categoryMap = categoryMap;
this.arteryMap = arteryMap;
this.entrepotMap = entrepotMap;
this.deliveryMap = deliveryMap;
this.formulaModeMap = formulaModeMap;
}
@Override
public void invoke(BasicdataFreightExcel data, AnalysisContext analysisContext) {
list.add(data);
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
if (list.size() >= ExcelConstants.BATCH_COUNT) {
checkData(num);
// 存储完成清理 list
list.clear();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
checkData(num);
}
private void checkData(AtomicLong andIncrement) {
service.checkData(list, message, andIncrement, brandMap, clientMap, categoryMap, arteryMap, entrepotMap, deliveryMap, formulaModeMap);
}
}

118
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataFreightExcel.java

@ -24,8 +24,6 @@ import com.alibaba.excel.annotation.write.style.HeadRowHeight;
import lombok.Data;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
/**
@ -36,125 +34,119 @@ import java.util.Date;
*/
@Data
@ColumnWidth(25)
@HeadRowHeight(20)
@HeadRowHeight(25)
@ContentRowHeight(18)
public class BasicdataFreightExcel implements Serializable {
private static final long serialVersionUID = 1L;
/**
* 租户号
* 客户名称
*/
@ColumnWidth(20)
@ExcelProperty("租户号")
private String tenantId;
@ExcelProperty({"客户名称", "客户名称"})
private String name;
/**
* 是否已删除
*/
@ColumnWidth(20)
@ExcelProperty("是否已删除")
private Integer isDeleted;
/**
* 预留1
* 品牌
*/
@ColumnWidth(20)
@ExcelProperty("预留1")
private String reserve1;
@ExcelProperty({"品牌", "品牌"})
private String brand;
/**
* 预留2
* 发货单位
*/
@ColumnWidth(20)
@ExcelProperty("预留2")
private String reserve2;
@ExcelProperty({"发货单位", "发货单位"})
private String forwardingUnitName;
/**
* 预留3
* 品类
*/
@ColumnWidth(20)
@ExcelProperty("预留3")
private String reserve3;
@ExcelProperty({"品类", "品类"})
private String categoryName;
/**
* 预留4
* 生效时间
*/
@ColumnWidth(20)
@ExcelProperty("预留4")
private String reserve4;
@ExcelProperty({"生效时间", "生效时间"})
private String effectiveTime;
/**
* 预留5
* 截至时间
*/
@ColumnWidth(20)
@ExcelProperty("预留5")
private String reserve5;
@ExcelProperty({"截至时间", "截至时间"})
private String expirationTime;
/**
* 计算方式;1件 2方 3公斤
* 干线 - 运费
*/
@ColumnWidth(20)
@ExcelProperty("计算方式;1件 2方 3公斤")
private Integer formulaMode;
@ExcelProperty({"干线", "运费"})
private String freightFee;
/**
* 物品名称
* 干线 - 运费单位
*/
@ColumnWidth(20)
@ExcelProperty("物品名称")
private String itemName;
@ExcelProperty({"干线", "运费单位"})
private String freightFeeUnit;
/**
* 客户id
* 仓库 - 0-30天仓储费
*/
@ColumnWidth(20)
@ExcelProperty("客户—id")
private Long clientId;
@ExcelProperty({"仓库", "0-30天仓储费"})
private String zeroStorageFee;
/**
* 费用
* 仓库 - 0-30天仓储费单位
*/
@ColumnWidth(20)
@ExcelProperty("费用")
private BigDecimal cost;
@ExcelProperty({"仓库", "0-30天仓储费单位"})
private String zeroStorageFeeUnit;
/**
* 门店
* 仓库 - 31-60天仓储费
*/
@ColumnWidth(20)
@ExcelProperty("门店")
private Long shop;
@ExcelProperty({"仓库", "31-60天仓储费"})
private String thirtyStorageFee;
/**
* 品牌
* 仓库 - 31-60天仓储费单位
*/
@ColumnWidth(20)
@ExcelProperty("品牌")
private Long brand;
@ExcelProperty({"仓库", "31-60天仓储费单位"})
private String thirtyStorageFeeUnit;
/**
* 品类
* 仓库 - 61天以上仓储费
*/
@ColumnWidth(20)
@ExcelProperty("品类")
private Long category;
@ExcelProperty({"仓库", "61天以上仓储费"})
private String sixtyStorageFee;
/**
* 一口价
* 仓库 - 61天以上仓储费
*/
@ColumnWidth(20)
@ExcelProperty("一口价")
private BigDecimal fixedPrice;
@ExcelProperty({"仓库", "61天以上仓储费单位"})
private String sixtyStorageFeeUnit;
/**
* 生效时间
* 仓库 - 仓库管理费
*/
@ColumnWidth(20)
@ExcelProperty("生效时间")
private Date effectiveTime;
@ExcelProperty({"仓库", "仓库管理费"})
private String managerFee;
/**
* 截至时间
* 仓库 - 仓库管理费
*/
@ColumnWidth(20)
@ExcelProperty("截至时间")
private Date expirationTime;
@ExcelProperty({"仓库", "仓库管理费单位"})
private String managerFeeUnit;
/**
* 类型
* 配送 - 配送费
*/
@ColumnWidth(20)
@ExcelProperty("类型")
private Integer type;
@ExcelProperty({"配送", "配送费"})
private String deliveryFee;
/**
* 标识;1 干仓配 2 一口价 3 每趟 4户
* 配送 - 配送费单位
*/
@ColumnWidth(20)
@ExcelProperty("标识;1 干仓配 2 一口价 3 每趟 4户")
private Byte identification;
@ExcelProperty({"配送", "配送费单位"})
private String deliveryFeeUnit;
}

72
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/excel/BasicdataFreightSaveListener.java

@ -0,0 +1,72 @@
package com.logpm.basicdata.excel;
import com.alibaba.excel.context.AnalysisContext;
import com.alibaba.excel.event.AnalysisEventListener;
import com.logpm.basicdata.service.IBasicdataFreightService;
import lombok.NoArgsConstructor;
import org.springblade.common.constant.ExcelConstants;
import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* @author zhaoqiaobo
* @create 2024-03-18 11:35
*/
@Service
@NoArgsConstructor
public class BasicdataFreightSaveListener extends AnalysisEventListener<BasicdataFreightExcel> {
List<BasicdataFreightExcel> list = new ArrayList<>();
/**
* 假设这个是一个DAO当然有业务逻辑这个也可以是一个service当然如果不用存储这个对象没用
*/
private IBasicdataFreightService service;
private Map<String, Long> brandMap;
private Map<String, Long> clientMap;
private Map<String, Long> categoryMap;
private Map<String, String> arteryMap;
private Map<String, String> entrepotMap;
private Map<String, String> deliveryMap;
private Map<String, String> formulaModeMap;
private Map<String, String> typeMap;
public BasicdataFreightSaveListener(IBasicdataFreightService service, Map<String, Long> brandMap, Map<String, Long> clientMap,
Map<String, Long> categoryMap, Map<String, String> arteryMap, Map<String, String> entrepotMap,
Map<String, String> deliveryMap, Map<String, String> formulaModeMap, Map<String, String> typeMap
) {
this.service = service;
this.brandMap = brandMap;
this.clientMap = clientMap;
this.categoryMap = categoryMap;
this.arteryMap = arteryMap;
this.entrepotMap = entrepotMap;
this.deliveryMap = deliveryMap;
this.formulaModeMap = formulaModeMap;
this.typeMap = typeMap;
}
@Override
public void invoke(BasicdataFreightExcel data, AnalysisContext analysisContext) {
list.add(data);
// 达到BATCH_COUNT了,需要去存储一次数据库,防止数据几万条数据在内存,容易OOM
if (list.size() >= ExcelConstants.BATCH_COUNT) {
saveData();
// 存储完成清理 list
list.clear();
}
}
@Override
public void doAfterAllAnalysed(AnalysisContext analysisContext) {
saveData();
}
private void saveData() {
service.saveData(list, brandMap, clientMap, categoryMap, arteryMap, entrepotMap, deliveryMap, formulaModeMap, typeMap);
}
}

1
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.java

@ -60,6 +60,7 @@ public interface BasicdataGoodsAllocationMapper extends BaseMapper<BasicdataGood
List<BasicdataNodeVO> selectThirdNode(@Param("warehouseId")String warehouseId,@Param("areaId") String areaId);
IPage<BasicdataGoodsAllocationVO> selectGoodsAllocationList(IPage<Object> page,@Param("po") Map<String, Object> basicdataGoodsAllocation);
List<BasicdataGoodsAllocationVO> selectGoodsAllocationListNoPage(@Param("po") Map<String, Object> basicdataGoodsAllocation);
BasicdataGoodsAllocationEntity getEntityByAllocationCode(@Param("allocationCode") String allocationCode);
/**

18
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/mapper/BasicdataGoodsAllocationMapper.xml

@ -64,7 +64,7 @@
WHERE
shelf.is_deleted = 0 AND shelf.warehouse_id = #{warehouseId} AND shelf.goods_area_id = #{areaId}
</select>
<select id="selectGoodsAllocationList" resultType="com.logpm.basicdata.vo.BasicdataGoodsAllocationVO">
<sql id="selectGoodsAllocationListSql">
SELECT
goods_allocation.tenant_id,
goods_allocation.create_user,
@ -81,9 +81,9 @@
goods_allocation.reserve4,
goods_allocation.reserve5,
goods_allocation.goods_area_id,
-- CONCAT(goods_allocation.layer_num,'层',goods_allocation.column_num,'列') goodsAllocationName,
goods_allocation.qr_code goodsAllocationName ,
-- goods_allocation.goods_allocation_name,
-- CONCAT(goods_allocation.layer_num,'层',goods_allocation.column_num,'列') goodsAllocationName,
goods_allocation.qr_code goodsAllocationName ,
-- goods_allocation.goods_allocation_name,
goods_allocation.warehouse_id,
goods_allocation.goods_shelf_id,
goods_allocation.column_num,
@ -117,10 +117,10 @@
<if test="po.warehouseName != null and po.warehouseName!= ''">
and warehouse.name like concat('%', #{po.warehouseName},'%')
</if>
<if test="po.columnNum != null and po.columnNum!= ''">
<if test="po.columnNum != null and po.columnNum!= ''">
and goods_allocation.column_num = #{po.columnNum}
</if>
<if test="po.layerNum != null and po.layerNum!= ''">
<if test="po.layerNum != null and po.layerNum!= ''">
and goods_allocation.layer_num = #{po.layerNum}
</if>
<if test="po.goods_allocation_name != null and po.goods_allocation_name!= ''">
@ -137,6 +137,12 @@
</if>
</where>
order by goods_allocation.goods_area_id, goods_allocation.layer_num asc ,goods_allocation.column_num
</sql>
<select id="selectGoodsAllocationList" resultType="com.logpm.basicdata.vo.BasicdataGoodsAllocationVO">
<include refid="selectGoodsAllocationListSql"></include>
</select>
<select id="selectGoodsAllocationListNoPage" resultType="com.logpm.basicdata.vo.BasicdataGoodsAllocationVO">
<include refid="selectGoodsAllocationListSql"></include>
</select>
<select id="selectAllocationInfo" resultType="com.logpm.basicdata.vo.WarehouseAllocationInfoVO">

13
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataFreightService.java

@ -23,8 +23,11 @@ import com.logpm.basicdata.entity.BasicdataFreightEntity;
import com.logpm.basicdata.excel.BasicdataFreightExcel;
import com.logpm.basicdata.vo.BasicdataFreightVO;
import org.springblade.core.mp.base.BaseService;
import org.springframework.web.multipart.MultipartFile;
import java.util.List;
import java.util.Map;
import java.util.concurrent.atomic.AtomicLong;
/**
* 基础客户品牌类型表 服务类
@ -53,10 +56,18 @@ public interface IBasicdataFreightService extends BaseService<BasicdataFreightEn
/**
* 添加或修改
*
* @param basicdataFreight
* @return
*/
Boolean ownSaveOrUpdate(BasicdataFreightDTO basicdataFreight);
Boolean ownSaveOrUpdate(BasicdataFreightDTO basicdataFreight);
BasicdataFreightDTO getDetail(BasicdataFreightEntity basicdataFreight);
String importFreight(MultipartFile file);
void checkData(List<BasicdataFreightExcel> list, StringBuilder message, AtomicLong andIncrement, Map<String, Long> brandMap, Map<String, Long> clientMap, Map<String, Long> categoryMap, Map<String, String> arteryMap, Map<String, String> entrepotMap, Map<String, String> deliveryMap, Map<String, String> formulaModeMap);
void saveData(List<BasicdataFreightExcel> list, Map<String, Long> brandMap, Map<String, Long> clientMap, Map<String, Long> categoryMap, Map<String, String> arteryMap, Map<String, String> entrepotMap, Map<String, String> deliveryMap, Map<String, String> formulaModeMap, Map<String, String> typeMap);
}

1
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/IBasicdataGoodsAllocationService.java

@ -76,6 +76,7 @@ public interface IBasicdataGoodsAllocationService extends BaseService<BasicdataG
* @return
*/
IPage<BasicdataGoodsAllocationVO> selectGoodsAllocationList(Query query, Map<String, Object> basicdataGoodsAllocation);
List<BasicdataGoodsAllocationVO> selectGoodsAllocationList(Map<String, Object> basicdataGoodsAllocation);
/**
* 修改货位信息

389
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataFreightServiceImpl.java

@ -17,31 +17,58 @@
package com.logpm.basicdata.service.impl;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.NumberUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.alibaba.excel.EasyExcel;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.ObjectUtils;
import com.logpm.basicdata.dto.BasicdataFreightDTO;
import com.logpm.basicdata.dto.BasicdataFreightDetailDTO;
import com.logpm.basicdata.entity.BasicdataBrandEntity;
import com.logpm.basicdata.entity.BasicdataCategoryEntity;
import com.logpm.basicdata.entity.BasicdataClientEntity;
import com.logpm.basicdata.entity.BasicdataFreightDetailEntity;
import com.logpm.basicdata.entity.BasicdataFreightEntity;
import com.logpm.basicdata.excel.BasicdataFreightCheckListener;
import com.logpm.basicdata.excel.BasicdataFreightExcel;
import com.logpm.basicdata.excel.BasicdataFreightSaveListener;
import com.logpm.basicdata.mapper.BasicdataFreightMapper;
import com.logpm.basicdata.service.IBasicdataBrandService;
import com.logpm.basicdata.service.IBasicdataCategoryService;
import com.logpm.basicdata.service.IBasicdataClientService;
import com.logpm.basicdata.service.IBasicdataFreightDetailService;
import com.logpm.basicdata.service.IBasicdataFreightService;
import com.logpm.basicdata.vo.BasicdataFreightVO;
import lombok.AllArgsConstructor;
import lombok.extern.slf4j.Slf4j;
import org.springblade.common.constant.CommonConstant;
import org.springblade.common.constant.DictBizConstant;
import org.springblade.core.log.exception.ServiceException;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.mp.support.Condition;
import org.springblade.core.tool.api.R;
import org.springblade.system.entity.DictBiz;
import org.springblade.system.feign.IDictBizClient;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.web.multipart.MultipartFile;
import java.io.IOException;
import java.math.BigDecimal;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.concurrent.atomic.AtomicLong;
/**
* 基础客户品牌类型表 服务实现类
@ -57,6 +84,11 @@ public class BasicdataFreightServiceImpl extends BaseServiceImpl<BasicdataFreigh
@Autowired
private IBasicdataFreightDetailService detailService;
private final IBasicdataBrandService basicdataBrandService;
private final IBasicdataClientService basicdataClientService;
private final IBasicdataCategoryService basicdataCategoryService;
private final IDictBizClient dictBizClient;
@Override
public IPage<BasicdataFreightVO> selectBasicdataFreightPage(IPage<BasicdataFreightVO> page, BasicdataFreightVO basicdataFreight) {
return page.setRecords(baseMapper.selectBasicdataFreightPage(page, basicdataFreight));
@ -85,18 +117,17 @@ public class BasicdataFreightServiceImpl extends BaseServiceImpl<BasicdataFreigh
LambdaQueryWrapper<BasicdataFreightEntity> query = new LambdaQueryWrapper<>();
query.eq(BasicdataFreightEntity::getItemName, basicdataFreight.getItemName())
.eq(BasicdataFreightEntity::getIsDeleted, 0);
if (0 == basicdataFreight.getFixedPrice()) {
if (StrUtil.isBlank(basicdataFreight.getCategory())) {
throw new ServiceException("品类必填");
}
query.in(BasicdataFreightEntity::getCategory, basicdataFreight.getCategory().split(","));
}
// if (0 == basicdataFreight.getFixedPrice()) {
query.in(BasicdataFreightEntity::getCategory, basicdataFreight.getCategory().split(","));
query.eq(BasicdataFreightEntity::getBrand, basicdataFreight.getBrand());
query.eq(BasicdataFreightEntity::getForwardingUnitId, basicdataFreight.getForwardingUnitId());
// }
if (ObjectUtils.isNotNull(basicdataFreight.getId())) {
query.ne(BasicdataFreightEntity::getId, basicdataFreight.getId());
}
List<BasicdataFreightEntity> list = this.list(query);
if (CollectionUtil.isNotEmpty(list)) {
throw new ServiceException("名称+品类存在其他表单中,请检查。");
throw new ServiceException("(客户名称+品类+品牌+发货单位)存在其他表单中,请检查。");
}
BasicdataFreightEntity basicdataFreightEntity = new BasicdataFreightEntity();
Byte fixedPrice = basicdataFreight.getFixedPrice();
@ -158,4 +189,348 @@ public class BasicdataFreightServiceImpl extends BaseServiceImpl<BasicdataFreigh
return basicdataFreightDTO;
}
@Override
public String importFreight(MultipartFile file) {
StringBuilder message = new StringBuilder();
try {
List<BasicdataBrandEntity> brands = basicdataBrandService.list(new LambdaQueryWrapper<BasicdataBrandEntity>().eq(BasicdataBrandEntity::getIsDeleted, CommonConstant.DB_UN_DELETED_CODE));
Map<String, Long> brandMap = new HashMap<>();
if (CollUtil.isNotEmpty(brands)) {
for (BasicdataBrandEntity brand : brands) {
String brandName = brand.getBrandName();
Long id = brand.getId();
brandMap.put(brandName, id);
}
}
List<BasicdataClientEntity> basicdataClientVOS = basicdataClientService.list(new LambdaQueryWrapper<BasicdataClientEntity>().eq(BasicdataClientEntity::getIsDeleted, CommonConstant.DB_UN_DELETED_CODE));
Map<String, Long> clientMap = new HashMap<>();
if (CollUtil.isNotEmpty(basicdataClientVOS)) {
for (BasicdataClientEntity basicdataClientVO : basicdataClientVOS) {
String clientName = basicdataClientVO.getClientName();
Long id = basicdataClientVO.getId();
clientMap.put(clientName, id);
}
}
List<BasicdataCategoryEntity> list1 = basicdataCategoryService.list(new LambdaQueryWrapper<BasicdataCategoryEntity>().eq(BasicdataCategoryEntity::getIsDeleted, CommonConstant.DB_UN_DELETED_CODE));
Map<String, Long> categoryMap = new HashMap<>();
if (CollUtil.isNotEmpty(list1)) {
for (BasicdataCategoryEntity basicdataCategoryEntity : list1) {
String name = basicdataCategoryEntity.getName();
Long id = basicdataCategoryEntity.getId();
categoryMap.put(name, id);
}
}
R<List<DictBiz>> arteryR = dictBizClient.getList(DictBizConstant.CARRIAGE_ARTERY);
Map<String, String> arteryMap = new HashMap<>();
if (ObjectUtil.equal(CommonConstant.HTTP_SUCCESS_CODE, arteryR.getCode())) {
List<DictBiz> data = arteryR.getData();
if (CollUtil.isNotEmpty(data)) {
for (DictBiz datum : data) {
arteryMap.put(datum.getDictValue(), datum.getDictKey());
}
}
}
R<List<DictBiz>> entrepotR = dictBizClient.getList(DictBizConstant.CARRIAGE_ENTREPOT);
Map<String, String> entrepotMap = new HashMap<>();
if (ObjectUtil.equal(CommonConstant.HTTP_SUCCESS_CODE, entrepotR.getCode())) {
List<DictBiz> data = entrepotR.getData();
if (CollUtil.isNotEmpty(data)) {
for (DictBiz datum : data) {
entrepotMap.put(datum.getDictValue(), datum.getDictKey());
}
}
}
R<List<DictBiz>> deliveryR = dictBizClient.getList(DictBizConstant.CARRIAGE_DELIVERY);
Map<String, String> deliveryMap = new HashMap<>();
if (ObjectUtil.equal(CommonConstant.HTTP_SUCCESS_CODE, deliveryR.getCode())) {
List<DictBiz> data = deliveryR.getData();
if (CollUtil.isNotEmpty(data)) {
for (DictBiz datum : data) {
deliveryMap.put(datum.getDictValue(), datum.getDictKey());
}
}
}
R<List<DictBiz>> formulaModeR = dictBizClient.getList(DictBizConstant.BASIC_FREIGHT_FORMULAMODE);
Map<String, String> formulaModeMap = new HashMap<>();
if (ObjectUtil.equal(CommonConstant.HTTP_SUCCESS_CODE, formulaModeR.getCode())) {
List<DictBiz> data = formulaModeR.getData();
if (CollUtil.isNotEmpty(data)) {
for (DictBiz datum : data) {
formulaModeMap.put(datum.getDictValue(), datum.getDictKey());
}
}
}
R<List<DictBiz>> typeR = dictBizClient.getList(DictBizConstant.BASIC_FREIGHT_TYPE);
Map<String, String> typeMap = new HashMap<>();
if (ObjectUtil.equal(CommonConstant.HTTP_SUCCESS_CODE, typeR.getCode())) {
List<DictBiz> data = typeR.getData();
if (CollUtil.isNotEmpty(data)) {
for (DictBiz datum : data) {
typeMap.put(datum.getDictValue(), datum.getDictKey());
}
}
}
EasyExcel.read(file.getInputStream(),
BasicdataFreightExcel.class,
new BasicdataFreightCheckListener(this, message, brandMap, clientMap, categoryMap, arteryMap, entrepotMap, deliveryMap, formulaModeMap)
).sheet().doRead();
if (StrUtil.isNotBlank(message.toString())) {
return message.toString();
}
EasyExcel.read(file.getInputStream(),
BasicdataFreightExcel.class,
new BasicdataFreightSaveListener(this, brandMap, clientMap, categoryMap,
arteryMap, entrepotMap, deliveryMap, formulaModeMap, typeMap)
).sheet().doRead();
} catch (IOException e) {
e.printStackTrace();
}
return "导入成功";
}
@Override
public void checkData(List<BasicdataFreightExcel> list, StringBuilder message, AtomicLong andIncrement, Map<String, Long> brandMap,
Map<String, Long> clientMap, Map<String, Long> categoryMap, Map<String, String> arteryMap,
Map<String, String> entrepotMap, Map<String, String> deliveryMap, Map<String, String> formulaModeMap) {
// 客户名称 品牌 发货单位 品类 不能为空,且数据在数据库中存在
for (BasicdataFreightExcel data : list) {
StringBuilder rowMessage = new StringBuilder();
String firstMessage = "第" + andIncrement.getAndIncrement() + "行,";
String brand = data.getBrand();
String name = data.getName();
String categoryName = data.getCategoryName();
String forwardingUnitName = data.getForwardingUnitName();
if (StrUtil.isBlank(brand)) {
rowMessage.append("品牌不能为空。");
} else {
// 校验品牌在数据库中是否存在
if (!brandMap.containsKey(brand)) {
rowMessage.append("品牌[" + brand + "]在系统中不存在。");
}
}
if (StrUtil.isBlank(name)) {
rowMessage.append("客户名称不能为空。");
} else {
if (!clientMap.containsKey(name)) {
rowMessage.append("客户名称[" + name + "]在系统中不存在。");
}
}
String categoryNames = categoryName.replaceAll(",", ",");
List<String> split = StrUtil.split(categoryNames, ",");
if (CollUtil.isNotEmpty(split)) {
for (String s : split) {
if (StrUtil.isBlank(s)) {
rowMessage.append("品类不能为空。");
} else {
if (!categoryMap.containsKey(s)) {
rowMessage.append("品类[" + s + "]在系统中不存在。");
}
}
}
}
if (StrUtil.isBlank(forwardingUnitName)) {
rowMessage.append("发货单位不能为空。");
} else {
if (!clientMap.containsKey(forwardingUnitName)) {
rowMessage.append("发货单位[" + forwardingUnitName + "]在系统中不存在。");
}
}
String freightFee = data.getFreightFee();
String freightFeeUnit = data.getFreightFeeUnit();
if (StrUtil.isNotBlank(freightFee)) {
if (!NumberUtil.isNumber(freightFee)) {
rowMessage.append("干线-运费只能填数字。");
}
}
if (StrUtil.isNotBlank(freightFeeUnit)) {
if (!formulaModeMap.containsKey(freightFeeUnit)) {
rowMessage.append("干线-运费单位[" + freightFeeUnit + "]在系统中不存在。");
}
}
String zeroStorageFee = data.getZeroStorageFee();
String zeroStorageFeeUnit = data.getZeroStorageFeeUnit();
if (StrUtil.isNotBlank(zeroStorageFee)) {
if (!NumberUtil.isNumber(zeroStorageFee)) {
rowMessage.append("仓库-0-30天仓储费只能填数字。");
}
}
if (StrUtil.isNotBlank(zeroStorageFeeUnit)) {
if (!formulaModeMap.containsKey(zeroStorageFeeUnit)) {
rowMessage.append("仓库-0-30天仓储费单位[" + zeroStorageFeeUnit + "]在系统中不存在。");
}
}
String thirtyStorageFee = data.getThirtyStorageFee();
String thirtyStorageFeeUnit = data.getThirtyStorageFeeUnit();
if (StrUtil.isNotBlank(thirtyStorageFee)) {
if (!NumberUtil.isNumber(thirtyStorageFee)) {
rowMessage.append("仓库-31-60天仓储费只能填数字。");
}
}
if (StrUtil.isNotBlank(thirtyStorageFeeUnit)) {
if (!formulaModeMap.containsKey(thirtyStorageFeeUnit)) {
rowMessage.append("仓库-31-60天仓储费单位[" + thirtyStorageFeeUnit + "]在系统中不存在。");
}
}
String sixtyStorageFee = data.getSixtyStorageFee();
String sixtyStorageFeeUnit = data.getSixtyStorageFeeUnit();
if (StrUtil.isNotBlank(sixtyStorageFee)) {
if (!NumberUtil.isNumber(sixtyStorageFee)) {
rowMessage.append("仓库-61天以上仓储费只能填数字。");
}
}
if (StrUtil.isNotBlank(sixtyStorageFeeUnit)) {
if (!formulaModeMap.containsKey(sixtyStorageFeeUnit)) {
rowMessage.append("仓库-61天以上仓储费单位[" + sixtyStorageFeeUnit + "]在系统中不存在。");
}
}
String managerFee = data.getManagerFee();
String managerFeeUnit = data.getManagerFeeUnit();
if (StrUtil.isNotBlank(managerFee)) {
if (!NumberUtil.isNumber(managerFee)) {
rowMessage.append("仓库-管理费只能填数字。");
}
}
if (StrUtil.isNotBlank(managerFeeUnit)) {
if (!formulaModeMap.containsKey(managerFeeUnit)) {
rowMessage.append("仓库-仓库管理费单位[" + managerFeeUnit + "]在系统中不存在。");
}
}
String deliveryFee = data.getDeliveryFee();
String deliveryFeeUnit = data.getDeliveryFeeUnit();
if (StrUtil.isNotBlank(deliveryFee)) {
if (!NumberUtil.isNumber(deliveryFee)) {
rowMessage.append("配送-配送费只能填数字。");
}
}
if (StrUtil.isNotBlank(deliveryFeeUnit)) {
if (!formulaModeMap.containsKey(deliveryFeeUnit)) {
rowMessage.append("配送-配送费单位[" + deliveryFeeUnit + "]在系统中不存在。");
}
}
if (StrUtil.isNotBlank(rowMessage.toString())) {
message.append("<p>");
message.append(firstMessage);
message.append(rowMessage.toString());
message.append("</p>");
message.append("<br>");
}
}
}
@Override
public void saveData(List<BasicdataFreightExcel> list, Map<String, Long> brandMap, Map<String, Long> clientMap,
Map<String, Long> categoryMap, Map<String, String> arteryMap, Map<String, String> entrepotMap,
Map<String, String> deliveryMap, Map<String, String> formulaModeMap, Map<String, String> typeMap) {
if (CollUtil.isNotEmpty(list)) {
for (BasicdataFreightExcel excel : list) {
BasicdataFreightDTO vo = new BasicdataFreightDTO();
vo.setBrand(brandMap.get(excel.getBrand()));
vo.setBrandName(excel.getBrand());
String categoryName = excel.getCategoryName();
String categoryNames = categoryName.replaceAll(",", ",");
List<String> split = StrUtil.split(categoryNames, ",");
vo.setCategoryName(excel.getCategoryName());
if (CollUtil.isNotEmpty(split)) {
List<String> categoryIds = new ArrayList();
for (String s : split) {
String aLong = categoryMap.get(s).toString();
categoryIds.add(aLong);
}
vo.setCategory(String.join(",", categoryIds));
}
vo.setItemName(clientMap.get(excel.getName()).toString());
vo.setName(excel.getName());
vo.setForwardingUnitId(clientMap.get(excel.getForwardingUnitName()).toString());
vo.setForwardingUnitName(excel.getForwardingUnitName());
vo.setIdentification(1);
try {
DateTime dateTime = DateUtil.parseDateTime(excel.getEffectiveTime());
vo.setEffectiveTime(dateTime);
DateTime expirationTime = DateUtil.parseDateTime(excel.getExpirationTime());
vo.setExpirationTime(expirationTime);
} catch (Exception e) {
e.printStackTrace();
}
// 处理明细
String freightFee = excel.getFreightFee();
Set<String> typeServicIds = new HashSet<>();
List<BasicdataFreightDetailDTO> details = new ArrayList<>();
String freightFrrUnit = "";
if (StrUtil.isNotBlank(excel.getFreightFeeUnit())) {
freightFrrUnit = formulaModeMap.get(excel.getFreightFeeUnit());
}
if (StrUtil.isNotBlank(freightFee)) {
typeServicIds.add("1");
String typeName = "干线";
String itemName = "运费";
String typeId = typeMap.get(typeName);
String itemId = arteryMap.get(itemName);
buildDetails(excel, freightFee, details, typeName, itemName, typeId, freightFrrUnit, itemId);
}
String zeroStorageFee = excel.getZeroStorageFee();
if (StrUtil.isNotBlank(zeroStorageFee)) {
typeServicIds.add("2");
String typeName = "仓库";
String itemName = "0-30天仓储费";
String typeId = typeMap.get(typeName);
String itemId = entrepotMap.get(itemName);
buildDetails(excel, zeroStorageFee, details, typeName, itemName, typeId, freightFrrUnit, itemId);
}
String thirtyStorageFee = excel.getThirtyStorageFee();
if (StrUtil.isNotBlank(thirtyStorageFee)) {
typeServicIds.add("2");
String typeName = "仓库";
String itemName = "31-60仓储费";
String typeId = typeMap.get(typeName);
String itemId = entrepotMap.get(itemName);
buildDetails(excel, thirtyStorageFee, details, typeName, itemName, typeId, freightFrrUnit, itemId);
}
String sixtyStorageFee = excel.getSixtyStorageFee();
if (StrUtil.isNotBlank(sixtyStorageFee)) {
typeServicIds.add("2");
String typeName = "仓库";
String itemName = "61天以上仓储费";
String typeId = typeMap.get(typeName);
String itemId = entrepotMap.get(itemName);
buildDetails(excel, sixtyStorageFee, details, typeName, itemName, typeId, freightFrrUnit, itemId);
}
String managerFee = excel.getManagerFee();
if (StrUtil.isNotBlank(managerFee)) {
typeServicIds.add("2");
String typeName = "仓库";
String itemName = "仓库管理费";
String typeId = typeMap.get(typeName);
String itemId = entrepotMap.get(itemName);
buildDetails(excel, managerFee, details, typeName, itemName, typeId, freightFrrUnit, itemId);
}
String deliveryFee = excel.getDeliveryFee();
if (StrUtil.isNotBlank(deliveryFee)) {
typeServicIds.add("3");
String typeName = "配送";
String itemName = "配送费";
String typeId = typeMap.get(typeName);
String itemId = deliveryMap.get(itemName);
buildDetails(excel, deliveryFee, details, typeName, itemName, typeId, freightFrrUnit, itemId);
}
vo.setType(String.join(",", typeServicIds));
vo.setFixedPrice((byte) 0);
vo.setDetails(details);
this.ownSaveOrUpdate(vo);
}
}
}
private void buildDetails(BasicdataFreightExcel excel, String freightFee, List<BasicdataFreightDetailDTO> details, String typeName, String itemName, String typeId, String formulaMode, String itemId) {
BasicdataFreightDetailDTO detailDTO = new BasicdataFreightDetailDTO();
detailDTO.setCost(new BigDecimal(freightFee));
detailDTO.setTypeName(typeName);
detailDTO.setTypeId(typeId);
detailDTO.setFormulaModeName(excel.getFreightFeeUnit());
detailDTO.setFormulaMode(Long.parseLong(formulaMode));
detailDTO.setItemName(itemName);
detailDTO.setItemId(itemId);
details.add(detailDTO);
}
}

20
blade-service/logpm-basicdata/src/main/java/com/logpm/basicdata/service/impl/BasicdataGoodsAllocationServiceImpl.java

@ -34,11 +34,11 @@ import com.logpm.basicdata.mapper.BasicdataGoodsAllocationMapper;
import com.logpm.basicdata.mapper.BasicdataGoodsAreaMapper;
import com.logpm.basicdata.service.IBasicdataGoodsAllocationService;
import com.logpm.basicdata.service.IBasicdataWarehouseService;
import com.logpm.basicdata.vo.*;
import com.logpm.basicdata.vo.BasicdataGoodsAllocationVO;
import com.logpm.basicdata.vo.BasicdataNodeVO;
import com.logpm.basicdata.vo.FreightSpaceVO;
import com.logpm.basicdata.vo.WarehouseAllocationInfoVO;
import com.logpm.warehouse.feign.IWarehouseUpdownGoodsClient;
import com.logpm.warehouse.vo.WarehouseStockArticleZationVO;
import com.logpm.warehouse.vo.WarehouseStockListZationVO;
import com.logpm.warehouse.vo.WarehouseVisualizationVO;
import lombok.AllArgsConstructor;
import lombok.extern.log4j.Log4j2;
import org.springblade.common.constant.printTemplate.PrintTemplateStatusConstant;
@ -200,6 +200,18 @@ public class BasicdataGoodsAllocationServiceImpl extends BaseServiceImpl<Basicda
basicdataGoodsAllocation.put("warehouseList", collect);
return goodsAllocationMapper.selectGoodsAllocationList(page, basicdataGoodsAllocation);
}
@Override
public List<BasicdataGoodsAllocationVO> selectGoodsAllocationList(Map<String, Object> basicdataGoodsAllocation) {
//这里前端进行了封装,不需要再进行处理了
//获取当前登录人仓库
List<BasicdataWarehouseEntity> myWatchWarehouse = basicdataWarehouseClient.getMyWatchWarehouse();
List<Long> collect = myWatchWarehouse.stream()
.map(BasicdataWarehouseEntity::getId)
.collect(Collectors.toList());
basicdataGoodsAllocation.put("warehouseList", collect);
return goodsAllocationMapper.selectGoodsAllocationListNoPage(basicdataGoodsAllocation);
}
@Override

Loading…
Cancel
Save