| | |
| | | |
| | | return fieldsMap; |
| | | } |
| | | |
| | | public static void mergeFields(Map<String, Object> fileds ,String uuid) { |
| | | FieldsService fieldsService = SpringUtils.getBean(FieldsService.class); |
| | | List<Fields> fields = fieldsService.list(new LambdaQueryWrapper<Fields>().eq(Fields::getFlagEnable, 1).eq(Fields::getStatus, 1)); |
| | | if (fields.isEmpty()) { |
| | | return; |
| | | } |
| | | FieldsItemService fieldsItemService = SpringUtils.getBean(FieldsItemService.class); |
| | | List<FieldsItem> fieldsItems = fieldsItemService.list(new LambdaQueryWrapper<FieldsItem>().eq(FieldsItem::getUuid, uuid)); |
| | | for (Fields field : fields ) { |
| | | if (fieldsItems.isEmpty()) { |
| | | fileds.put(field.getFields(), null); |
| | | continue; |
| | | } |
| | | fieldsItems.forEach(fieldsItem -> { |
| | | if (fieldsItem.getFieldsId().equals(field.getId())) { |
| | | fileds.put(field.getFields(), fieldsItem.getValue()); |
| | | } |
| | | }); |
| | | } |
| | | |
| | | } |
| | | |
| | | /** |
| | | * @param template |
| | |
| | | package com.vincent.rsf.server.manager.mapper; |
| | | |
| | | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.core.toolkit.Constants; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | | import com.vincent.rsf.server.common.domain.PageParam; |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
| | | import org.apache.ibatis.annotations.Mapper; |
| | | import org.apache.ibatis.annotations.Param; |
| | | import org.springframework.stereotype.Repository; |
| | | |
| | | import java.util.Map; |
| | | |
| | | @Mapper |
| | | @Repository |
| | | public interface MatnrMapper extends BaseMapper<Matnr> { |
| | | |
| | | IPage<Map<String, Object>> selectMatnrs(PageParam<Matnr, BaseParam> pages, @Param(Constants.WRAPPER) QueryWrapper<Matnr> matnrQueryWrapper); |
| | | } |
| | |
| | | package com.vincent.rsf.server.manager.service; |
| | | |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.baomidou.mybatisplus.extension.service.IService; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.server.common.domain.BaseParam; |
| | |
| | | import com.vincent.rsf.server.manager.entity.Matnr; |
| | | import org.springframework.web.multipart.MultipartFile; |
| | | |
| | | import java.util.Map; |
| | | |
| | | public interface MatnrService extends IService<Matnr> { |
| | | |
| | | R importExcels(MultipartFile file) throws Exception; |
| | | |
| | | PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam); |
| | | IPage<Map<String, Object>> getMatnrPage(PageParam<Matnr, BaseParam> pageParam); |
| | | } |
| | |
| | | |
| | | import cn.afterturn.easypoi.excel.ExcelImportUtil; |
| | | import cn.afterturn.easypoi.excel.entity.result.ExcelImportResult; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONArray; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.core.metadata.IPage; |
| | | import com.vincent.rsf.framework.common.R; |
| | | import com.vincent.rsf.framework.common.SpringUtils; |
| | | import com.vincent.rsf.framework.exception.CoolException; |
| | |
| | | } |
| | | |
| | | @Override |
| | | public PageParam<Matnr, BaseParam> getMatnrPage(PageParam<Matnr, BaseParam> pageParam) { |
| | | PageParam<Matnr, BaseParam> page = this.page(pageParam, pageParam.buildWrapper(true)); |
| | | List<Matnr> records = page.getRecords(); |
| | | for (Matnr record : records) { |
| | | if (!Objects.isNull(record.getFieldsIndex())) { |
| | | Map<String, String> fields = FieldsUtils.getFields(record.getFieldsIndex()); |
| | | record.setExtendFields(fields); |
| | | } |
| | | public IPage<Map<String, Object>> getMatnrPage(PageParam<Matnr, BaseParam> pageParam) { |
| | | 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()); |
| | | } |
| | | }); |
| | | } |
| | | page.setRecords(records); |
| | | return page; |
| | | List<Matnr> matnrs = JSONArray.parseArray(JSON.toJSONString(mapList), Matnr.class); |
| | | // PageParam<Matnr, BaseParam> page = this.page(pageParam, pageParam.buildWrapper(true)); |
| | | // List<Matnr> records = page.getRecords(); |
| | | // for (Matnr record : records) { |
| | | // if (!Objects.isNull(record.getFieldsIndex())) { |
| | | // Map<String, String> fields = FieldsUtils.getFields(record.getFieldsIndex()); |
| | | // record.setExtendFields(fields); |
| | | // } |
| | | // } |
| | | // page.setRecords(records); |
| | | return reulst; |
| | | } |
| | | } |
| | |
| | | log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
| | | map-underscore-to-camel-case: true
|
| | | cache-enabled: true
|
| | | call-setters-on-nulls: true
|
| | | global-config:
|
| | | :banner: false
|
| | | db-config:
|
| | |
| | | <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> |
| | | <mapper namespace="com.vincent.rsf.server.manager.mapper.MatnrMapper"> |
| | | |
| | | <select id="selectMatnrs" resultType="java.util.Map"> |
| | | select |
| | | `id`, |
| | | `name`, |
| | | `code`, |
| | | `shipper_id`, |
| | | `group_id`, |
| | | `rglar_id`, |
| | | `barcode`, |
| | | `spec`, |
| | | `model`, |
| | | `fields_index`, |
| | | `weight`, |
| | | `color`, |
| | | `size`, |
| | | `describle`, |
| | | `nrom_num`, |
| | | `unit`, |
| | | `pur_unit`, |
| | | `stock_unit`, |
| | | `stock_level`, |
| | | `flag_label_mange`, |
| | | `safe_qty`, |
| | | `min_qty`, |
| | | `max_qty`, |
| | | `stagn`, |
| | | `valid` , |
| | | `valid_warn`, |
| | | `flag_check` |
| | | from man_matnr |
| | | ${ew.customSqlSegment} |
| | | </select> |
| | | </mapper> |