| | |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Objects; |
| | | import java.util.stream.Collectors; |
| | | |
| | | @Service("matnrService") |
| | | public class MatnrServiceImpl extends ServiceImpl<MatnrMapper, Matnr> implements MatnrService { |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam) { |
| | | public PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam, Map<String, Object> params) { |
| | | QueryWrapper<Matnr> queryWrapper = pageParam.buildWrapper(true); |
| | | IPage<Map<String, Object>> reulst = this.baseMapper.selectMatnrs(pageParam, pageParam.buildWrapper(true)); |
| | | /**获取物料分页信息 */ |
| | | List<Map<String, Object>> mapList = reulst.getRecords(); |
| | | if (!mapList.isEmpty()) { |
| | | mapList.forEach(map -> { |
| | | if (!Objects.isNull(map.get("fieldsIndex"))) { |
| | | FieldsUtils.mergeFields(map, map.get("fieldsIndex").toString()); |
| | | if (params.containsKey("groupId")) { |
| | | Object groupId = params.get("groupId"); |
| | | if (!Objects.isNull(groupId)) { |
| | | List<MatnrGroup> matnrGroups = matnrGroupService.list(new LambdaQueryWrapper<MatnrGroup>().eq(MatnrGroup::getParentId, Long.parseLong(groupId.toString())).select(MatnrGroup::getId)); |
| | | if (!matnrGroups.isEmpty()) { |
| | | List<Long> longs = matnrGroups.stream().map(MatnrGroup::getId).collect(Collectors.toList()); |
| | | queryWrapper.or().in("group_id", longs); |
| | | } |
| | | }); |
| | | } |
| | | } |
| | | // IPage<Map<String, Object>> reulst = this.baseMapper.selectMatnrs(pageParam, queryWrapper); |
| | | // /**获取物料分页信息 */ |
| | | // List<Map<String, Object>> mapList = reulst.getRecords(); |
| | | // if (!mapList.isEmpty()) { |
| | | // mapList.forEach(map -> { |
| | | // if (!Objects.isNull(map.get("fieldsIndex"))) { |
| | | // FieldsUtils.mergeFields(map, map.get("fieldsIndex").toString()); |
| | | // } |
| | | // }); |
| | | // } |
| | | |
| | | PageParam<Matnr, BaseParam> page = this.page(pageParam, pageParam.buildWrapper(true)); |
| | | /**拼接扩展字段*/ |
| | | PageParam<Matnr, BaseParam> page = this.page(pageParam, queryWrapper); |
| | | List<Matnr> records = page.getRecords(); |
| | | for (Matnr record : records) { |
| | | if (!Objects.isNull(record.getFieldsIndex())) { |
| | |
| | | return true; |
| | | } |
| | | |
| | | @Override |
| | | public PageParam<Matnr, BaseParam> getPages(Map<String, Object> map) { |
| | | |
| | | |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | | * @desc 更新扩展物料扩展字段值 |
| | | * @param matnr |
| | |
| | | */ |
| | | String uuid16 = CommonUtil.randomUUID16(); |
| | | if (!FieldsUtils.getFieldsSta().isEmpty()) { |
| | | Map<String, ?> extendFields = (Map<String, ?>) matnr.get("extendFields"); |
| | | // Map<String, ?> extendFields = (Map<String, ?>) matnr.get("extendFields"); |
| | | try { |
| | | FieldsUtils.saveFields(extendFields, uuid16); |
| | | FieldsUtils.saveFields(matnr, uuid16); |
| | | matnr1.setFieldsIndex(uuid16); |
| | | } catch (Exception ex) { |
| | | log.error(ex.toString()); |