添砖-JAVA\Administrator
6 months ago
17 changed files with 1041 additions and 5 deletions
@ -0,0 +1,109 @@ |
|||||
|
package com.win.module.eam.controller.inventorywarning; |
||||
|
|
||||
|
import com.win.framework.common.pojo.CommonResult; |
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.framework.excel.core.util.ExcelUtils; |
||||
|
import com.win.framework.operatelog.core.annotations.OperateLog; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.*; |
||||
|
import com.win.module.eam.convert.inventorywarning.InventoryWarningConvert; |
||||
|
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO; |
||||
|
import com.win.module.eam.service.inventorywarning.InventoryWarningService; |
||||
|
import io.swagger.v3.oas.annotations.Operation; |
||||
|
import io.swagger.v3.oas.annotations.Parameter; |
||||
|
import io.swagger.v3.oas.annotations.tags.Tag; |
||||
|
import org.springframework.security.access.prepost.PreAuthorize; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
import org.springframework.web.bind.annotation.*; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import javax.servlet.http.HttpServletResponse; |
||||
|
import javax.validation.Valid; |
||||
|
import java.io.IOException; |
||||
|
import java.util.Arrays; |
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import static com.win.framework.common.pojo.CommonResult.success; |
||||
|
import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; |
||||
|
|
||||
|
|
||||
|
@Tag(name = "管理后台 - 库存预警记录") |
||||
|
@RestController |
||||
|
@RequestMapping("/record/inventory-warning") |
||||
|
@Validated |
||||
|
public class InventoryWarningController { |
||||
|
|
||||
|
@Resource |
||||
|
private InventoryWarningService inventoryWarningService; |
||||
|
|
||||
|
@PostMapping("/create") |
||||
|
@Operation(summary = "创建库存预警记录") |
||||
|
@PreAuthorize("@ss.hasPermission('record:inventory-warning:create')") |
||||
|
public CommonResult<Integer> createInventoryWarning(@Valid @RequestBody InventoryWarningCreateReqVO createReqVO) { |
||||
|
return success(inventoryWarningService.createInventoryWarning(createReqVO)); |
||||
|
} |
||||
|
|
||||
|
@PutMapping("/update") |
||||
|
@Operation(summary = "更新库存预警记录") |
||||
|
@PreAuthorize("@ss.hasPermission('record:inventory-warning:update')") |
||||
|
public CommonResult<Boolean> updateInventoryWarning(@Valid @RequestBody InventoryWarningUpdateReqVO updateReqVO) { |
||||
|
int result = inventoryWarningService.updateInventoryWarning(updateReqVO); |
||||
|
return success(result > 0); |
||||
|
} |
||||
|
|
||||
|
@DeleteMapping("/delete") |
||||
|
@Operation(summary = "删除库存预警记录") |
||||
|
@Parameter(name = "id", description = "编号", required = true) |
||||
|
@PreAuthorize("@ss.hasPermission('record:inventory-warning:delete')") |
||||
|
public CommonResult<Boolean> deleteInventoryWarning(@RequestParam("id") Integer id) { |
||||
|
int result = inventoryWarningService.deleteInventoryWarning(id); |
||||
|
return success(result > 0); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/get") |
||||
|
@Operation(summary = "获得库存预警记录") |
||||
|
@Parameter(name = "id", description = "编号", required = true, example = "1024") |
||||
|
@PreAuthorize("@ss.hasPermission('record:inventory-warning:query')") |
||||
|
public CommonResult<InventoryWarningRespVO> getInventoryWarning(@RequestParam("id") Integer id) { |
||||
|
InventoryWarningDO inventoryWarning = inventoryWarningService.getInventoryWarning(id); |
||||
|
return success(InventoryWarningConvert.INSTANCE.convert(inventoryWarning)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/list") |
||||
|
@Operation(summary = "获得库存预警记录列表") |
||||
|
@Parameter(name = "ids", description = "编号列表", required = true, example = "1024,2048") |
||||
|
@PreAuthorize("@ss.hasPermission('record:inventory-warning:query')") |
||||
|
public CommonResult<List<InventoryWarningRespVO>> getInventoryWarningList(@RequestParam("ids") Collection<Integer> ids) { |
||||
|
List<InventoryWarningDO> list = inventoryWarningService.getInventoryWarningList(ids); |
||||
|
return success(InventoryWarningConvert.INSTANCE.convertList(list)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/page") |
||||
|
@Operation(summary = "获得库存预警记录分页") |
||||
|
@PreAuthorize("@ss.hasPermission('record:inventory-warning:query')") |
||||
|
public CommonResult<PageResult<InventoryWarningRespVO>> getInventoryWarningPage(@Valid InventoryWarningPageReqVO pageVO) { |
||||
|
PageResult<InventoryWarningDO> pageResult = inventoryWarningService.getInventoryWarningPage(pageVO); |
||||
|
return success(InventoryWarningConvert.INSTANCE.convertPage(pageResult)); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/export-excel") |
||||
|
@Operation(summary = "导出库存预警记录 Excel") |
||||
|
@PreAuthorize("@ss.hasPermission('record:inventory-warning:export')") |
||||
|
@OperateLog(type = EXPORT) |
||||
|
public void exportInventoryWarningExcel(@Valid InventoryWarningExportReqVO exportReqVO, |
||||
|
HttpServletResponse response) throws IOException { |
||||
|
List<InventoryWarningDO> list = inventoryWarningService.getInventoryWarningList(exportReqVO); |
||||
|
// 导出 Excel
|
||||
|
List<InventoryWarningExcelVO> datas = InventoryWarningConvert.INSTANCE.convertList02(list); |
||||
|
ExcelUtils.write(response, "库存预警记录.xls", "数据", InventoryWarningExcelVO.class, datas); |
||||
|
} |
||||
|
|
||||
|
@GetMapping("/get-import-template") |
||||
|
@Operation(summary = "获得导入库存预警记录模板") |
||||
|
public void importTemplate(HttpServletResponse response) throws IOException { |
||||
|
List<InventoryWarningExcelVO> list = Arrays.asList(); |
||||
|
// 输出
|
||||
|
ExcelUtils.write(response, "库存预警记录基本信息导入模板.xls", "库存预警记录基本信息列表", InventoryWarningExcelVO.class, list); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,95 @@ |
|||||
|
package com.win.module.eam.controller.inventorywarning.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import javax.validation.constraints.*; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
||||
|
|
||||
|
/** |
||||
|
* 库存预警记录 Base VO,提供给添加、修改、详细的子 VO 使用 |
||||
|
* 如果子 VO 存在差异的字段,请不要添加到这里,影响 Swagger 文档生成 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class InventoryWarningBaseVO { |
||||
|
|
||||
|
@Schema(description = "零件编码", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
@NotNull(message = "零件编码不能为空") |
||||
|
private String number; |
||||
|
|
||||
|
@Schema(description = "零件名称", example = "赵六") |
||||
|
private String name; |
||||
|
|
||||
|
@Schema(description = "库位名称") |
||||
|
private String locationNumber; |
||||
|
|
||||
|
@Schema(description = "规格型号") |
||||
|
private String specifications; |
||||
|
|
||||
|
@Schema(description = "单位") |
||||
|
private String uom; |
||||
|
|
||||
|
@Schema(description = "供应商名称", example = "王五") |
||||
|
private String supplierName; |
||||
|
|
||||
|
@Schema(description = "生产厂家") |
||||
|
private String brand; |
||||
|
|
||||
|
@Schema(description = "最高库存") |
||||
|
private BigDecimal maxInventory; |
||||
|
|
||||
|
@Schema(description = "最低库存") |
||||
|
private BigDecimal minInventory; |
||||
|
|
||||
|
@Schema(description = "最低库存") |
||||
|
private BigDecimal nowInventory; |
||||
|
|
||||
|
@Schema(description = "采购周期(周)") |
||||
|
private Integer procurementCycle; |
||||
|
|
||||
|
@Schema(description = "ABC分类") |
||||
|
private String classification; |
||||
|
|
||||
|
@Schema(description = "使用地点") |
||||
|
private String usePlace; |
||||
|
|
||||
|
@Schema(description = "项目") |
||||
|
private String project; |
||||
|
|
||||
|
@Schema(description = "价格", example = "29930") |
||||
|
private BigDecimal price; |
||||
|
|
||||
|
@Schema(description = "采购状态", requiredMode = Schema.RequiredMode.REQUIRED, example = "1") |
||||
|
@NotNull(message = "采购状态不能为空") |
||||
|
private String procureStatus; |
||||
|
|
||||
|
@Schema(description = "备注") |
||||
|
private String describes; |
||||
|
|
||||
|
@Schema(description = "删除时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime deletionTime; |
||||
|
|
||||
|
@Schema(description = "删除者ID", example = "21341") |
||||
|
private String deleterId; |
||||
|
|
||||
|
@Schema(description = "扩展属性") |
||||
|
private String extraProperties; |
||||
|
|
||||
|
@Schema(description = "并发乐观锁", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
@NotNull(message = "并发乐观锁不能为空") |
||||
|
private Integer concurrencyStamp; |
||||
|
|
||||
|
@Schema(description = "地点id", example = "12691") |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,14 @@ |
|||||
|
package com.win.module.eam.controller.inventorywarning.vo; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import javax.validation.constraints.*; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 库存预警记录创建 Request VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class InventoryWarningCreateReqVO extends InventoryWarningBaseVO { |
||||
|
|
||||
|
} |
@ -0,0 +1,96 @@ |
|||||
|
package com.win.module.eam.controller.inventorywarning.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
|
||||
|
/** |
||||
|
* 库存预警记录 Excel VO |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class InventoryWarningExcelVO { |
||||
|
|
||||
|
@ExcelProperty("id") |
||||
|
private Integer id; |
||||
|
|
||||
|
@ExcelProperty("零件编码") |
||||
|
private String number; |
||||
|
|
||||
|
@ExcelProperty("零件名称") |
||||
|
private String name; |
||||
|
|
||||
|
@ExcelProperty("库位名称") |
||||
|
private String locationNumber; |
||||
|
|
||||
|
@ExcelProperty("规格型号") |
||||
|
private String specifications; |
||||
|
|
||||
|
@ExcelProperty("单位") |
||||
|
private String uom; |
||||
|
|
||||
|
@ExcelProperty("供应商名称") |
||||
|
private String supplierName; |
||||
|
|
||||
|
@ExcelProperty("生产厂家") |
||||
|
private String brand; |
||||
|
|
||||
|
@ExcelProperty("最高库存") |
||||
|
private BigDecimal maxInventory; |
||||
|
|
||||
|
@ExcelProperty("最低库存") |
||||
|
private BigDecimal minInventory; |
||||
|
|
||||
|
@ExcelProperty("最低库存") |
||||
|
private BigDecimal nowInventory; |
||||
|
|
||||
|
@ExcelProperty("采购周期(周)") |
||||
|
private Integer procurementCycle; |
||||
|
|
||||
|
@ExcelProperty("ABC分类") |
||||
|
private String classification; |
||||
|
|
||||
|
@ExcelProperty("使用地点") |
||||
|
private String usePlace; |
||||
|
|
||||
|
@ExcelProperty("项目") |
||||
|
private String project; |
||||
|
|
||||
|
@ExcelProperty("价格") |
||||
|
private BigDecimal price; |
||||
|
|
||||
|
@ExcelProperty("采购状态") |
||||
|
private String procureStatus; |
||||
|
|
||||
|
@ExcelProperty("备注") |
||||
|
private String describes; |
||||
|
|
||||
|
@ExcelProperty("创建时间") |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
@ExcelProperty("删除时间") |
||||
|
private LocalDateTime deletionTime; |
||||
|
|
||||
|
@ExcelProperty("删除者ID") |
||||
|
private String deleterId; |
||||
|
|
||||
|
@ExcelProperty("扩展属性") |
||||
|
private String extraProperties; |
||||
|
|
||||
|
@ExcelProperty("并发乐观锁") |
||||
|
private Integer concurrencyStamp; |
||||
|
|
||||
|
@ExcelProperty("地点id") |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,90 @@ |
|||||
|
package com.win.module.eam.controller.inventorywarning.vo; |
||||
|
|
||||
|
import com.alibaba.excel.annotation.ExcelProperty; |
||||
|
import lombok.*; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import com.win.framework.common.pojo.PageParam; |
||||
|
import java.time.LocalDateTime; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
|
||||
|
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 库存预警记录 Excel 导出 Request VO,参数和 InventoryWarningPageReqVO 是一致的") |
||||
|
@Data |
||||
|
public class InventoryWarningExportReqVO { |
||||
|
|
||||
|
@Schema(description = "零件编码") |
||||
|
private String number; |
||||
|
|
||||
|
@Schema(description = "零件名称", example = "赵六") |
||||
|
private String name; |
||||
|
|
||||
|
@Schema(description = "库位名称") |
||||
|
private String locationNumber; |
||||
|
|
||||
|
@Schema(description = "规格型号") |
||||
|
private String specifications; |
||||
|
|
||||
|
@Schema(description = "单位") |
||||
|
private String uom; |
||||
|
|
||||
|
@Schema(description = "供应商名称", example = "王五") |
||||
|
private String supplierName; |
||||
|
|
||||
|
@Schema(description = "生产厂家") |
||||
|
private String brand; |
||||
|
|
||||
|
@Schema(description = "最高库存") |
||||
|
private BigDecimal maxInventory; |
||||
|
|
||||
|
@Schema(description = "最低库存") |
||||
|
private BigDecimal minInventory; |
||||
|
|
||||
|
@Schema(description = "最低库存") |
||||
|
private BigDecimal nowInventory; |
||||
|
|
||||
|
@Schema(description = "采购周期(周)") |
||||
|
private Integer procurementCycle; |
||||
|
|
||||
|
@Schema(description = "ABC分类") |
||||
|
private String classification; |
||||
|
|
||||
|
@Schema(description = "使用地点") |
||||
|
private String usePlace; |
||||
|
|
||||
|
@Schema(description = "项目") |
||||
|
private String project; |
||||
|
|
||||
|
@Schema(description = "价格", example = "29930") |
||||
|
private BigDecimal price; |
||||
|
|
||||
|
@Schema(description = "采购状态", example = "1") |
||||
|
private String procureStatus; |
||||
|
|
||||
|
@Schema(description = "备注") |
||||
|
private String describes; |
||||
|
|
||||
|
@Schema(description = "创建时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] createTime; |
||||
|
|
||||
|
@Schema(description = "删除时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] deletionTime; |
||||
|
|
||||
|
@Schema(description = "删除者ID", example = "21341") |
||||
|
private String deleterId; |
||||
|
|
||||
|
@Schema(description = "扩展属性") |
||||
|
private String extraProperties; |
||||
|
|
||||
|
@Schema(description = "并发乐观锁") |
||||
|
private Integer concurrencyStamp; |
||||
|
|
||||
|
@Schema(description = "地点id", example = "12691") |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,91 @@ |
|||||
|
package com.win.module.eam.controller.inventorywarning.vo; |
||||
|
|
||||
|
import lombok.*; |
||||
|
|
||||
|
import java.math.BigDecimal; |
||||
|
import java.util.*; |
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import com.win.framework.common.pojo.PageParam; |
||||
|
import org.springframework.format.annotation.DateTimeFormat; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
import static com.win.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 库存预警记录分页 Request VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class InventoryWarningPageReqVO extends PageParam { |
||||
|
|
||||
|
@Schema(description = "零件编码") |
||||
|
private String number; |
||||
|
|
||||
|
@Schema(description = "零件名称", example = "赵六") |
||||
|
private String name; |
||||
|
|
||||
|
@Schema(description = "库位名称") |
||||
|
private String locationNumber; |
||||
|
|
||||
|
@Schema(description = "规格型号") |
||||
|
private String specifications; |
||||
|
|
||||
|
@Schema(description = "单位") |
||||
|
private String uom; |
||||
|
|
||||
|
@Schema(description = "供应商名称", example = "王五") |
||||
|
private String supplierName; |
||||
|
|
||||
|
@Schema(description = "生产厂家") |
||||
|
private String brand; |
||||
|
|
||||
|
@Schema(description = "最高库存") |
||||
|
private BigDecimal maxInventory; |
||||
|
|
||||
|
@Schema(description = "最低库存") |
||||
|
private BigDecimal minInventory; |
||||
|
|
||||
|
@Schema(description = "最低库存") |
||||
|
private BigDecimal nowInventory; |
||||
|
|
||||
|
@Schema(description = "采购周期(周)") |
||||
|
private Integer procurementCycle; |
||||
|
|
||||
|
@Schema(description = "ABC分类") |
||||
|
private String classification; |
||||
|
|
||||
|
@Schema(description = "使用地点") |
||||
|
private String usePlace; |
||||
|
|
||||
|
@Schema(description = "项目") |
||||
|
private String project; |
||||
|
|
||||
|
@Schema(description = "价格", example = "29930") |
||||
|
private BigDecimal price; |
||||
|
|
||||
|
@Schema(description = "采购状态", example = "1") |
||||
|
private String procureStatus; |
||||
|
|
||||
|
@Schema(description = "备注") |
||||
|
private String describes; |
||||
|
|
||||
|
@Schema(description = "创建时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] createTime; |
||||
|
|
||||
|
@Schema(description = "删除时间") |
||||
|
@DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY_HOUR_MINUTE_SECOND) |
||||
|
private LocalDateTime[] deletionTime; |
||||
|
|
||||
|
@Schema(description = "删除者ID", example = "21341") |
||||
|
private String deleterId; |
||||
|
|
||||
|
@Schema(description = "扩展属性") |
||||
|
private String extraProperties; |
||||
|
|
||||
|
@Schema(description = "并发乐观锁") |
||||
|
private Integer concurrencyStamp; |
||||
|
|
||||
|
@Schema(description = "地点id", example = "12691") |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,19 @@ |
|||||
|
package com.win.module.eam.controller.inventorywarning.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.time.LocalDateTime; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 库存预警记录 Response VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class InventoryWarningRespVO extends InventoryWarningBaseVO { |
||||
|
|
||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11773") |
||||
|
private Integer id; |
||||
|
|
||||
|
@Schema(description = "创建时间", requiredMode = Schema.RequiredMode.REQUIRED) |
||||
|
private LocalDateTime createTime; |
||||
|
|
||||
|
} |
@ -0,0 +1,18 @@ |
|||||
|
package com.win.module.eam.controller.inventorywarning.vo; |
||||
|
|
||||
|
import io.swagger.v3.oas.annotations.media.Schema; |
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import javax.validation.constraints.*; |
||||
|
|
||||
|
@Schema(description = "管理后台 - 库存预警记录更新 Request VO") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
public class InventoryWarningUpdateReqVO extends InventoryWarningBaseVO { |
||||
|
|
||||
|
@Schema(description = "id", requiredMode = Schema.RequiredMode.REQUIRED, example = "11773") |
||||
|
@NotNull(message = "id不能为空") |
||||
|
private Integer id; |
||||
|
|
||||
|
} |
@ -0,0 +1,36 @@ |
|||||
|
package com.win.module.eam.convert.inventorywarning; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningCreateReqVO; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningExcelVO; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningRespVO; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningUpdateReqVO; |
||||
|
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO; |
||||
|
import org.mapstruct.Mapper; |
||||
|
import org.mapstruct.factory.Mappers; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 库存预警记录 Convert |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface InventoryWarningConvert { |
||||
|
|
||||
|
InventoryWarningConvert INSTANCE = Mappers.getMapper(InventoryWarningConvert.class); |
||||
|
|
||||
|
InventoryWarningDO convert(InventoryWarningCreateReqVO bean); |
||||
|
|
||||
|
InventoryWarningDO convert(InventoryWarningUpdateReqVO bean); |
||||
|
|
||||
|
InventoryWarningRespVO convert(InventoryWarningDO bean); |
||||
|
|
||||
|
List<InventoryWarningRespVO> convertList(List<InventoryWarningDO> list); |
||||
|
|
||||
|
PageResult<InventoryWarningRespVO> convertPage(PageResult<InventoryWarningDO> page); |
||||
|
|
||||
|
List<InventoryWarningExcelVO> convertList02(List<InventoryWarningDO> list); |
||||
|
|
||||
|
} |
@ -0,0 +1,123 @@ |
|||||
|
package com.win.module.eam.dal.dataobject.inventorywarning; |
||||
|
|
||||
|
import lombok.*; |
||||
|
import java.util.*; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.math.BigDecimal; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import java.time.LocalDateTime; |
||||
|
import com.baomidou.mybatisplus.annotation.*; |
||||
|
import com.win.framework.mybatis.core.dataobject.BaseDO; |
||||
|
|
||||
|
/** |
||||
|
* 库存预警记录 DO |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@TableName("record_inventory_warning") |
||||
|
@Data |
||||
|
@EqualsAndHashCode(callSuper = true) |
||||
|
@ToString(callSuper = true) |
||||
|
@Builder |
||||
|
@NoArgsConstructor |
||||
|
@AllArgsConstructor |
||||
|
public class InventoryWarningDO extends BaseDO { |
||||
|
|
||||
|
/** |
||||
|
* id |
||||
|
*/ |
||||
|
@TableId |
||||
|
private Integer id; |
||||
|
/** |
||||
|
* 零件编码 |
||||
|
*/ |
||||
|
private String number; |
||||
|
/** |
||||
|
* 零件名称 |
||||
|
*/ |
||||
|
private String name; |
||||
|
/** |
||||
|
* 库位代码 |
||||
|
*/ |
||||
|
private String locationNumber; |
||||
|
/** |
||||
|
* 规格型号 |
||||
|
*/ |
||||
|
private String specifications; |
||||
|
/** |
||||
|
* 单位 |
||||
|
*/ |
||||
|
private String uom; |
||||
|
/** |
||||
|
* 供应商名称 |
||||
|
*/ |
||||
|
private String supplierName; |
||||
|
/** |
||||
|
* 生产厂家 |
||||
|
*/ |
||||
|
private String brand; |
||||
|
/** |
||||
|
* 最高库存 |
||||
|
*/ |
||||
|
private BigDecimal maxInventory; |
||||
|
/** |
||||
|
* 最低库存 |
||||
|
*/ |
||||
|
private BigDecimal minInventory; |
||||
|
/** |
||||
|
* 最低库存 |
||||
|
*/ |
||||
|
private BigDecimal nowInventory; |
||||
|
/** |
||||
|
* 采购周期(周) |
||||
|
*/ |
||||
|
private Integer procurementCycle; |
||||
|
/** |
||||
|
* ABC分类 |
||||
|
*/ |
||||
|
private String classification; |
||||
|
/** |
||||
|
* 使用地点 |
||||
|
*/ |
||||
|
private String usePlace; |
||||
|
/** |
||||
|
* 项目 |
||||
|
*/ |
||||
|
private String project; |
||||
|
/** |
||||
|
* 价格 |
||||
|
*/ |
||||
|
private BigDecimal price; |
||||
|
/** |
||||
|
* 采购状态 |
||||
|
*/ |
||||
|
private String procureStatus; |
||||
|
/** |
||||
|
* 备注 |
||||
|
*/ |
||||
|
private String describes; |
||||
|
/** |
||||
|
* 删除时间 |
||||
|
*/ |
||||
|
private LocalDateTime deletionTime; |
||||
|
/** |
||||
|
* 删除者ID |
||||
|
*/ |
||||
|
private String deleterId; |
||||
|
/** |
||||
|
* 扩展属性 |
||||
|
*/ |
||||
|
private String extraProperties; |
||||
|
/** |
||||
|
* 并发乐观锁 |
||||
|
*/ |
||||
|
private Integer concurrencyStamp; |
||||
|
/** |
||||
|
* 地点id |
||||
|
*/ |
||||
|
private String siteId; |
||||
|
|
||||
|
} |
@ -0,0 +1,75 @@ |
|||||
|
package com.win.module.eam.dal.mysql.inventorywarning; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.framework.mybatis.core.mapper.BaseMapperX; |
||||
|
import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningExportReqVO; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.InventoryWarningPageReqVO; |
||||
|
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO; |
||||
|
import org.apache.ibatis.annotations.Mapper; |
||||
|
|
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 库存预警记录 Mapper |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Mapper |
||||
|
public interface InventoryWarningMapper extends BaseMapperX<InventoryWarningDO> { |
||||
|
|
||||
|
default PageResult<InventoryWarningDO> selectPage(InventoryWarningPageReqVO reqVO) { |
||||
|
return selectPage(reqVO, new LambdaQueryWrapperX<InventoryWarningDO>() |
||||
|
.eqIfPresent(InventoryWarningDO::getNumber, reqVO.getNumber()) |
||||
|
.likeIfPresent(InventoryWarningDO::getName, reqVO.getName()) |
||||
|
.eqIfPresent(InventoryWarningDO::getSpecifications, reqVO.getSpecifications()) |
||||
|
.eqIfPresent(InventoryWarningDO::getUom, reqVO.getUom()) |
||||
|
.likeIfPresent(InventoryWarningDO::getSupplierName, reqVO.getSupplierName()) |
||||
|
.eqIfPresent(InventoryWarningDO::getBrand, reqVO.getBrand()) |
||||
|
.eqIfPresent(InventoryWarningDO::getMaxInventory, reqVO.getMaxInventory()) |
||||
|
.eqIfPresent(InventoryWarningDO::getMinInventory, reqVO.getMinInventory()) |
||||
|
.eqIfPresent(InventoryWarningDO::getNowInventory, reqVO.getNowInventory()) |
||||
|
.eqIfPresent(InventoryWarningDO::getProcurementCycle, reqVO.getProcurementCycle()) |
||||
|
.eqIfPresent(InventoryWarningDO::getClassification, reqVO.getClassification()) |
||||
|
.eqIfPresent(InventoryWarningDO::getUsePlace, reqVO.getUsePlace()) |
||||
|
.eqIfPresent(InventoryWarningDO::getProject, reqVO.getProject()) |
||||
|
.eqIfPresent(InventoryWarningDO::getPrice, reqVO.getPrice()) |
||||
|
.eqIfPresent(InventoryWarningDO::getProcureStatus, reqVO.getProcureStatus()) |
||||
|
.eqIfPresent(InventoryWarningDO::getDescribes, reqVO.getDescribes()) |
||||
|
.betweenIfPresent(InventoryWarningDO::getCreateTime, reqVO.getCreateTime()) |
||||
|
.betweenIfPresent(InventoryWarningDO::getDeletionTime, reqVO.getDeletionTime()) |
||||
|
.eqIfPresent(InventoryWarningDO::getDeleterId, reqVO.getDeleterId()) |
||||
|
.eqIfPresent(InventoryWarningDO::getExtraProperties, reqVO.getExtraProperties()) |
||||
|
.eqIfPresent(InventoryWarningDO::getConcurrencyStamp, reqVO.getConcurrencyStamp()) |
||||
|
.eqIfPresent(InventoryWarningDO::getSiteId, reqVO.getSiteId()) |
||||
|
.orderByDesc(InventoryWarningDO::getId)); |
||||
|
} |
||||
|
|
||||
|
default List<InventoryWarningDO> selectList(InventoryWarningExportReqVO reqVO) { |
||||
|
return selectList(new LambdaQueryWrapperX<InventoryWarningDO>() |
||||
|
.eqIfPresent(InventoryWarningDO::getNumber, reqVO.getNumber()) |
||||
|
.likeIfPresent(InventoryWarningDO::getName, reqVO.getName()) |
||||
|
.eqIfPresent(InventoryWarningDO::getSpecifications, reqVO.getSpecifications()) |
||||
|
.eqIfPresent(InventoryWarningDO::getUom, reqVO.getUom()) |
||||
|
.likeIfPresent(InventoryWarningDO::getSupplierName, reqVO.getSupplierName()) |
||||
|
.eqIfPresent(InventoryWarningDO::getBrand, reqVO.getBrand()) |
||||
|
.eqIfPresent(InventoryWarningDO::getMaxInventory, reqVO.getMaxInventory()) |
||||
|
.eqIfPresent(InventoryWarningDO::getMinInventory, reqVO.getMinInventory()) |
||||
|
.eqIfPresent(InventoryWarningDO::getNowInventory, reqVO.getNowInventory()) |
||||
|
.eqIfPresent(InventoryWarningDO::getProcurementCycle, reqVO.getProcurementCycle()) |
||||
|
.eqIfPresent(InventoryWarningDO::getClassification, reqVO.getClassification()) |
||||
|
.eqIfPresent(InventoryWarningDO::getUsePlace, reqVO.getUsePlace()) |
||||
|
.eqIfPresent(InventoryWarningDO::getProject, reqVO.getProject()) |
||||
|
.eqIfPresent(InventoryWarningDO::getPrice, reqVO.getPrice()) |
||||
|
.eqIfPresent(InventoryWarningDO::getProcureStatus, reqVO.getProcureStatus()) |
||||
|
.eqIfPresent(InventoryWarningDO::getDescribes, reqVO.getDescribes()) |
||||
|
.betweenIfPresent(InventoryWarningDO::getCreateTime, reqVO.getCreateTime()) |
||||
|
.betweenIfPresent(InventoryWarningDO::getDeletionTime, reqVO.getDeletionTime()) |
||||
|
.eqIfPresent(InventoryWarningDO::getDeleterId, reqVO.getDeleterId()) |
||||
|
.eqIfPresent(InventoryWarningDO::getExtraProperties, reqVO.getExtraProperties()) |
||||
|
.eqIfPresent(InventoryWarningDO::getConcurrencyStamp, reqVO.getConcurrencyStamp()) |
||||
|
.eqIfPresent(InventoryWarningDO::getSiteId, reqVO.getSiteId()) |
||||
|
.orderByDesc(InventoryWarningDO::getId)); |
||||
|
} |
||||
|
|
||||
|
} |
@ -0,0 +1,41 @@ |
|||||
|
package com.win.module.eam.enums.transactionType; |
||||
|
|
||||
|
public enum ProcureStatusEnum { |
||||
|
//设备模具报修申请
|
||||
|
YESPURCHASED("YESPURCHASED", "采购完成"), |
||||
|
PURCHASEDING("PURCHASEDING", "采购中"), |
||||
|
NOPURCHASED("NOPURCHASED", "待采购"), |
||||
|
; |
||||
|
private String code; |
||||
|
private String name; |
||||
|
|
||||
|
ProcureStatusEnum(String code, String name) { |
||||
|
this.code = code; |
||||
|
this.name = name; |
||||
|
} |
||||
|
|
||||
|
public String getCode() { |
||||
|
return this.code; |
||||
|
} |
||||
|
|
||||
|
public String getName() { |
||||
|
return this.name; |
||||
|
} |
||||
|
|
||||
|
/** |
||||
|
* 用状态值获取枚举 |
||||
|
* |
||||
|
* @param code |
||||
|
* @return |
||||
|
*/ |
||||
|
static ProcureStatusEnum getTransactionTypeEnum(String code) { |
||||
|
for (ProcureStatusEnum orderStatusEnum : values()) { |
||||
|
if (orderStatusEnum.getCode().equals(code)) { |
||||
|
return orderStatusEnum; |
||||
|
} |
||||
|
} |
||||
|
return null; |
||||
|
} |
||||
|
|
||||
|
|
||||
|
} |
@ -0,0 +1,72 @@ |
|||||
|
package com.win.module.eam.service.inventorywarning; |
||||
|
|
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.*; |
||||
|
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO; |
||||
|
|
||||
|
import javax.validation.Valid; |
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
/** |
||||
|
* 库存预警记录 Service 接口 |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
public interface InventoryWarningService { |
||||
|
|
||||
|
/** |
||||
|
* 创建库存预警记录 |
||||
|
* |
||||
|
* @param createReqVO 创建信息 |
||||
|
* @return 编号 |
||||
|
*/ |
||||
|
Integer createInventoryWarning(@Valid InventoryWarningCreateReqVO createReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 更新库存预警记录 |
||||
|
* |
||||
|
* @param updateReqVO 更新信息 |
||||
|
*/ |
||||
|
Integer updateInventoryWarning(@Valid InventoryWarningUpdateReqVO updateReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 删除库存预警记录 |
||||
|
* |
||||
|
* @param id 编号 |
||||
|
*/ |
||||
|
Integer deleteInventoryWarning(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 获得库存预警记录 |
||||
|
* |
||||
|
* @param id 编号 |
||||
|
* @return 库存预警记录 |
||||
|
*/ |
||||
|
InventoryWarningDO getInventoryWarning(Integer id); |
||||
|
|
||||
|
/** |
||||
|
* 获得库存预警记录列表 |
||||
|
* |
||||
|
* @param ids 编号 |
||||
|
* @return 库存预警记录列表 |
||||
|
*/ |
||||
|
List<InventoryWarningDO> getInventoryWarningList(Collection<Integer> ids); |
||||
|
|
||||
|
/** |
||||
|
* 获得库存预警记录分页 |
||||
|
* |
||||
|
* @param pageReqVO 分页查询 |
||||
|
* @return 库存预警记录分页 |
||||
|
*/ |
||||
|
PageResult<InventoryWarningDO> getInventoryWarningPage(InventoryWarningPageReqVO pageReqVO); |
||||
|
|
||||
|
/** |
||||
|
* 获得库存预警记录列表, 用于 Excel 导出 |
||||
|
* |
||||
|
* @param exportReqVO 查询条件 |
||||
|
* @return 库存预警记录列表 |
||||
|
*/ |
||||
|
List<InventoryWarningDO> getInventoryWarningList(InventoryWarningExportReqVO exportReqVO); |
||||
|
|
||||
|
} |
@ -0,0 +1,84 @@ |
|||||
|
package com.win.module.eam.service.inventorywarning; |
||||
|
|
||||
|
import cn.hutool.core.collection.CollUtil; |
||||
|
import com.win.framework.common.pojo.PageResult; |
||||
|
import com.win.module.eam.controller.inventorywarning.vo.*; |
||||
|
import com.win.module.eam.convert.inventorywarning.InventoryWarningConvert; |
||||
|
import com.win.module.eam.dal.dataobject.inventorywarning.InventoryWarningDO; |
||||
|
import com.win.module.eam.dal.mysql.inventorywarning.InventoryWarningMapper; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
import org.springframework.validation.annotation.Validated; |
||||
|
|
||||
|
import javax.annotation.Resource; |
||||
|
import java.util.ArrayList; |
||||
|
import java.util.Collection; |
||||
|
import java.util.List; |
||||
|
|
||||
|
import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; |
||||
|
import static com.win.module.eam.enums.ErrorCodeConstants.INVENTORY_WARNING_NOT_EXISTS; |
||||
|
|
||||
|
/** |
||||
|
* 库存预警记录 Service 实现类 |
||||
|
* |
||||
|
* @author 超级管理员 |
||||
|
*/ |
||||
|
@Service |
||||
|
@Validated |
||||
|
public class InventoryWarningServiceImpl implements InventoryWarningService { |
||||
|
|
||||
|
@Resource |
||||
|
private InventoryWarningMapper inventoryWarningMapper; |
||||
|
|
||||
|
@Override |
||||
|
public Integer createInventoryWarning(InventoryWarningCreateReqVO createReqVO) { |
||||
|
// 插入
|
||||
|
InventoryWarningDO inventoryWarning = InventoryWarningConvert.INSTANCE.convert(createReqVO); |
||||
|
inventoryWarningMapper.insert(inventoryWarning); |
||||
|
// 返回
|
||||
|
return inventoryWarning.getId(); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer updateInventoryWarning(InventoryWarningUpdateReqVO updateReqVO) { |
||||
|
// 校验存在
|
||||
|
validateInventoryWarningExists(updateReqVO.getId()); |
||||
|
// 更新
|
||||
|
InventoryWarningDO updateObj = InventoryWarningConvert.INSTANCE.convert(updateReqVO); |
||||
|
return inventoryWarningMapper.updateById(updateObj); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public Integer deleteInventoryWarning(Integer id) { |
||||
|
// 校验存在
|
||||
|
validateInventoryWarningExists(id); |
||||
|
// 删除
|
||||
|
return inventoryWarningMapper.deleteById(id); |
||||
|
} |
||||
|
|
||||
|
private void validateInventoryWarningExists(Integer id) { |
||||
|
if (inventoryWarningMapper.selectById(id) == null) { |
||||
|
throw exception(INVENTORY_WARNING_NOT_EXISTS); |
||||
|
} |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public InventoryWarningDO getInventoryWarning(Integer id) { |
||||
|
return inventoryWarningMapper.selectById(id); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<InventoryWarningDO> getInventoryWarningList(Collection<Integer> ids) { |
||||
|
return inventoryWarningMapper.selectBatchIds(ids); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public PageResult<InventoryWarningDO> getInventoryWarningPage(InventoryWarningPageReqVO pageReqVO) { |
||||
|
return inventoryWarningMapper.selectPage(pageReqVO); |
||||
|
} |
||||
|
|
||||
|
@Override |
||||
|
public List<InventoryWarningDO> getInventoryWarningList(InventoryWarningExportReqVO exportReqVO) { |
||||
|
return inventoryWarningMapper.selectList(exportReqVO); |
||||
|
} |
||||
|
|
||||
|
} |
@ -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="com.win.module.record.dal.mysql.inventorywarning.InventoryWarningMapper"> |
||||
|
|
||||
|
<!-- |
||||
|
一般情况下,尽可能使用 Mapper 进行 CRUD 增删改查即可。 |
||||
|
无法满足的场景,例如说多表关联查询,才使用 XML 编写 SQL。 |
||||
|
代码生成器暂时只生成 Mapper XML 文件本身,更多推荐 MybatisX 快速开发插件来生成查询。 |
||||
|
文档可见:https://www.iocoder.cn/MyBatis/x-plugins/ |
||||
|
--> |
||||
|
|
||||
|
</mapper> |
Loading…
Reference in new issue