|
|
@@ -7,13 +7,13 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
7
|
7
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
8
|
8
|
import com.unissoft.MyConstant;
|
|
9
|
9
|
import com.unissoft.constant.GrainConstant;
|
|
|
10
|
+import com.unissoft.feign.SystemFeign;
|
|
10
|
11
|
import com.unissoft.grainManage.service.GrainConditionRecordService;
|
|
11
|
12
|
import com.unissoft.mapper.*;
|
|
12
|
13
|
import com.unissoft.model.*;
|
|
13
|
14
|
import com.unissoft.result.PageParam;
|
|
14
|
15
|
import com.unissoft.utils.DateUtil;
|
|
15
|
16
|
import lombok.extern.slf4j.Slf4j;
|
|
16
|
|
-import org.apache.commons.lang.ObjectUtils;
|
|
17
|
17
|
import org.json.JSONObject;
|
|
18
|
18
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
19
|
19
|
import org.springframework.stereotype.Service;
|
|
|
@@ -21,9 +21,8 @@ import org.springframework.transaction.annotation.Transactional;
|
|
21
|
21
|
import org.springframework.util.CollectionUtils;
|
|
22
|
22
|
import org.springframework.util.StringUtils;
|
|
23
|
23
|
|
|
|
24
|
+import javax.annotation.Resource;
|
|
24
|
25
|
import java.util.*;
|
|
25
|
|
-import java.util.stream.Collectors;
|
|
26
|
|
-import java.util.stream.Stream;
|
|
27
|
26
|
|
|
28
|
27
|
/**
|
|
29
|
28
|
* <p>
|
|
|
@@ -46,6 +45,8 @@ public class GrainConditionRecordServiceImpl extends ServiceImpl<GrainConditionR
|
|
46
|
45
|
private GrainAbnormalDescribeMapper grainAbnormalDescribeMapper;
|
|
47
|
46
|
@Autowired
|
|
48
|
47
|
private GrainConditionRecordChildMapper childMapper;
|
|
|
48
|
+ @Resource
|
|
|
49
|
+ private SystemFeign systemFeign;
|
|
49
|
50
|
|
|
50
|
51
|
@Override
|
|
51
|
52
|
public List<GrainConditionRecord> getByRoleTime(GrainConditionRecord requestRecord) {
|
|
|
@@ -184,4 +185,40 @@ public class GrainConditionRecordServiceImpl extends ServiceImpl<GrainConditionR
|
|
184
|
185
|
return false;
|
|
185
|
186
|
}
|
|
186
|
187
|
|
|
|
188
|
+ @Override
|
|
|
189
|
+ public List<GrainErrorEChars> getGrainErrorEChars(Integer depotId) {
|
|
|
190
|
+ // 调用基础服务查询当前登录人所在机构及下级机构编码
|
|
|
191
|
+ List<Integer> depotIds = (List) systemFeign.getItselfJoinDownDepotId(depotId).getData();
|
|
|
192
|
+ return grainConditionRecordMapper.getGrainErrorEChars(depotIds);
|
|
|
193
|
+ }
|
|
|
194
|
+
|
|
|
195
|
+ @Override
|
|
|
196
|
+ public IPage<GrainError> getGrainErrorCount(PageParam pageParam) {
|
|
|
197
|
+ // 分页
|
|
|
198
|
+ int pageIndex = pageParam.getPageIndex();
|
|
|
199
|
+ int pageSize = pageParam.getPageSize();
|
|
|
200
|
+ // 分页对象
|
|
|
201
|
+ IPage<GrainError> iPage = new Page<>();
|
|
|
202
|
+ // 查询条件
|
|
|
203
|
+ if (!StringUtils.isEmpty(pageParam.getCondition())) {
|
|
|
204
|
+ JSONObject object = new JSONObject(pageParam.getCondition());
|
|
|
205
|
+ Integer depotId = object.getInt("depotId"); // 库id
|
|
|
206
|
+ // 调用基础服务查询当前登录人所在机构及下级机构编码
|
|
|
207
|
+ List<Integer> depotIds = (List) systemFeign.getItselfJoinDownDepotId(depotId).getData();
|
|
|
208
|
+ log.info("depotIds -> {}", JSON.toJSONString(depotIds));
|
|
|
209
|
+ if (pageIndex != MyConstant.ZERO && pageSize != MyConstant.ZERO) {
|
|
|
210
|
+ iPage.setCurrent(pageIndex);
|
|
|
211
|
+ iPage.setSize(pageSize);
|
|
|
212
|
+ }
|
|
|
213
|
+ // 查询map对象
|
|
|
214
|
+ Map<String, Object> map = JSON.parseObject(pageParam.getCondition(), Map.class);
|
|
|
215
|
+ map.put("depotIds", depotIds);
|
|
|
216
|
+ // 获取分页查询数据
|
|
|
217
|
+ IPage<GrainError> res = grainConditionRecordMapper.getGrainErrorCount(iPage, map);
|
|
|
218
|
+ log.info("IPage res-> {}", JSON.toJSONString(res));
|
|
|
219
|
+ return res;
|
|
|
220
|
+ }
|
|
|
221
|
+ return iPage;
|
|
|
222
|
+ }
|
|
|
223
|
+
|
|
187
|
224
|
}
|