浏览代码

基础功能

home 2 年之前
父节点
当前提交
0a4063451e
共有 20 个文件被更改,包括 646 次插入31 次删除
  1. 4 13
      hx-common/common-tool/src/main/java/com/fjhx/base/BaseService.java
  2. 37 0
      hx-common/common-tool/src/main/java/com/fjhx/utils/PageUtil.java
  3. 13 12
      hx-common/common-tool/src/main/java/com/fjhx/utils/WrapperUtil.java
  4. 6 4
      hx-common/library-product/src/main/java/com/fjhx/entity/Product.java
  5. 1 1
      hx-common/library-storage/src/main/java/com/fjhx/service/WarehouseService.java
  6. 1 1
      hx-common/library-storage/src/main/java/com/fjhx/service/impl/WarehouseServiceImpl.java
  7. 19 0
      hx-service/basics/pom.xml
  8. 58 0
      hx-service/basics/src/main/java/com/fjhx/controller/MaterialController.java
  9. 58 0
      hx-service/basics/src/main/java/com/fjhx/controller/ProductController.java
  10. 99 0
      hx-service/basics/src/main/java/com/fjhx/controller/StockController.java
  11. 62 0
      hx-service/basics/src/main/java/com/fjhx/controller/WarehouseController.java
  12. 20 0
      hx-service/basics/src/main/java/com/fjhx/mapper/StockExMapper.java
  13. 64 0
      hx-service/basics/src/main/java/com/fjhx/mapper/StockExMapper.xml
  14. 13 0
      hx-service/basics/src/main/java/com/fjhx/service/MaterialExService.java
  15. 12 0
      hx-service/basics/src/main/java/com/fjhx/service/ProductExService.java
  16. 13 0
      hx-service/basics/src/main/java/com/fjhx/service/StockExService.java
  17. 46 0
      hx-service/basics/src/main/java/com/fjhx/service/impl/MaterialServiceExImpl.java
  18. 49 0
      hx-service/basics/src/main/java/com/fjhx/service/impl/ProductExServiceImpl.java
  19. 65 0
      hx-service/basics/src/main/java/com/fjhx/service/impl/StockExServiceImpl.java
  20. 6 0
      hx-service/pom.xml

+ 4 - 13
hx-common/common-tool/src/main/java/com/fjhx/base/BaseService.java

@@ -6,6 +6,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.core.toolkit.support.SFunction;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.baomidou.mybatisplus.extension.service.IService;
+import com.fjhx.utils.PageUtil;
 import org.springblade.core.secure.utils.AuthUtil;
 
 import java.util.*;
@@ -18,24 +19,14 @@ public interface BaseService<T> extends IService<T> {
      * 获取分页
      */
     default Page<T> createPage(Map<String, String> condition) {
-        return new Page<>(getCurrent(condition), getSize(condition));
+        return PageUtil.createPage(condition);
     }
 
     /**
      * 获取分页
      */
-    default Page<Map<String, Object>> createPageMap(Map<String, String> condition) {
-        return new Page<>(getCurrent(condition), getSize(condition));
-    }
-
-    default int getCurrent(Map<String, String> condition) {
-        String currentStr = condition.get("pageNum");
-        return ObjectUtil.isEmpty(currentStr) ? 1 : Integer.parseInt(currentStr);
-    }
-
-    default int getSize(Map<String, String> condition) {
-        String sizeStr = condition.get("pageSize");
-        return ObjectUtil.isEmpty(sizeStr) ? 10 : Integer.parseInt(sizeStr);
+    default Page<Map<String, Object>> createPageMap(Map<String, ?> condition) {
+        return PageUtil.createPageMap(condition);
     }
 
     /**

+ 37 - 0
hx-common/common-tool/src/main/java/com/fjhx/utils/PageUtil.java

@@ -0,0 +1,37 @@
+package com.fjhx.utils;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+import java.util.Map;
+
+public class PageUtil {
+
+    /**
+     * 获取页数
+     */
+    public static int getCurrent(Map<String, ?> condition) {
+        Object currentObj = condition.get("pageNum");
+        return ObjectUtil.isEmpty(currentObj) ? 1 : Integer.parseInt(currentObj.toString());
+    }
+
+    /**
+     * 获取每页条数
+     */
+    public static int getSize(Map<String, ?> condition) {
+        Object sizeObj = condition.get("pageSize");
+        return ObjectUtil.isEmpty(sizeObj) ? 10 : Integer.parseInt(sizeObj.toString());
+    }
+
+    /**
+     * 获取分页
+     */
+    public static Page<Map<String, Object>> createPageMap(Map<String, ?> condition) {
+        return new Page<>(getCurrent(condition), getSize(condition));
+    }
+
+    public static <T> Page<T> createPage(Map<String, ?> condition) {
+        return new Page<>(getCurrent(condition), getSize(condition));
+    }
+
+}

+ 13 - 12
hx-common/common-tool/src/main/java/com/fjhx/utils/WrapperUtil.java

@@ -8,12 +8,13 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import org.springblade.core.log.exception.ServiceException;
 import org.springblade.core.secure.utils.AuthUtil;
 
+import java.util.Arrays;
 import java.util.HashMap;
 import java.util.Map;
 
 public class WrapperUtil {
 
-    private Map<String, String> condition;
+    private Map<String, ?> condition;
 
     private QueryWrapper<?> wrapper;
 
@@ -67,12 +68,12 @@ public class WrapperUtil {
      * @param field 查询字段名
      */
     public WrapperUtil periodOfTime(String field) {
-        String beginTimeObj = condition.get("beginTime");
-        String endTimeObj = condition.get("endTime");
+        Object beginTimeObj = condition.get("beginTime");
+        Object endTimeObj = condition.get("endTime");
         if (ObjectUtil.isAllNotEmpty(beginTimeObj, endTimeObj)) {
             try {
-                DateTime beginTime = DateUtil.beginOfDay(DateUtil.parse(beginTimeObj));
-                DateTime endTime = DateUtil.endOfDay(DateUtil.parse(endTimeObj));
+                DateTime beginTime = DateUtil.beginOfDay(DateUtil.parse(beginTimeObj.toString()));
+                DateTime endTime = DateUtil.endOfDay(DateUtil.parse(endTimeObj.toString()));
                 wrapper.between(field, beginTime, endTime);
             } catch (Exception e) {
                 throw new ServiceException("传入日期格式解析错误");
@@ -149,7 +150,7 @@ public class WrapperUtil {
      * @param fields 查询字段名
      */
     public WrapperUtil keyword(String... fields) {
-        String keyword = condition.get("keyword");
+        Object keyword = condition.get("keyword");
         if (ObjectUtil.isNotEmpty(keyword)) {
             wrapper.and(q -> {
                 for (String field : fields) {
@@ -167,7 +168,7 @@ public class WrapperUtil {
      * @param mapKey 搜索条件key
      */
     public WrapperUtil eq(String field, String mapKey) {
-        String value = condition.get(mapKey);
+        Object value = condition.get(mapKey);
         if (ObjectUtil.isNotEmpty(value)) {
             wrapper.eq(field, value);
         }
@@ -181,10 +182,10 @@ public class WrapperUtil {
      * @param mapKey 搜索条件key
      */
     public WrapperUtil in(String field, String mapKey) {
-        String value = condition.get(mapKey);
+        Object value = condition.get(mapKey);
         if (ObjectUtil.isNotEmpty(value)) {
-            String[] split = value.split(",");
-            wrapper.in(field, split);
+            String[] split = value.toString().split(",");
+            wrapper.in(field, Arrays.asList(split));
         }
         return this;
     }
@@ -197,7 +198,7 @@ public class WrapperUtil {
      * @param exceptionSpecification 若搜索条件为空抛出的异常提示
      */
     public WrapperUtil eq(String field, String mapKey, String exceptionSpecification) {
-        String value = condition.get(mapKey);
+        Object value = condition.get(mapKey);
         if (ObjectUtil.isNotEmpty(value)) {
             wrapper.eq(field, value);
         } else {
@@ -213,7 +214,7 @@ public class WrapperUtil {
      * @param mapKey 搜索条件key
      */
     public WrapperUtil like(String field, String mapKey) {
-        String value = condition.get(mapKey);
+        Object value = condition.get(mapKey);
         if (ObjectUtil.isNotEmpty(value)) {
             wrapper.like(field, value);
         }

+ 6 - 4
hx-common/library-product/src/main/java/com/fjhx/entity/Product.java

@@ -1,12 +1,9 @@
 package com.fjhx.entity;
 
-import com.baomidou.mybatisplus.annotation.IdType;
-import com.baomidou.mybatisplus.annotation.Version;
-import com.baomidou.mybatisplus.annotation.TableId;
 import com.baomidou.mybatisplus.annotation.FieldFill;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableLogic;
 import com.fjhx.base.BaseEntity;
-import com.baomidou.mybatisplus.annotation.TableField;
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 
@@ -29,6 +26,11 @@ public class Product extends BaseEntity {
     private Long classifyId;
 
     /**
+     * 产品类型 0半成品 1成品
+     */
+    private Integer type;
+
+    /**
      * 产品编号
      */
     private String code;

+ 1 - 1
hx-common/library-storage/src/main/java/com/fjhx/service/WarehouseService.java

@@ -16,6 +16,6 @@ public interface WarehouseService extends BaseService<Warehouse> {
     /**
      * 新增或编辑仓库
      */
-    void addOrUpdate(Warehouse warehouse);
+    void addOrEdit(Warehouse warehouse);
 
 }

+ 1 - 1
hx-common/library-storage/src/main/java/com/fjhx/service/impl/WarehouseServiceImpl.java

@@ -24,7 +24,7 @@ import org.springframework.stereotype.Service;
 public class WarehouseServiceImpl extends ServiceImpl<WarehouseMapper, Warehouse> implements WarehouseService {
 
     @Override
-    public void addOrUpdate(Warehouse warehouse) {
+    public void addOrEdit(Warehouse warehouse) {
 
         // 验证仓库名称是否为空
         String name = warehouse.getName();

+ 19 - 0
hx-service/basics/pom.xml

@@ -16,4 +16,23 @@
         <maven.compiler.target>8</maven.compiler.target>
     </properties>
 
+    <dependencies>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>library-product</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>library-storage</artifactId>
+        </dependency>
+
+        <dependency>
+            <groupId>com.fjhx</groupId>
+            <artifactId>common-client-util</artifactId>
+        </dependency>
+
+    </dependencies>
+
 </project>

+ 58 - 0
hx-service/basics/src/main/java/com/fjhx/controller/MaterialController.java

@@ -0,0 +1,58 @@
+package com.fjhx.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.Material;
+import com.fjhx.service.MaterialExService;
+import com.fjhx.service.MaterialService;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * 物料 前端控制器
+ */
+@RestController
+@RequestMapping("/material")
+public class MaterialController {
+
+    @Autowired
+    private MaterialService materialService;
+
+    @Autowired
+    private MaterialExService materialExService;
+
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition) {
+        Page<Material> result = materialExService.getPage(condition);
+        return R.success(result);
+    }
+
+    @PostMapping("/add")
+    public R add(@RequestBody Material material) {
+        materialService.add(material);
+        return R.success();
+    }
+
+    @PostMapping("/edit")
+    public R edit(@RequestBody Material material) {
+        materialService.edit(material);
+        return R.success();
+    }
+
+    @PostMapping("/delete")
+    public R delete(@RequestBody Material material) {
+        materialService.delete(material);
+        return R.success();
+    }
+
+    @PostMapping("/list")
+    public R list() {
+        return R.success(materialService.list());
+    }
+
+}

+ 58 - 0
hx-service/basics/src/main/java/com/fjhx/controller/ProductController.java

@@ -0,0 +1,58 @@
+package com.fjhx.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.Product;
+import com.fjhx.service.ProductExService;
+import com.fjhx.service.ProductService;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * 产品 前端控制器
+ */
+@RestController
+@RequestMapping("/product")
+public class ProductController {
+
+    @Autowired
+    private ProductService productService;
+
+    @Autowired
+    private ProductExService productExService;
+
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition) {
+        Page<Product> result = productExService.getPage(condition);
+        return R.success(result);
+    }
+
+    @PostMapping("/add")
+    public R add(@RequestBody Product product) {
+        productService.add(product);
+        return R.success();
+    }
+
+    @PostMapping("/edit")
+    public R edit(@RequestBody Product product) {
+        productService.edit(product);
+        return R.success();
+    }
+
+    @PostMapping("/delete")
+    public R delete(@RequestBody Product product) {
+        productService.delete(product);
+        return R.success();
+    }
+
+    @PostMapping("/list")
+    public R list() {
+        return R.success(productService.list());
+    }
+
+}

+ 99 - 0
hx-service/basics/src/main/java/com/fjhx/controller/StockController.java

@@ -0,0 +1,99 @@
+package com.fjhx.controller;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.constant.StockJournalTypeConstant;
+import com.fjhx.service.StockExService;
+import com.fjhx.service.StockService;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.math.BigDecimal;
+import java.util.Map;
+
+/**
+ * 库存 前端控制器
+ */
+@RestController
+@RequestMapping("/stock")
+public class StockController {
+
+    @Autowired
+    private StockService stockService;
+
+    @Autowired
+    private StockExService stockExService;
+
+    /**
+     * 入库
+     */
+    @PostMapping("/in")
+    public R in(@RequestBody Map<String, String> condition) {
+        stockService.inChangeQuantity(
+                Long.valueOf(condition.get("goodsId")),
+                Long.valueOf(condition.get("warehouseId")),
+                new BigDecimal(condition.get("quantity")),
+                Integer.valueOf(condition.get("detailsType")),
+                condition.get("remarks")
+        );
+        return R.success();
+    }
+
+    /**
+     * 出库
+     */
+    @PostMapping("/out")
+    public R out(@RequestBody Map<String, String> condition) {
+        stockService.outChangeQuantity(
+                Long.valueOf(condition.get("goodsId")),
+                Long.valueOf(condition.get("warehouseId")),
+                new BigDecimal(condition.get("quantity")),
+                Integer.valueOf(condition.get("detailsType")),
+                condition.get("remarks")
+        );
+        return R.success();
+    }
+
+    /**
+     * 入库分页记录
+     */
+    @PostMapping("getInPage")
+    public R getInPage(@RequestBody Map<String, String> condition) {
+        condition.put("type", StockJournalTypeConstant.IN.toString());
+        Page<Map<String, Object>> inOutPage = stockExService.getInOutPage(condition);
+        return R.success(inOutPage);
+    }
+
+    /**
+     * 出库分页记录
+     */
+    @PostMapping("getOutPage")
+    public R getOutPage(@RequestBody Map<String, String> condition) {
+        condition.put("type", StockJournalTypeConstant.OUT.toString());
+        Page<Map<String, Object>> inOutPage = stockExService.getInOutPage(condition);
+        return R.success(inOutPage);
+    }
+
+    /**
+     * 出库分页记录
+     */
+    @PostMapping("getInOutPage")
+    public R getInOutPage(@RequestBody Map<String, String> condition) {
+        condition.put("type", null);
+        Page<Map<String, Object>> inOutPage = stockExService.getInOutPage(condition);
+        return R.success(inOutPage);
+    }
+
+    /**
+     * 获取库存详情
+     */
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition) {
+        Page<Map<String, Object>> page = stockExService.getPage(condition);
+        return R.success(page);
+    }
+
+}

+ 62 - 0
hx-service/basics/src/main/java/com/fjhx/controller/WarehouseController.java

@@ -0,0 +1,62 @@
+package com.fjhx.controller;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.Warehouse;
+import com.fjhx.service.WarehouseService;
+import org.springblade.core.tool.api.R;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.web.bind.annotation.PostMapping;
+import org.springframework.web.bind.annotation.RequestBody;
+import org.springframework.web.bind.annotation.RequestMapping;
+import org.springframework.web.bind.annotation.RestController;
+
+import java.util.Map;
+
+/**
+ * 仓库 前端控制器
+ */
+@RestController
+@RequestMapping("/warehouse")
+public class WarehouseController {
+
+    @Autowired
+    private WarehouseService warehouseService;
+
+    @PostMapping("/page")
+    public R page(@RequestBody Map<String, String> condition) {
+
+        String type = condition.get("type");
+        String keyword = condition.get("keyword");
+
+        Page<Warehouse> result = warehouseService.page(
+                warehouseService.createPage(condition),
+                Wrappers.<Warehouse>lambdaQuery()
+                        .eq(ObjectUtil.isNotEmpty(type), Warehouse::getType, type)
+                        .like(ObjectUtil.isNotEmpty(keyword), Warehouse::getName, keyword)
+        );
+
+        return R.success(result);
+    }
+
+
+    @PostMapping("/add")
+    public R add(@RequestBody Warehouse warehouse) {
+        warehouseService.addOrEdit(warehouse);
+        return R.success();
+    }
+
+    @PostMapping("/edit")
+    public R edit(@RequestBody Warehouse warehouse) {
+        warehouseService.addOrEdit(warehouse);
+        return R.success();
+    }
+
+    @PostMapping("/delete")
+    public R delete(@RequestBody Warehouse warehouse) {
+        warehouseService.removeById(warehouse.getId());
+        return R.success();
+    }
+
+}

+ 20 - 0
hx-service/basics/src/main/java/com/fjhx/mapper/StockExMapper.java

@@ -0,0 +1,20 @@
+package com.fjhx.mapper;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import org.apache.ibatis.annotations.Param;
+
+import java.util.Map;
+
+public interface StockExMapper {
+
+    Page<Map<String, Object>> getInOutPage(@Param("page") Page<Map<String, Object>> pageMap,
+                                           @Param("ew") QueryWrapper<?> wrapper,
+                                           @Param("keyword") String keyword,
+                                           @Param("goodsId") String goodsId);
+
+    Page<Map<String, Object>> getPage(@Param("page") Page<Map<String, Object>> pageMap,
+                                      @Param("ew") QueryWrapper<?> wrapper,
+                                      @Param("keyword") String keyword,
+                                      @Param("goodsId") String goodsId);
+}

+ 64 - 0
hx-service/basics/src/main/java/com/fjhx/mapper/StockExMapper.xml

@@ -0,0 +1,64 @@
+<?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.fjhx.mapper.StockExMapper">
+
+    <select id="getInOutPage" resultType="java.util.LinkedHashMap">
+        select
+        w.name warehouseName,
+        sj.type,
+        sj.details_type,
+        t.name goodsName,
+        t.code goodsCode,
+        t.goodsType,
+        sj.changeQuantity quantity,
+        sj.create_time,
+        sj.create_user
+        from stock_journal sj
+        left join warehouse w on sj.warehouse_id=w.id
+        left join
+        <include refid="unionAllMaterialAndProduct"/>
+        t on t.id = sj.goods_id
+        ${ew.customSqlSegment}
+    </select>
+
+    <select id="getPage" resultType="java.util.Map">
+        select
+        w.name warehouseName,
+        t.name goodsName,
+        t.code goodsCode,
+        t.goodsType,
+        t.unit,
+        s.quantity
+        from stock s
+        left join warehouse w on s.warehouse_id=w.id
+        left join
+        <include refid="unionAllMaterialAndProduct"/>
+        t on t.id = s.goods_id
+        ${ew.customSqlSegment}
+    </select>
+
+    <sql id="unionAllMaterialAndProduct">
+        (
+        select m.id,m.code,m.name,m.unit,1 goodsType from material m
+        <where>
+            <if test="keyword neq null and keyword neq ''">
+                instr(m.code,#{keyword}) > 0 or instr(m.name,#{keyword}) > 0
+            </if>
+            <if test="goodsId neq null and goodsId neq ''">
+                and m.id = #{goodsId}
+            </if>
+        </where>
+        union all
+        select p.id,p.code,p.name,p.unit,2 goodsType from product p
+        <where>
+            <if test="keyword neq null and keyword neq ''">
+                instr(p.code,#{keyword}) > 0 or instr(p.name,#{keyword}) > 0
+            </if>
+            <if test="goodsId neq null and goodsId neq ''">
+                and p.id = #{goodsId}
+            </if>
+        </where>
+        )
+    </sql>
+
+</mapper>

+ 13 - 0
hx-service/basics/src/main/java/com/fjhx/service/MaterialExService.java

@@ -0,0 +1,13 @@
+package com.fjhx.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.Material;
+import com.fjhx.entity.Product;
+
+import java.util.Map;
+
+public interface MaterialExService {
+
+    Page<Material> getPage(Map<String, String> condition);
+
+}

+ 12 - 0
hx-service/basics/src/main/java/com/fjhx/service/ProductExService.java

@@ -0,0 +1,12 @@
+package com.fjhx.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.Product;
+
+import java.util.Map;
+
+public interface ProductExService {
+
+    Page<Product> getPage(Map<String, String> condition);
+
+}

+ 13 - 0
hx-service/basics/src/main/java/com/fjhx/service/StockExService.java

@@ -0,0 +1,13 @@
+package com.fjhx.service;
+
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+
+import java.util.Map;
+
+public interface StockExService {
+
+    Page<Map<String, Object>> getInOutPage(Map<String, String> condition);
+
+    Page<Map<String, Object>> getPage(Map<String, String> condition);
+
+}

+ 46 - 0
hx-service/basics/src/main/java/com/fjhx/service/impl/MaterialServiceExImpl.java

@@ -0,0 +1,46 @@
+package com.fjhx.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.Material;
+import com.fjhx.service.*;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class MaterialServiceExImpl implements MaterialExService {
+
+    @Autowired
+    private MaterialService materialService;
+
+    @Autowired
+    private ClassifyService classifyService;
+
+    @Override
+    public Page<Material> getPage(Map<String, String> condition) {
+
+        LambdaQueryWrapper<Material> wrapper = Wrappers.lambdaQuery();
+
+        wrapper.orderByAsc(Material::getCode);
+
+        String keyword = condition.get("keyword");
+        if (ObjectUtil.isNotEmpty(keyword)) {
+            wrapper.and(q -> q.like(Material::getCode, keyword).or().like(Material::getName, keyword));
+        }
+
+        // 如果传入分类id,查询分类已经分类下级
+        String classifyId = condition.get("classifyId");
+        if (ObjectUtil.isNotEmpty(classifyId)) {
+            List<Long> childrenIdList = classifyService.getChildrenIdList(Long.valueOf(classifyId));
+            wrapper.in(Material::getClassifyId, childrenIdList);
+        }
+
+        return materialService.page(materialService.createPage(condition), wrapper);
+    }
+
+}

+ 49 - 0
hx-service/basics/src/main/java/com/fjhx/service/impl/ProductExServiceImpl.java

@@ -0,0 +1,49 @@
+package com.fjhx.service.impl;
+
+import cn.hutool.core.util.ObjectUtil;
+import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.toolkit.Wrappers;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.entity.Product;
+import com.fjhx.service.ClassifyService;
+import com.fjhx.service.ProductExService;
+import com.fjhx.service.ProductService;
+import com.fjhx.utils.PageUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class ProductExServiceImpl implements ProductExService {
+
+    @Autowired
+    private ProductService productService;
+
+    @Autowired
+    private ClassifyService classifyService;
+
+    @Override
+    public Page<Product> getPage(Map<String, String> condition) {
+
+        LambdaQueryWrapper<Product> wrapper = Wrappers.lambdaQuery();
+
+        wrapper.orderByAsc(Product::getCode);
+
+        String keyword = condition.get("keyword");
+        if (ObjectUtil.isNotEmpty(keyword)) {
+            wrapper.and(q -> q.like(Product::getCode, keyword).or().like(Product::getName, keyword));
+        }
+
+        // 如果传入分类id,查询分类已经分类下级
+        String classifyId = condition.get("classifyId");
+        if (ObjectUtil.isNotEmpty(classifyId)) {
+            List<Long> childrenIdList = classifyService.getChildrenIdList(Long.valueOf(classifyId));
+            wrapper.in(Product::getClassifyId, childrenIdList);
+        }
+
+        return productService.page(PageUtil.createPage(condition), wrapper);
+    }
+
+}

+ 65 - 0
hx-service/basics/src/main/java/com/fjhx/service/impl/StockExServiceImpl.java

@@ -0,0 +1,65 @@
+package com.fjhx.service.impl;
+
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
+import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
+import com.fjhx.mapper.StockExMapper;
+import com.fjhx.service.StockExService;
+import com.fjhx.utils.PageUtil;
+import com.fjhx.utils.UserClientUtil;
+import com.fjhx.utils.WrapperUtil;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+import java.util.Map;
+
+@Service
+public class StockExServiceImpl implements StockExService {
+
+    @Autowired
+    private StockExMapper stockExMapper;
+
+    @Override
+    public Page<Map<String, Object>> getInOutPage(Map<String, String> condition) {
+
+        String keyword = condition.get("keyword");
+        String goodsId = condition.get("goodsId");
+
+        QueryWrapper<?> wrapper = WrapperUtil.init(condition)
+                .eq("sj.type", "type")
+                .eq("sj.warehouse_id", "warehouseId")
+                .eq("sj.details_type", "detailsType")
+                .periodOfTime("sj.create_time")
+                .createTimeDesc("sj")
+                .getWrapper();
+
+        Page<Map<String, Object>> inOutPage = stockExMapper.getInOutPage(PageUtil.createPageMap(condition), wrapper, keyword, goodsId);
+
+        List<Map<String, Object>> records = inOutPage.getRecords();
+
+        if (records.size() == 0) {
+            return inOutPage;
+        }
+
+        // 赋值操作人
+        Map<Long, String> createUser = UserClientUtil.getUserNameMapFunctionLong(records, item -> (Long) item.get("createUser"));
+        records.forEach(item -> item.put("createUser", createUser.get((Long) item.get("createUser"))));
+
+        return inOutPage;
+    }
+
+    @Override
+    public Page<Map<String, Object>> getPage(Map<String, String> condition) {
+
+        String keyword = condition.get("keyword");
+        String goodsId = condition.get("goodsId");
+
+        QueryWrapper<?> wrapper = WrapperUtil.init(condition)
+                .eq("s.warehouse_id", "warehouseId")
+                .createTimeDesc("s")
+                .getWrapper();
+
+        return stockExMapper.getPage(PageUtil.createPageMap(condition), wrapper, keyword, goodsId);
+    }
+
+}

+ 6 - 0
hx-service/pom.xml

@@ -73,6 +73,12 @@
 
             <dependency>
                 <groupId>com.fjhx</groupId>
+                <artifactId>library-storage</artifactId>
+                <version>${hx.version}</version>
+            </dependency>
+
+            <dependency>
+                <groupId>com.fjhx</groupId>
                 <artifactId>syringe-management-api</artifactId>
                 <version>${hx.version}</version>
             </dependency>