Merge remote-tracking branch 'origin/feature/20260716/wms-module' into feature/20260716/wms-module
# Conflicts: # nl-module-wms/nl-module-wms-server/src/main/java/cn/code/nl/module/wms/framework/rpc/config/RpcConfiguration.java
This commit is contained in:
@@ -0,0 +1,111 @@
|
||||
package cn.code.nl.module.wms.controller.admin.storagevehicleinfo;
|
||||
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.security.access.prepost.PreAuthorize;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
|
||||
import jakarta.validation.constraints.*;
|
||||
import jakarta.validation.*;
|
||||
import jakarta.servlet.http.*;
|
||||
import java.util.*;
|
||||
import java.io.IOException;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.PageParam;
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.common.pojo.CommonResult;
|
||||
import cn.code.nl.framework.common.util.object.BeanUtils;
|
||||
import static cn.code.nl.framework.common.pojo.CommonResult.success;
|
||||
|
||||
import cn.code.nl.framework.excel.core.util.ExcelUtils;
|
||||
|
||||
import cn.code.nl.framework.apilog.core.annotation.ApiAccessLog;
|
||||
import static cn.code.nl.framework.apilog.core.enums.OperateTypeEnum.*;
|
||||
|
||||
import cn.code.nl.module.wms.controller.admin.storagevehicleinfo.vo.*;
|
||||
import cn.code.nl.module.wms.dal.dataobject.storagevehicleinfo.StorageVehicleInfoDO;
|
||||
import cn.code.nl.module.wms.service.storagevehicleinfo.StorageVehicleInfoService;
|
||||
|
||||
@Tag(name = "管理后台 - 载具信息")
|
||||
@RestController
|
||||
@RequestMapping("/wms/storage-vehicle-info")
|
||||
@Validated
|
||||
public class StorageVehicleInfoController {
|
||||
|
||||
@Resource
|
||||
private StorageVehicleInfoService storageVehicleInfoService;
|
||||
|
||||
@PostMapping("/create")
|
||||
@Operation(summary = "创建载具信息")
|
||||
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-info:create')")
|
||||
public CommonResult<Long> createStorageVehicleInfo(@Valid @RequestBody StorageVehicleInfoSaveReqVO createReqVO) {
|
||||
return success(storageVehicleInfoService.createStorageVehicleInfo(createReqVO));
|
||||
}
|
||||
|
||||
@PostMapping("/batch-create")
|
||||
@Operation(summary = "批量生成载具信息")
|
||||
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-info:create')")
|
||||
public CommonResult<List<Long>> batchCreateStorageVehicleInfo(@Valid @RequestBody StorageVehicleInfoBatchCreateReqVO reqVO) {
|
||||
return success(storageVehicleInfoService.batchCreateStorageVehicleInfo(reqVO));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
@Operation(summary = "更新载具信息")
|
||||
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-info:update')")
|
||||
public CommonResult<Boolean> updateStorageVehicleInfo(@Valid @RequestBody StorageVehicleInfoSaveReqVO updateReqVO) {
|
||||
storageVehicleInfoService.updateStorageVehicleInfo(updateReqVO);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete")
|
||||
@Operation(summary = "删除载具信息")
|
||||
@Parameter(name = "id", description = "编号", required = true)
|
||||
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-info:delete')")
|
||||
public CommonResult<Boolean> deleteStorageVehicleInfo(@RequestParam("id") Long id) {
|
||||
storageVehicleInfoService.deleteStorageVehicleInfo(id);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@DeleteMapping("/delete-list")
|
||||
@Parameter(name = "ids", description = "编号", required = true)
|
||||
@Operation(summary = "批量删除载具信息")
|
||||
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-info:delete')")
|
||||
public CommonResult<Boolean> deleteStorageVehicleInfoList(@RequestParam("ids") List<Long> ids) {
|
||||
storageVehicleInfoService.deleteStorageVehicleInfoListByIds(ids);
|
||||
return success(true);
|
||||
}
|
||||
|
||||
@GetMapping("/get")
|
||||
@Operation(summary = "获得载具信息")
|
||||
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
||||
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-info:query')")
|
||||
public CommonResult<StorageVehicleInfoRespVO> getStorageVehicleInfo(@RequestParam("id") Long id) {
|
||||
StorageVehicleInfoDO storageVehicleInfo = storageVehicleInfoService.getStorageVehicleInfo(id);
|
||||
return success(BeanUtils.toBean(storageVehicleInfo, StorageVehicleInfoRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/page")
|
||||
@Operation(summary = "获得载具信息分页")
|
||||
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-info:query')")
|
||||
public CommonResult<PageResult<StorageVehicleInfoRespVO>> getStorageVehicleInfoPage(@Valid StorageVehicleInfoPageReqVO pageReqVO) {
|
||||
PageResult<StorageVehicleInfoDO> pageResult = storageVehicleInfoService.getStorageVehicleInfoPage(pageReqVO);
|
||||
return success(BeanUtils.toBean(pageResult, StorageVehicleInfoRespVO.class));
|
||||
}
|
||||
|
||||
@GetMapping("/export-excel")
|
||||
@Operation(summary = "导出载具信息 Excel")
|
||||
@PreAuthorize("@ss.hasPermission('wms:storage-vehicle-info:export')")
|
||||
@ApiAccessLog(operateType = EXPORT)
|
||||
public void exportStorageVehicleInfoExcel(@Valid StorageVehicleInfoPageReqVO pageReqVO,
|
||||
HttpServletResponse response) throws IOException {
|
||||
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
|
||||
List<StorageVehicleInfoDO> list = storageVehicleInfoService.getStorageVehicleInfoPage(pageReqVO).getList();
|
||||
// 导出 Excel
|
||||
ExcelUtils.write(response, "载具信息.xls", "数据", StorageVehicleInfoRespVO.class,
|
||||
BeanUtils.toBean(list, StorageVehicleInfoRespVO.class));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package cn.code.nl.module.wms.controller.admin.storagevehicleinfo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.Data;
|
||||
|
||||
@Schema(description = "管理后台 - 载具信息批量生成 Request VO")
|
||||
@Data
|
||||
public class StorageVehicleInfoBatchCreateReqVO {
|
||||
|
||||
@Schema(description = "载具类型", requiredMode = Schema.RequiredMode.REQUIRED, example = "MTP")
|
||||
@NotEmpty(message = "载具类型不能为空")
|
||||
private String storageVehicleType;
|
||||
|
||||
@Schema(description = "载具类型中文名", requiredMode = Schema.RequiredMode.REQUIRED, example = "木托盘")
|
||||
@NotEmpty(message = "载具类型中文名不能为空")
|
||||
private String storageVehicleTypeLabel;
|
||||
|
||||
@Schema(description = "生成数量", requiredMode = Schema.RequiredMode.REQUIRED, example = "5")
|
||||
@NotNull(message = "生成数量不能为空")
|
||||
@Min(value = 1, message = "生成数量至少为1")
|
||||
private Integer count;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package cn.code.nl.module.wms.controller.admin.storagevehicleinfo.vo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import cn.code.nl.framework.common.pojo.PageParam;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
|
||||
import static cn.code.nl.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND;
|
||||
|
||||
@Schema(description = "管理后台 - 载具信息分页 Request VO")
|
||||
@Data
|
||||
public class StorageVehicleInfoPageReqVO extends PageParam {
|
||||
|
||||
@Schema(description = "载具编码")
|
||||
private String storageVehicleCode;
|
||||
|
||||
@Schema(description = "载具名称")
|
||||
private String storageVehicleName;
|
||||
|
||||
@Schema(description = "一维码")
|
||||
private String oneCode;
|
||||
|
||||
@Schema(description = "二维码")
|
||||
private String twoCode;
|
||||
|
||||
@Schema(description = "是否启用")
|
||||
private Boolean isUsed;
|
||||
|
||||
@Schema(description = "载具类型")
|
||||
private String storageVehicleType;
|
||||
|
||||
@Schema(description = "载具宽度")
|
||||
private Integer vehicleWidth;
|
||||
|
||||
@Schema(description = "载具长度")
|
||||
private Integer vehicleLong;
|
||||
|
||||
@Schema(description = "载具高度")
|
||||
private Integer vehicleHeight;
|
||||
|
||||
@Schema(description = "托盘重量")
|
||||
private BigDecimal weigth;
|
||||
|
||||
@Schema(description = "载具是否超仓位")
|
||||
private String overStructType;
|
||||
|
||||
@Schema(description = "占仓位数")
|
||||
private Integer occupyStructQty;
|
||||
|
||||
@Schema(description = "木箱号")
|
||||
private String boxNo;
|
||||
|
||||
@Schema(description = "创建时间")
|
||||
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND)
|
||||
private LocalDateTime[] createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package cn.code.nl.module.wms.controller.admin.storagevehicleinfo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
import java.time.LocalDateTime;
|
||||
import cn.idev.excel.annotation.*;
|
||||
|
||||
@Schema(description = "管理后台 - 载具信息 Response VO")
|
||||
@Data
|
||||
@ExcelIgnoreUnannotated
|
||||
public class StorageVehicleInfoRespVO {
|
||||
|
||||
private Long storageVehicleId;
|
||||
|
||||
@Schema(description = "载具编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("载具编码")
|
||||
private String storageVehicleCode;
|
||||
|
||||
@Schema(description = "载具名称")
|
||||
@ExcelProperty("载具名称")
|
||||
private String storageVehicleName;
|
||||
|
||||
@Schema(description = "一维码")
|
||||
@ExcelProperty("一维码")
|
||||
private String oneCode;
|
||||
|
||||
@Schema(description = "二维码")
|
||||
@ExcelProperty("二维码")
|
||||
private String twoCode;
|
||||
|
||||
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("是否启用")
|
||||
private Boolean isUsed;
|
||||
|
||||
@Schema(description = "载具类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("载具类型")
|
||||
private String storageVehicleType;
|
||||
|
||||
@Schema(description = "载具宽度")
|
||||
@ExcelProperty("载具宽度")
|
||||
private Integer vehicleWidth;
|
||||
|
||||
@Schema(description = "载具长度")
|
||||
@ExcelProperty("载具长度")
|
||||
private Integer vehicleLong;
|
||||
|
||||
@Schema(description = "载具高度")
|
||||
@ExcelProperty("载具高度")
|
||||
private Integer vehicleHeight;
|
||||
|
||||
@Schema(description = "托盘重量")
|
||||
@ExcelProperty("托盘重量")
|
||||
private BigDecimal weigth;
|
||||
|
||||
@Schema(description = "载具是否超仓位", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("载具是否超仓位")
|
||||
private String overStructType;
|
||||
|
||||
@Schema(description = "占仓位数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("占仓位数")
|
||||
private Integer occupyStructQty;
|
||||
|
||||
@Schema(description = "木箱号", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("木箱号")
|
||||
private String boxNo;
|
||||
|
||||
@Schema(description = "外部标识")
|
||||
@ExcelProperty("外部标识")
|
||||
private String extId;
|
||||
|
||||
@Schema(description = "创建者")
|
||||
@ExcelProperty("创建者")
|
||||
private String creator;
|
||||
|
||||
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("创建时间")
|
||||
private LocalDateTime createTime;
|
||||
|
||||
@Schema(description = "更新者")
|
||||
@ExcelProperty("更新者")
|
||||
private String updater;
|
||||
|
||||
@Schema(description = "更新时间", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@ExcelProperty("更新时间")
|
||||
private LocalDateTime updateTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
package cn.code.nl.module.wms.controller.admin.storagevehicleinfo.vo;
|
||||
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import jakarta.validation.constraints.*;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Schema(description = "管理后台 - 载具信息新增/修改 Request VO")
|
||||
@Data
|
||||
public class StorageVehicleInfoSaveReqVO {
|
||||
|
||||
private Long storageVehicleId;
|
||||
|
||||
@Schema(description = "载具编码", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
private String storageVehicleCode;
|
||||
|
||||
@Schema(description = "载具名称")
|
||||
private String storageVehicleName;
|
||||
|
||||
@Schema(description = "一维码")
|
||||
private String oneCode;
|
||||
|
||||
@Schema(description = "二维码")
|
||||
private String twoCode;
|
||||
|
||||
@Schema(description = "是否启用", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "是否启用不能为空")
|
||||
private Boolean isUsed;
|
||||
|
||||
@Schema(description = "载具类型", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "载具类型不能为空")
|
||||
private String storageVehicleType;
|
||||
|
||||
@Schema(description = "载具宽度")
|
||||
private Integer vehicleWidth;
|
||||
|
||||
@Schema(description = "载具长度")
|
||||
private Integer vehicleLong;
|
||||
|
||||
@Schema(description = "载具高度")
|
||||
private Integer vehicleHeight;
|
||||
|
||||
@Schema(description = "托盘重量")
|
||||
private BigDecimal weigth;
|
||||
|
||||
@Schema(description = "载具是否超仓位", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotEmpty(message = "载具是否超仓位不能为空")
|
||||
private String overStructType;
|
||||
|
||||
@Schema(description = "占仓位数", requiredMode = Schema.RequiredMode.REQUIRED)
|
||||
@NotNull(message = "占仓位数不能为空")
|
||||
private Integer occupyStructQty;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,85 @@
|
||||
package cn.code.nl.module.wms.dal.dataobject.storagevehicleinfo;
|
||||
|
||||
import lombok.*;
|
||||
import java.util.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.LocalDateTime;
|
||||
import java.time.LocalDateTime;
|
||||
import com.baomidou.mybatisplus.annotation.*;
|
||||
import cn.code.nl.framework.mybatis.core.dataobject.BaseDO;
|
||||
|
||||
/**
|
||||
* 载具信息 DO
|
||||
*
|
||||
* @author 诺力管理员
|
||||
*/
|
||||
@TableName("wms_storage_vehicle_info")
|
||||
@KeySequence("wms_storage_vehicle_info_seq") // 用于 Oracle、PostgreSQL、Kingbase、DB2、H2 数据库的主键自增。如果是 MySQL 等数据库,可不写。
|
||||
@Data
|
||||
@EqualsAndHashCode(callSuper = true)
|
||||
@ToString(callSuper = true)
|
||||
@Builder
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
public class StorageVehicleInfoDO extends BaseDO {
|
||||
|
||||
/**
|
||||
* 载具标识
|
||||
*/
|
||||
@TableId
|
||||
private Long storageVehicleId;
|
||||
/**
|
||||
* 载具编码
|
||||
*/
|
||||
private String storageVehicleCode;
|
||||
/**
|
||||
* 载具名称
|
||||
*/
|
||||
private String storageVehicleName;
|
||||
/**
|
||||
* 一维码
|
||||
*/
|
||||
private String oneCode;
|
||||
/**
|
||||
* 二维码
|
||||
*/
|
||||
private String twoCode;
|
||||
/**
|
||||
* 是否启用
|
||||
*/
|
||||
private Boolean isUsed;
|
||||
/**
|
||||
* 载具类型
|
||||
*/
|
||||
private String storageVehicleType;
|
||||
/**
|
||||
* 载具宽度
|
||||
*/
|
||||
private Integer vehicleWidth;
|
||||
/**
|
||||
* 载具长度
|
||||
*/
|
||||
private Integer vehicleLong;
|
||||
/**
|
||||
* 载具高度
|
||||
*/
|
||||
private Integer vehicleHeight;
|
||||
/**
|
||||
* 托盘重量
|
||||
*/
|
||||
private BigDecimal weigth;
|
||||
/**
|
||||
* 载具是否超仓位
|
||||
*/
|
||||
private String overStructType;
|
||||
/**
|
||||
* 占仓位数
|
||||
*/
|
||||
private Integer occupyStructQty;
|
||||
/**
|
||||
* 外部标识
|
||||
*/
|
||||
private String extId;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
package cn.code.nl.module.wms.dal.mysql.storagevehicleinfo;
|
||||
|
||||
import java.util.*;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.mybatis.core.query.LambdaQueryWrapperX;
|
||||
import cn.code.nl.framework.mybatis.core.mapper.BaseMapperX;
|
||||
import cn.code.nl.module.wms.dal.dataobject.storagevehicleinfo.StorageVehicleInfoDO;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import cn.code.nl.module.wms.controller.admin.storagevehicleinfo.vo.*;
|
||||
|
||||
/**
|
||||
* 载具信息 Mapper
|
||||
*
|
||||
* @author 诺力管理员
|
||||
*/
|
||||
@Mapper
|
||||
public interface StorageVehicleInfoMapper extends BaseMapperX<StorageVehicleInfoDO> {
|
||||
|
||||
default PageResult<StorageVehicleInfoDO> selectPage(StorageVehicleInfoPageReqVO reqVO) {
|
||||
return selectPage(reqVO, new LambdaQueryWrapperX<StorageVehicleInfoDO>()
|
||||
.eqIfPresent(StorageVehicleInfoDO::getStorageVehicleCode, reqVO.getStorageVehicleCode())
|
||||
.likeIfPresent(StorageVehicleInfoDO::getStorageVehicleName, reqVO.getStorageVehicleName())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getOneCode, reqVO.getOneCode())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getTwoCode, reqVO.getTwoCode())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getIsUsed, reqVO.getIsUsed())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getStorageVehicleType, reqVO.getStorageVehicleType())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getVehicleWidth, reqVO.getVehicleWidth())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getVehicleLong, reqVO.getVehicleLong())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getVehicleHeight, reqVO.getVehicleHeight())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getWeigth, reqVO.getWeigth())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getOverStructType, reqVO.getOverStructType())
|
||||
.eqIfPresent(StorageVehicleInfoDO::getOccupyStructQty, reqVO.getOccupyStructQty())
|
||||
.betweenIfPresent(StorageVehicleInfoDO::getCreateTime, reqVO.getCreateTime())
|
||||
.orderByDesc(StorageVehicleInfoDO::getStorageVehicleId));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -4,7 +4,12 @@ import cn.code.nl.module.base.api.codegen.CodeGenApi;
|
||||
import org.springframework.cloud.openfeign.EnableFeignClients;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
*
|
||||
* @Author: liyongde
|
||||
* @Date: 2026/7/22 13:50
|
||||
*/
|
||||
@Configuration(value = "wmsRpcConfiguration", proxyBeanMethods = false)
|
||||
@EnableFeignClients(clients = CodeGenApi.class)
|
||||
@EnableFeignClients(clients = {CodeGenApi.class})
|
||||
public class RpcConfiguration {
|
||||
}
|
||||
|
||||
@@ -2,10 +2,13 @@ package cn.code.nl.module.wms.service.groupplate;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.common.util.object.BeanUtils;
|
||||
import cn.code.nl.framework.security.core.util.SecurityFrameworkUtils;
|
||||
import cn.code.nl.module.wms.controller.admin.groupplate.vo.GroupPlatePageReqVO;
|
||||
import cn.code.nl.module.wms.controller.admin.groupplate.vo.GroupPlateSaveReqVO;
|
||||
import cn.code.nl.module.wms.dal.dataobject.groupplate.GroupPlateDO;
|
||||
import cn.code.nl.module.wms.dal.mysql.groupplate.GroupPlateMapper;
|
||||
import com.mzt.logapi.context.LogRecordContext;
|
||||
import com.mzt.logapi.starter.annotation.LogRecord;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
@@ -13,6 +16,7 @@ import org.springframework.validation.annotation.Validated;
|
||||
import java.util.List;
|
||||
|
||||
import static cn.code.nl.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.code.nl.module.system.enums.LogRecordConstants.*;
|
||||
import static cn.code.nl.module.wms.enums.ErrorCodeConstants.GROUP_PLATE_NOT_EXISTS;
|
||||
|
||||
/**
|
||||
@@ -38,12 +42,16 @@ public class GroupPlateServiceImpl implements GroupPlateService {
|
||||
}
|
||||
|
||||
@Override
|
||||
@LogRecord(type = WMS_GROUP_PLATE, subType = WMS_GROUP_PLATE_UPDATE, bizNo = "{{#updateReqVO.groupId}}",
|
||||
success = WMS_GROUP_PLATE_SUCCESS)
|
||||
public void updateGroupPlate(GroupPlateSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateGroupPlateExists(updateReqVO.getGroupId());
|
||||
// 更新
|
||||
GroupPlateDO updateObj = BeanUtils.toBean(updateReqVO, GroupPlateDO.class);
|
||||
groupPlateMapper.updateById(updateObj);
|
||||
LogRecordContext.putVariable("loginUserNickname", SecurityFrameworkUtils.getLoginUserNickname());
|
||||
LogRecordContext.putVariable("group", updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,71 @@
|
||||
package cn.code.nl.module.wms.service.storagevehicleinfo;
|
||||
|
||||
import java.util.*;
|
||||
import jakarta.validation.*;
|
||||
import cn.code.nl.module.wms.controller.admin.storagevehicleinfo.vo.*;
|
||||
import cn.code.nl.module.wms.dal.dataobject.storagevehicleinfo.StorageVehicleInfoDO;
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.common.pojo.PageParam;
|
||||
import cn.code.nl.framework.common.pojo.CommonResult;
|
||||
|
||||
/**
|
||||
* 载具信息 Service 接口
|
||||
*
|
||||
* @author 诺力管理员
|
||||
*/
|
||||
public interface StorageVehicleInfoService {
|
||||
|
||||
/**
|
||||
* 创建载具信息
|
||||
*
|
||||
* @param createReqVO 创建信息
|
||||
* @return 编号
|
||||
*/
|
||||
Long createStorageVehicleInfo(@Valid StorageVehicleInfoSaveReqVO createReqVO);
|
||||
|
||||
/**
|
||||
* 更新载具信息
|
||||
*
|
||||
* @param updateReqVO 更新信息
|
||||
*/
|
||||
void updateStorageVehicleInfo(@Valid StorageVehicleInfoSaveReqVO updateReqVO);
|
||||
|
||||
/**
|
||||
* 删除载具信息
|
||||
*
|
||||
* @param id 编号
|
||||
*/
|
||||
void deleteStorageVehicleInfo(Long id);
|
||||
|
||||
/**
|
||||
* 批量删除载具信息
|
||||
*
|
||||
* @param ids 编号
|
||||
*/
|
||||
void deleteStorageVehicleInfoListByIds(List<Long> ids);
|
||||
|
||||
/**
|
||||
* 获得载具信息
|
||||
*
|
||||
* @param id 编号
|
||||
* @return 载具信息
|
||||
*/
|
||||
StorageVehicleInfoDO getStorageVehicleInfo(Long id);
|
||||
|
||||
/**
|
||||
* 获得载具信息分页
|
||||
*
|
||||
* @param pageReqVO 分页查询
|
||||
* @return 载具信息分页
|
||||
*/
|
||||
PageResult<StorageVehicleInfoDO> getStorageVehicleInfoPage(StorageVehicleInfoPageReqVO pageReqVO);
|
||||
|
||||
/**
|
||||
* 批量生成载具信息
|
||||
*
|
||||
* @param reqVO 批量生成请求
|
||||
* @return 生成的载具ID列表
|
||||
*/
|
||||
List<Long> batchCreateStorageVehicleInfo(StorageVehicleInfoBatchCreateReqVO reqVO);
|
||||
|
||||
}
|
||||
@@ -0,0 +1,123 @@
|
||||
package cn.code.nl.module.wms.service.storagevehicleinfo;
|
||||
|
||||
import cn.code.nl.framework.common.pojo.CommonResult;
|
||||
import cn.code.nl.module.base.api.codegen.CodeGenApi;
|
||||
import cn.code.nl.module.base.api.codegen.dto.CodeGenerateReqDTO;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import org.springframework.stereotype.Service;
|
||||
import jakarta.annotation.Resource;
|
||||
import org.springframework.validation.annotation.Validated;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.regex.*;
|
||||
import cn.code.nl.module.wms.controller.admin.storagevehicleinfo.vo.*;
|
||||
import cn.code.nl.module.wms.dal.dataobject.storagevehicleinfo.StorageVehicleInfoDO;
|
||||
import cn.code.nl.framework.common.pojo.PageResult;
|
||||
import cn.code.nl.framework.common.pojo.PageParam;
|
||||
import cn.code.nl.framework.common.util.object.BeanUtils;
|
||||
|
||||
import cn.code.nl.module.wms.dal.mysql.storagevehicleinfo.StorageVehicleInfoMapper;
|
||||
|
||||
import static cn.code.nl.framework.common.exception.util.ServiceExceptionUtil.exception;
|
||||
import static cn.code.nl.framework.common.util.collection.CollectionUtils.convertList;
|
||||
import static cn.code.nl.framework.common.util.collection.CollectionUtils.diffList;
|
||||
import static cn.code.nl.module.wms.enums.ErrorCodeConstants.*;
|
||||
|
||||
/**
|
||||
* 载具信息 Service 实现类
|
||||
*
|
||||
* @author 诺力管理员
|
||||
*/
|
||||
@Service
|
||||
@Validated
|
||||
public class StorageVehicleInfoServiceImpl implements StorageVehicleInfoService {
|
||||
|
||||
@Resource
|
||||
private StorageVehicleInfoMapper storageVehicleInfoMapper;
|
||||
|
||||
@Resource
|
||||
private CodeGenApi codeGenApi;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Long createStorageVehicleInfo(StorageVehicleInfoSaveReqVO createReqVO) {
|
||||
// 插入
|
||||
StorageVehicleInfoDO storageVehicleInfo = BeanUtils.toBean(createReqVO, StorageVehicleInfoDO.class);
|
||||
CodeGenerateReqDTO codeGenerateReqDTO = new CodeGenerateReqDTO();
|
||||
codeGenerateReqDTO.setRuleCode(createReqVO.getStorageVehicleType() + "_CODE");
|
||||
CommonResult<String> generate = codeGenApi.generate(codeGenerateReqDTO);
|
||||
storageVehicleInfo.setStorageVehicleCode(generate.getData());
|
||||
storageVehicleInfoMapper.insert(storageVehicleInfo);
|
||||
// 返回
|
||||
return storageVehicleInfo.getStorageVehicleId();
|
||||
}
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public List<Long> batchCreateStorageVehicleInfo(StorageVehicleInfoBatchCreateReqVO reqVO) {
|
||||
List<Long> ids = new ArrayList<>();
|
||||
// 提取编码中数字部分的正则
|
||||
Pattern numPattern = Pattern.compile("\\d+");
|
||||
for (int i = 0; i < reqVO.getCount(); i++) {
|
||||
CodeGenerateReqDTO genReq = new CodeGenerateReqDTO();
|
||||
genReq.setRuleCode(reqVO.getStorageVehicleType() + "_CODE");
|
||||
CommonResult<String> result = codeGenApi.generate(genReq);
|
||||
String code = result.getData();
|
||||
// 提取编码中的数字部分
|
||||
String numSuffix = "";
|
||||
Matcher matcher = numPattern.matcher(code);
|
||||
if (matcher.find()) {
|
||||
numSuffix = matcher.group();
|
||||
}
|
||||
StorageVehicleInfoDO info = new StorageVehicleInfoDO();
|
||||
info.setStorageVehicleCode(code);
|
||||
info.setStorageVehicleName(reqVO.getStorageVehicleTypeLabel() + numSuffix);
|
||||
info.setStorageVehicleType(reqVO.getStorageVehicleType());
|
||||
storageVehicleInfoMapper.insert(info);
|
||||
ids.add(info.getStorageVehicleId());
|
||||
}
|
||||
return ids;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void updateStorageVehicleInfo(StorageVehicleInfoSaveReqVO updateReqVO) {
|
||||
// 校验存在
|
||||
validateStorageVehicleInfoExists(updateReqVO.getStorageVehicleId());
|
||||
// 更新
|
||||
StorageVehicleInfoDO updateObj = BeanUtils.toBean(updateReqVO, StorageVehicleInfoDO.class);
|
||||
storageVehicleInfoMapper.updateById(updateObj);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStorageVehicleInfo(Long id) {
|
||||
// 校验存在
|
||||
validateStorageVehicleInfoExists(id);
|
||||
// 删除
|
||||
storageVehicleInfoMapper.deleteById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteStorageVehicleInfoListByIds(List<Long> ids) {
|
||||
// 删除
|
||||
storageVehicleInfoMapper.deleteByIds(ids);
|
||||
}
|
||||
|
||||
|
||||
private void validateStorageVehicleInfoExists(Long id) {
|
||||
if (storageVehicleInfoMapper.selectById(id) == null) {
|
||||
throw exception(STORAGE_VEHICLE_INFO_NOT_EXISTS);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public StorageVehicleInfoDO getStorageVehicleInfo(Long id) {
|
||||
return storageVehicleInfoMapper.selectById(id);
|
||||
}
|
||||
|
||||
@Override
|
||||
public PageResult<StorageVehicleInfoDO> getStorageVehicleInfoPage(StorageVehicleInfoPageReqVO pageReqVO) {
|
||||
return storageVehicleInfoMapper.selectPage(pageReqVO);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.code.nl.module.wms.dal.mysql.groupplate.GroupPlateMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="cn.code.nl.module.wms.dal.mysql.storagevehicleinfo.StorageVehicleInfoMapper">
|
||||
|
||||
<!--
|
||||
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。
|
||||
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。
|
||||
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。
|
||||
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/
|
||||
-->
|
||||
|
||||
</mapper>
|
||||
Reference in New Issue
Block a user