|
|
@@ -7,6 +7,7 @@ import com.lframework.starter.web.controller.DefaultBaseController;
|
|
7
|
7
|
import com.lframework.starter.web.resp.InvokeResult;
|
|
8
|
8
|
import com.lframework.starter.web.resp.InvokeResultBuilder;
|
|
9
|
9
|
import com.lframework.starter.web.resp.PageResult;
|
|
|
10
|
+import com.lframework.starter.web.service.SysParameterService;
|
|
10
|
11
|
import com.lframework.starter.web.utils.ExcelUtil;
|
|
11
|
12
|
import com.lframework.starter.web.utils.PageResultUtil;
|
|
12
|
13
|
import com.lframework.xingyun.sc.bo.stock.product.QueryProductStockBo;
|
|
|
@@ -19,6 +20,9 @@ import io.swagger.annotations.ApiOperation;
|
|
19
|
20
|
import java.util.List;
|
|
20
|
21
|
import java.util.stream.Collectors;
|
|
21
|
22
|
import javax.validation.Valid;
|
|
|
23
|
+
|
|
|
24
|
+import org.codehaus.groovy.tools.StringHelper;
|
|
|
25
|
+import org.hamcrest.text.IsEmptyString;
|
|
22
|
26
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
23
|
27
|
import org.springframework.validation.annotation.Validated;
|
|
24
|
28
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
@@ -38,6 +42,37 @@ public class ProductStockController extends DefaultBaseController {
|
|
38
|
42
|
|
|
39
|
43
|
@Autowired
|
|
40
|
44
|
private ProductStockService productStockService;
|
|
|
45
|
+ @Autowired
|
|
|
46
|
+ private SysParameterService sysParameterService;
|
|
|
47
|
+
|
|
|
48
|
+ /**
|
|
|
49
|
+ * 查询商品库存
|
|
|
50
|
+ */
|
|
|
51
|
+ @ApiOperation("查询库存yujing ")
|
|
|
52
|
+ @HasPermission({"stock:product:query"})
|
|
|
53
|
+ @GetMapping("/warn")
|
|
|
54
|
+ public InvokeResult<PageResult<QueryProductStockBo>> warn(@Valid QueryProductStockVo vo) {
|
|
|
55
|
+ String value= sysParameterService.findByKey("kcinfo") ;
|
|
|
56
|
+ try {
|
|
|
57
|
+ vo.setProductCount(Long.parseLong(value));
|
|
|
58
|
+ } catch(Exception e) {
|
|
|
59
|
+ vo.setProductCount(10L) ;
|
|
|
60
|
+ }
|
|
|
61
|
+
|
|
|
62
|
+ PageResult<ProductStock> pageResult = productStockService.query(getPageIndex(vo),
|
|
|
63
|
+ getPageSize(vo), vo);
|
|
|
64
|
+ List<QueryProductStockBo> results = null;
|
|
|
65
|
+
|
|
|
66
|
+ List<ProductStock> datas = pageResult.getDatas();
|
|
|
67
|
+ if (!CollectionUtil.isEmpty(datas)) {
|
|
|
68
|
+ results = datas.stream().map(QueryProductStockBo::new).collect(Collectors.toList());
|
|
|
69
|
+ }
|
|
|
70
|
+
|
|
|
71
|
+ return InvokeResultBuilder.success(PageResultUtil.rebuild(pageResult, results));
|
|
|
72
|
+ }
|
|
|
73
|
+
|
|
|
74
|
+
|
|
|
75
|
+
|
|
41
|
76
|
|
|
42
|
77
|
/**
|
|
43
|
78
|
* 查询商品库存
|