From faea62a1492bc7ba1dd6b2203f9666cb57777a00 Mon Sep 17 00:00:00 2001 From: starrysky <838252223@qq.com> Date: Sun, 28 Jul 2019 09:13:14 +0800 Subject: [PATCH] =?UTF-8?q?=E7=89=A9=E6=96=99=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../modules/wms/bd/domain/MaterialInfo.java | 77 ++++++++++++++++++ .../modules/wms/bd/domain/ProductInfo.java | 79 +++++++++++++++++++ .../bd/repository/MaterialInfoRepository.java | 12 +++ .../bd/repository/ProductInfoRepository.java | 12 +++ .../wms/bd/rest/MaterialInfoController.java | 61 ++++++++++++++ .../wms/bd/rest/ProductInfoController.java | 61 ++++++++++++++ .../wms/bd/service/MaterialInfoService.java | 64 +++++++++++++++ .../wms/bd/service/ProductInfoService.java | 64 +++++++++++++++ .../wms/bd/service/dto/MaterialInfoDTO.java | 54 +++++++++++++ .../dto/MaterialInfoQueryCriteria.java | 13 +++ .../wms/bd/service/dto/ProductInfoDTO.java | 67 ++++++++++++++++ .../service/dto/ProductInfoQueryCriteria.java | 13 +++ .../service/impl/MaterialInfoServiceImpl.java | 73 +++++++++++++++++ .../service/impl/ProductInfoServiceImpl.java | 73 +++++++++++++++++ .../bd/service/mapper/MaterialInfoMapper.java | 16 ++++ .../bd/service/mapper/ProductInfoMapper.java | 16 ++++ 16 files changed, 755 insertions(+) create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/MaterialInfo.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/ProductInfo.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/MaterialInfoRepository.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/ProductInfoRepository.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/MaterialInfoController.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/ProductInfoController.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/MaterialInfoService.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/ProductInfoService.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/MaterialInfoDTO.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/MaterialInfoQueryCriteria.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ProductInfoDTO.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ProductInfoQueryCriteria.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/MaterialInfoServiceImpl.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/ProductInfoServiceImpl.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/MaterialInfoMapper.java create mode 100644 eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/ProductInfoMapper.java diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/MaterialInfo.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/MaterialInfo.java new file mode 100644 index 00000000..d90124d7 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/MaterialInfo.java @@ -0,0 +1,77 @@ +package me.zhengjie.modules.wms.bd.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Entity +@Data +@Table(name="bd_material_info") +public class MaterialInfo implements Serializable { + + // 主键 + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Integer id; + + // 所属物料分类主键 + @Column(name = "material_category_id",nullable = false) + private Integer materialCategoryId; + + // 物料分类名称 + @Column(name = "material_category_name",nullable = false) + private String materialCategoryName; + + // 物料名称 + @Column(name = "name") + private String name; + + // 物料规格 + @Column(name = "specifications") + private String specifications; + + // 所属计量单位主键 + @Column(name = "measure_unit_id") + private Integer measureUnitId; + + // 所属计量单位名称 + @Column(name = "measure_unit_name") + private String measureUnitName; + + // 产品库存预警[{“sort”:””,”ware_house_code”:””,”ware_house_name”:””,”minimum_inventory”:””,”highest_inventory”:””}] + @Column(name = "material_inventory_warning") + private String materialInventoryWarning; + + // 产品期初设置[{“sort”:””,”ware_house_code”:””,”ware_house_name”:””,“initial_setup_numer”:””,“initial_setup_total_price”:””}] + @Column(name = "material_initial_setup") + private String materialInitialSetup; + + // 物料期初合计期初总价格 + + @Column(name = "material_initial_setup_total_price") + private Integer materialInitialSetupTotalPrice; + + // 物料期初合计总数量 + @Column(name = "material_initial_setup_total_number") + private String materialInitialSetupTotalNumber; + + // 创建时间 + @Column(name = "create_time") + private Timestamp createTime; + + // 更新时间 + @Column(name = "update_time") + private Timestamp updateTime; + + public void copy(MaterialInfo source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/ProductInfo.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/ProductInfo.java new file mode 100644 index 00000000..d42932e7 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/domain/ProductInfo.java @@ -0,0 +1,79 @@ +package me.zhengjie.modules.wms.bd.domain; + +import lombok.Data; +import cn.hutool.core.bean.BeanUtil; +import cn.hutool.core.bean.copier.CopyOptions; +import javax.persistence.*; +import java.sql.Timestamp; +import java.io.Serializable; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Entity +@Data +@Table(name="bd_product_info") +public class ProductInfo implements Serializable { + + // 主键 + @Id + @GeneratedValue(strategy = GenerationType.IDENTITY) + @Column(name = "id") + private Integer id; + + // 所属产品分类 + @Column(name = "product_category_id",nullable = false) + private Integer productCategoryId; + + // 产品分类名称 + @Column(name = "product_category_name",nullable = false) + private String productCategoryName; + + // 产品编号 + @Column(name = "product_code") + private String productCode; + + // 产品名称 + @Column(name = "name") + private String name; + + // 产品规格 + @Column(name = "specifications") + private String specifications; + + // 所属计量单位主键 + @Column(name = "measure_unit_id") + private Integer measureUnitId; + + // 所属计量单位名称 + @Column(name = "measure_unit_name") + private String measureUnitName; + + // 产品单价(保留两位小数) 单位:元 + @Column(name = "unit_price") + private Integer unitPrice; + + // 产品库存预警[{“sort”:1,”ware_house_code”:””,”ware_house_name”:””,”minimum_inventory”:””,”highest_inventory”:””}] + @Column(name = "product_inventory_warning") + private String productInventoryWarning; + + // 产品期初设置 + //[{“sort”:””,”ware_house_code”:””,”ware_house_name”:””,”ware_house_type_code”:””,“ ware_house_type_name”:””, + //“material_code”:””,“material_name”:””,“specifications”:””,“unit_price”:””,“total_price”:””, + //”minimum_inventory”:””,”highest_inventory”:””}] + @Column(name = "product_initial_setup") + private String productInitialSetup; + + // 创建时间 + @Column(name = "create_time") + private Timestamp createTime; + + // 更新时间 + @Column(name = "update_time") + private Timestamp updateTime; + + public void copy(ProductInfo source){ + BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true)); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/MaterialInfoRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/MaterialInfoRepository.java new file mode 100644 index 00000000..a91cb2ae --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/MaterialInfoRepository.java @@ -0,0 +1,12 @@ +package me.zhengjie.modules.wms.bd.repository; + +import me.zhengjie.modules.wms.bd.domain.MaterialInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +public interface MaterialInfoRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/ProductInfoRepository.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/ProductInfoRepository.java new file mode 100644 index 00000000..44440ca8 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/repository/ProductInfoRepository.java @@ -0,0 +1,12 @@ +package me.zhengjie.modules.wms.bd.repository; + +import me.zhengjie.modules.wms.bd.domain.ProductInfo; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +public interface ProductInfoRepository extends JpaRepository, JpaSpecificationExecutor { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/MaterialInfoController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/MaterialInfoController.java new file mode 100644 index 00000000..bb5fd48a --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/MaterialInfoController.java @@ -0,0 +1,61 @@ +package me.zhengjie.modules.wms.bd.rest; + +import me.zhengjie.aop.log.Log; +import me.zhengjie.modules.wms.bd.domain.MaterialInfo; +import me.zhengjie.modules.wms.bd.service.MaterialInfoService; +import me.zhengjie.modules.wms.bd.service.dto.MaterialInfoQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Api(tags = "BdMaterialInfo管理") +@RestController +@RequestMapping("api") +public class MaterialInfoController { + + @Autowired + private MaterialInfoService materialInfoService; + + @Log("查询物料资料") + @ApiOperation(value = "查询物料资料") + @GetMapping(value = "/materialInfo") + @PreAuthorize("hasAnyRole('ADMIN','BDMATERIALINFO_ALL','BDMATERIALINFO_SELECT')") + public ResponseEntity getBdMaterialInfos(MaterialInfoQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(materialInfoService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增物料资料") + @ApiOperation(value = "新增物料资料") + @PostMapping(value = "/materialInfo") + @PreAuthorize("hasAnyRole('ADMIN','BDMATERIALINFO_ALL','BDMATERIALINFO_CREATE')") + public ResponseEntity create(@Validated @RequestBody MaterialInfo resources){ + return new ResponseEntity(materialInfoService.create(resources),HttpStatus.CREATED); + } + + @Log("修改物料资料") + @ApiOperation(value = "修改物料资料") + @PutMapping(value = "/materialInfo") + @PreAuthorize("hasAnyRole('ADMIN','BDMATERIALINFO_ALL','BDMATERIALINFO_EDIT')") + public ResponseEntity update(@Validated @RequestBody MaterialInfo resources){ + materialInfoService.update(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除物料资料") + @ApiOperation(value = "删除物料资料") + @DeleteMapping(value = "/materialInfo/{id}") + @PreAuthorize("hasAnyRole('ADMIN','BDMATERIALINFO_ALL','BDMATERIALINFO_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + materialInfoService.delete(id); + return new ResponseEntity(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/ProductInfoController.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/ProductInfoController.java new file mode 100644 index 00000000..d31ab56a --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/rest/ProductInfoController.java @@ -0,0 +1,61 @@ +package me.zhengjie.modules.wms.bd.rest; + +import me.zhengjie.aop.log.Log; +import me.zhengjie.modules.wms.bd.domain.ProductInfo; +import me.zhengjie.modules.wms.bd.service.ProductInfoService; +import me.zhengjie.modules.wms.bd.service.dto.ProductInfoQueryCriteria; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.data.domain.Pageable; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.security.access.prepost.PreAuthorize; +import org.springframework.validation.annotation.Validated; +import org.springframework.web.bind.annotation.*; +import io.swagger.annotations.*; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Api(tags = "BdProductInfo管理") +@RestController +@RequestMapping("api") +public class ProductInfoController { + + @Autowired + private ProductInfoService productInfoService; + + @Log("查询BdProductInfo") + @ApiOperation(value = "查询BdProductInfo") + @GetMapping(value = "/bdProductInfo") + @PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTINFO_ALL','BDPRODUCTINFO_SELECT')") + public ResponseEntity getBdProductInfos(ProductInfoQueryCriteria criteria, Pageable pageable){ + return new ResponseEntity(productInfoService.queryAll(criteria,pageable),HttpStatus.OK); + } + + @Log("新增BdProductInfo") + @ApiOperation(value = "新增BdProductInfo") + @PostMapping(value = "/bdProductInfo") + @PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTINFO_ALL','BDPRODUCTINFO_CREATE')") + public ResponseEntity create(@Validated @RequestBody ProductInfo resources){ + return new ResponseEntity(productInfoService.create(resources),HttpStatus.CREATED); + } + + @Log("修改BdProductInfo") + @ApiOperation(value = "修改BdProductInfo") + @PutMapping(value = "/bdProductInfo") + @PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTINFO_ALL','BDPRODUCTINFO_EDIT')") + public ResponseEntity update(@Validated @RequestBody ProductInfo resources){ + productInfoService.update(resources); + return new ResponseEntity(HttpStatus.NO_CONTENT); + } + + @Log("删除BdProductInfo") + @ApiOperation(value = "删除BdProductInfo") + @DeleteMapping(value = "/bdProductInfo/{id}") + @PreAuthorize("hasAnyRole('ADMIN','BDPRODUCTINFO_ALL','BDPRODUCTINFO_DELETE')") + public ResponseEntity delete(@PathVariable Integer id){ + productInfoService.delete(id); + return new ResponseEntity(HttpStatus.OK); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/MaterialInfoService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/MaterialInfoService.java new file mode 100644 index 00000000..3e0475d3 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/MaterialInfoService.java @@ -0,0 +1,64 @@ +package me.zhengjie.modules.wms.bd.service; + +import me.zhengjie.modules.wms.bd.domain.MaterialInfo; +import me.zhengjie.modules.wms.bd.service.dto.MaterialInfoDTO; +import me.zhengjie.modules.wms.bd.service.dto.MaterialInfoQueryCriteria; +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +//@CacheConfig(cacheNames = "bdMaterialInfo") +public interface MaterialInfoService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(MaterialInfoQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(MaterialInfoQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + MaterialInfoDTO findById(Integer id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + MaterialInfoDTO create(MaterialInfo resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(MaterialInfo resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Integer id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/ProductInfoService.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/ProductInfoService.java new file mode 100644 index 00000000..462efa0c --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/ProductInfoService.java @@ -0,0 +1,64 @@ +package me.zhengjie.modules.wms.bd.service; + +import me.zhengjie.modules.wms.bd.domain.ProductInfo; +import me.zhengjie.modules.wms.bd.service.dto.ProductInfoDTO; +import me.zhengjie.modules.wms.bd.service.dto.ProductInfoQueryCriteria; +//import org.springframework.cache.annotation.CacheConfig; +//import org.springframework.cache.annotation.CacheEvict; +//import org.springframework.cache.annotation.Cacheable; +import org.springframework.data.domain.Pageable; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +//@CacheConfig(cacheNames = "bdProductInfo") +public interface ProductInfoService { + + /** + * queryAll 分页 + * @param criteria + * @param pageable + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + Object queryAll(ProductInfoQueryCriteria criteria, Pageable pageable); + + /** + * queryAll 不分页 + * @param criteria + * @return + */ + //@Cacheable(keyGenerator = "keyGenerator") + public Object queryAll(ProductInfoQueryCriteria criteria); + + /** + * findById + * @param id + * @return + */ + //@Cacheable(key = "#p0") + ProductInfoDTO findById(Integer id); + + /** + * create + * @param resources + * @return + */ + //@CacheEvict(allEntries = true) + ProductInfoDTO create(ProductInfo resources); + + /** + * update + * @param resources + */ + //@CacheEvict(allEntries = true) + void update(ProductInfo resources); + + /** + * delete + * @param id + */ + //@CacheEvict(allEntries = true) + void delete(Integer id); +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/MaterialInfoDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/MaterialInfoDTO.java new file mode 100644 index 00000000..75ad69d6 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/MaterialInfoDTO.java @@ -0,0 +1,54 @@ +package me.zhengjie.modules.wms.bd.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Data +public class MaterialInfoDTO implements Serializable { + + // 主键 + private Integer id; + + // 所属物料分类主键 + private Integer materialCategoryId; + + // 物料分类名称 + private String materialCategoryName; + + // 物料名称 + private String name; + + // 物料规格 + private String specifications; + + // 所属计量单位主键 + private Integer measureUnitId; + + // 所属计量单位名称 + private String measureUnitName; + + // 产品库存预警[{“sort”:””,”ware_house_code”:””,”ware_house_name”:””,”minimum_inventory”:””,”highest_inventory”:””}] + private String materialInventoryWarning; + + // 产品期初设置[{“sort”:””,”ware_house_code”:””,”ware_house_name”:””,“initial_setup_numer”:””,“initial_setup_total_price”:””}] + private String materialInitialSetup; + + // 物料期初合计期初总价格 + + private Integer materialInitialSetupTotalPrice; + + // 物料期初合计总数量 + private String materialInitialSetupTotalNumber; + + // 创建时间 + private Timestamp createTime; + + // 更新时间 + private Timestamp updateTime; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/MaterialInfoQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/MaterialInfoQueryCriteria.java new file mode 100644 index 00000000..9086c21a --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/MaterialInfoQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.bd.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Data +public class MaterialInfoQueryCriteria { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ProductInfoDTO.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ProductInfoDTO.java new file mode 100644 index 00000000..40386fde --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ProductInfoDTO.java @@ -0,0 +1,67 @@ +package me.zhengjie.modules.wms.bd.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import java.io.Serializable; + + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Data +public class ProductInfoDTO implements Serializable { + + // 主键 + private Integer id; + + // 所属产品分类 + private Integer productCategoryId; + + // 产品分类名称 + private String productCategoryName; + + // 产品编号 + private String productCode; + + // 产品名称 + private String name; + + // 产品规格 + private String specifications; + + // 所属计量单位主键 + private Integer measureUnitId; + + // 所属计量单位名称 + private String measureUnitName; + + // 产品单价(保留两位小数) 单位:元 + private Integer unitPrice; + + // 产品库存预警[{“sort”:1,”ware_house_code”:””,”ware_house_name”:””,”minimum_inventory”:””,”highest_inventory”:””}] + private String productInventoryWarning; + + // 产品期初设置 +[ { + “sort”:””, + ”ware_house_code”:””, + ”ware_house_name”:””, + ”ware_house_type_code”:””, + “ ware_house_type_name”:””, + “material_code”:””, + “material_name”:””, + “specifications”:””, + “unit_price”:””, + “total_price”:””, + ”minimum_inventory”:””, + ”highest_inventory”:”” +}] + private String productInitialSetup; + + // 创建时间 + private Timestamp createTime; + + // 更新时间 + private Timestamp updateTime; +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ProductInfoQueryCriteria.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ProductInfoQueryCriteria.java new file mode 100644 index 00000000..9f61d141 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/dto/ProductInfoQueryCriteria.java @@ -0,0 +1,13 @@ +package me.zhengjie.modules.wms.bd.service.dto; + +import lombok.Data; +import java.sql.Timestamp; +import me.zhengjie.annotation.Query; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Data +public class ProductInfoQueryCriteria { +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/MaterialInfoServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/MaterialInfoServiceImpl.java new file mode 100644 index 00000000..70dd589f --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/MaterialInfoServiceImpl.java @@ -0,0 +1,73 @@ +package me.zhengjie.modules.wms.bd.service.impl; + +import me.zhengjie.modules.wms.bd.domain.MaterialInfo; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.bd.repository.MaterialInfoRepository; +import me.zhengjie.modules.wms.bd.service.MaterialInfoService; +import me.zhengjie.modules.wms.bd.service.dto.MaterialInfoDTO; +import me.zhengjie.modules.wms.bd.service.dto.MaterialInfoQueryCriteria; +import me.zhengjie.modules.wms.bd.service.mapper.MaterialInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class MaterialInfoServiceImpl implements MaterialInfoService { + + @Autowired + private MaterialInfoRepository materialInfoRepository; + + @Autowired + private MaterialInfoMapper materialInfoMapper; + + @Override + public Object queryAll(MaterialInfoQueryCriteria criteria, Pageable pageable){ + Page page = materialInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(materialInfoMapper::toDto)); + } + + @Override + public Object queryAll(MaterialInfoQueryCriteria criteria){ + return materialInfoMapper.toDto(materialInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public MaterialInfoDTO findById(Integer id) { + Optional bdMaterialInfo = materialInfoRepository.findById(id); + ValidationUtil.isNull(bdMaterialInfo,"BdMaterialInfo","id",id); + return materialInfoMapper.toDto(bdMaterialInfo.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public MaterialInfoDTO create(MaterialInfo resources) { + return materialInfoMapper.toDto(materialInfoRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(MaterialInfo resources) { + Optional optionalBdMaterialInfo = materialInfoRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalBdMaterialInfo,"BdMaterialInfo","id",resources.getId()); + MaterialInfo materialInfo = optionalBdMaterialInfo.get(); + materialInfo.copy(resources); + materialInfoRepository.save(materialInfo); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Integer id) { + materialInfoRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/ProductInfoServiceImpl.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/ProductInfoServiceImpl.java new file mode 100644 index 00000000..28233fbf --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/impl/ProductInfoServiceImpl.java @@ -0,0 +1,73 @@ +package me.zhengjie.modules.wms.bd.service.impl; + +import me.zhengjie.modules.wms.bd.domain.ProductInfo; +import me.zhengjie.utils.ValidationUtil; +import me.zhengjie.modules.wms.bd.repository.ProductInfoRepository; +import me.zhengjie.modules.wms.bd.service.ProductInfoService; +import me.zhengjie.modules.wms.bd.service.dto.ProductInfoDTO; +import me.zhengjie.modules.wms.bd.service.dto.ProductInfoQueryCriteria; +import me.zhengjie.modules.wms.bd.service.mapper.ProductInfoMapper; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import org.springframework.transaction.annotation.Propagation; +import org.springframework.transaction.annotation.Transactional; +import java.util.Optional; +import org.springframework.data.domain.Page; +import org.springframework.data.domain.Pageable; +import me.zhengjie.utils.PageUtil; +import me.zhengjie.utils.QueryHelp; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Service +@Transactional(propagation = Propagation.SUPPORTS, readOnly = true, rollbackFor = Exception.class) +public class ProductInfoServiceImpl implements ProductInfoService { + + @Autowired + private ProductInfoRepository productInfoRepository; + + @Autowired + private ProductInfoMapper productInfoMapper; + + @Override + public Object queryAll(ProductInfoQueryCriteria criteria, Pageable pageable){ + Page page = productInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder),pageable); + return PageUtil.toPage(page.map(productInfoMapper::toDto)); + } + + @Override + public Object queryAll(ProductInfoQueryCriteria criteria){ + return productInfoMapper.toDto(productInfoRepository.findAll((root, criteriaQuery, criteriaBuilder) -> QueryHelp.getPredicate(root,criteria,criteriaBuilder))); + } + + @Override + public ProductInfoDTO findById(Integer id) { + Optional bdProductInfo = productInfoRepository.findById(id); + ValidationUtil.isNull(bdProductInfo,"BdProductInfo","id",id); + return productInfoMapper.toDto(bdProductInfo.get()); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public ProductInfoDTO create(ProductInfo resources) { + return productInfoMapper.toDto(productInfoRepository.save(resources)); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void update(ProductInfo resources) { + Optional optionalBdProductInfo = productInfoRepository.findById(resources.getId()); + ValidationUtil.isNull( optionalBdProductInfo,"BdProductInfo","id",resources.getId()); + ProductInfo productInfo = optionalBdProductInfo.get(); + productInfo.copy(resources); + productInfoRepository.save(productInfo); + } + + @Override + @Transactional(rollbackFor = Exception.class) + public void delete(Integer id) { + productInfoRepository.deleteById(id); + } +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/MaterialInfoMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/MaterialInfoMapper.java new file mode 100644 index 00000000..dbd6e756 --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/MaterialInfoMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.bd.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.bd.domain.MaterialInfo; +import me.zhengjie.modules.wms.bd.service.dto.MaterialInfoDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface MaterialInfoMapper extends EntityMapper { + +} \ No newline at end of file diff --git a/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/ProductInfoMapper.java b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/ProductInfoMapper.java new file mode 100644 index 00000000..d15995bf --- /dev/null +++ b/eladmin-system/src/main/java/me/zhengjie/modules/wms/bd/service/mapper/ProductInfoMapper.java @@ -0,0 +1,16 @@ +package me.zhengjie.modules.wms.bd.service.mapper; + +import me.zhengjie.mapper.EntityMapper; +import me.zhengjie.modules.wms.bd.domain.ProductInfo; +import me.zhengjie.modules.wms.bd.service.dto.ProductInfoDTO; +import org.mapstruct.Mapper; +import org.mapstruct.ReportingPolicy; + +/** +* @author 黄星星 +* @date 2019-07-27 +*/ +@Mapper(componentModel = "spring",uses = {},unmappedTargetPolicy = ReportingPolicy.IGNORE) +public interface ProductInfoMapper extends EntityMapper { + +} \ No newline at end of file