| | |
| | | package com.zy.asrs.wms.asrs.service.impl; |
| | | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.zy.asrs.wms.asrs.entity.LocDetlField; |
| | | import com.zy.asrs.wms.asrs.entity.ViewLocDetl; |
| | | import com.zy.asrs.wms.asrs.entity.param.FieldParam; |
| | | import com.zy.asrs.wms.asrs.mapper.LocDetlMapper; |
| | | import com.zy.asrs.wms.asrs.entity.LocDetl; |
| | | import com.zy.asrs.wms.asrs.mapper.ViewLocDetlMapper; |
| | | import com.zy.asrs.wms.asrs.service.LocDetlService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.zy.asrs.wms.common.domain.BaseParam; |
| | | import com.zy.asrs.wms.common.domain.PageParam; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.*; |
| | | |
| | | @Service("locDetlService") |
| | | public class LocDetlServiceImpl extends ServiceImpl<LocDetlMapper, LocDetl> implements LocDetlService { |
| | | |
| | | @Autowired |
| | | private ViewLocDetlMapper viewLocDetlMapper; |
| | | |
| | | @Override |
| | | public PageParam<ViewLocDetl, BaseParam> getPage(PageParam<ViewLocDetl, BaseParam> pageParam, QueryWrapper<ViewLocDetl> buildWrapper) { |
| | | PageParam<ViewLocDetl, BaseParam> result = viewLocDetlMapper.selectPage(pageParam, buildWrapper); |
| | | |
| | | //解析动态字段 |
| | | JSONObject data = JSON.parseObject(JSON.toJSONString(result)); |
| | | List<ViewLocDetl> records = result.getRecords(); |
| | | data.put("records", records); |
| | | for (ViewLocDetl locDetl : records) { |
| | | Map<String, Object> resultMap = viewLocDetlMapper.getById(locDetl.getId()); |
| | | locDetl.syncFieldMap(resultMap); |
| | | } |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public List<LocDetl> getLocDetlList(Map<String, Object> map) { |
| | | String matnr = null; |
| | | String batch = null; |
| | | if (map.containsKey("matnr")) { |
| | | matnr = map.get("matnr").toString(); |
| | | map.remove("matnr"); |
| | | } |
| | | if (map.containsKey("batch")) { |
| | | batch = map.get("batch").toString(); |
| | | map.remove("batch"); |
| | | } |
| | | ArrayList<FieldParam> param = new ArrayList<>(); |
| | | for (Map.Entry<String, Object> entry : map.entrySet()) { |
| | | if (entry.getValue() == null) { |
| | | continue; |
| | | } |
| | | FieldParam fieldParam = new FieldParam(); |
| | | fieldParam.setName(entry.getKey()); |
| | | fieldParam.setValue(entry.getValue()); |
| | | param.add(fieldParam); |
| | | } |
| | | |
| | | List<Map<String, Object>> list2 = viewLocDetlMapper.getList(matnr, batch, param); |
| | | List<LocDetl> locDetls = new ArrayList<>(); |
| | | for (Map<String, Object> objectMap : list2) { |
| | | LocDetl locDetl = JSON.parseObject(JSON.toJSONString(objectMap), LocDetl.class); |
| | | locDetl.syncFieldMap(objectMap); |
| | | locDetls.add(locDetl); |
| | | } |
| | | return locDetls; |
| | | } |
| | | } |