PointsServiceImpl.java
2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
package com.huaheng.pc.config.points.service;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.huaheng.common.constant.QuantityConstant;
import com.huaheng.common.utils.security.ShiroUtils;
import com.huaheng.framework.web.domain.AjaxResult;
import com.huaheng.pc.config.container.domain.Container;
import com.huaheng.pc.config.container.service.ContainerService;
import com.huaheng.pc.config.points.domain.Points;
import com.huaheng.pc.config.points.mapper.PointsMapper;
import org.apache.commons.collections.ListUtils;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
/**
* 货架 服务层实现
*
* @author ricard
* @date 2019-12-26
*/
@Service
public class PointsServiceImpl extends ServiceImpl<PointsMapper,Points> implements PointsService{
@Resource
private PointsMapper pointsMapper;
@Resource
private ContainerService containerService;
@Override
public int updateAll() {
return pointsMapper.updateAll();
}
@Override
public AjaxResult detectShelf() {
//查找为空的货架
List<Container> containers =containerService.selectListShelf();
List<String> stringList = new ArrayList<>();
for(Container item : containers){
stringList.add(item.getGoodsShelfNo());
}
Integer flag = 1;
//修改空货架状态
flag = pointsMapper.updateIsEmpty(stringList, QuantityConstant.POINTS_SOME);
if(flag < 1){
return AjaxResult.error("修改空货架状态失败");
}
//查找所以货架
LambdaQueryWrapper<Points> pointsLamb = Wrappers.lambdaQuery();
pointsLamb.eq(Points::getWarehouseCode,ShiroUtils.getWarehouseCode());
List<Points> pointsList = this.list(pointsLamb);
//去重
List<String> list =new ArrayList<>();
for(Points item : pointsList){
list.add(item.getGoodsShelfNo());
}
List<String> list1 = ListUtils.subtract(list,stringList);
//修改非空货架
flag = pointsMapper.updateIsEmpty(list1,QuantityConstant.POINTS_EMPTY);
if(flag < 1){
return AjaxResult.error("修改空货架状态失败");
}
return AjaxResult.success("成功");
}
}