| | |
| | | package com.yuanchu.mom.service.impl; |
| | | |
| | | import cn.hutool.core.util.StrUtil; |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.alibaba.fastjson.JSONObject; |
| | | import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.yuanchu.mom.dto.BushingDto; |
| | | import com.yuanchu.mom.dto.FibersDto; |
| | | import com.yuanchu.mom.mapper.InsBushingMapper; |
| | | import com.yuanchu.mom.pojo.InsBushing; |
| | | import com.yuanchu.mom.pojo.InsProduct; |
| | | import com.yuanchu.mom.service.InsBushingService; |
| | | import com.yuanchu.mom.service.StandardTemplateService; |
| | | import lombok.AllArgsConstructor; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.*; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | public class InsBushingServiceImpl extends ServiceImpl<InsBushingMapper, InsBushing> implements InsBushingService { |
| | | |
| | | private InsBushingMapper insBushingMapper; |
| | | |
| | | private StandardTemplateService standardTemplateService; |
| | | |
| | | @Override |
| | | public List<BushingDto> selectBushingBySampleId(Integer sampleId) { |
| | |
| | | } |
| | | return bushingDtos; |
| | | } |
| | | |
| | | private void getTemplateThing(List<InsProduct> insProducts) { |
| | | Set<Integer> set = new HashSet<>(); |
| | | Map<Integer, String> map2 = new HashMap<>(); |
| | | for (InsProduct product : insProducts) { |
| | | if (product.getTemplateId() == null) { |
| | | product.setTemplate(new ArrayList<>()); |
| | | continue; |
| | | } |
| | | String thing = null; |
| | | if (product.getTemplateId() != null && set.add(product.getTemplateId())) { |
| | | map2.put(product.getTemplateId(), standardTemplateService.getStandTempThingById(product.getTemplateId()) + ""); |
| | | thing = map2.get(product.getTemplateId()); |
| | | } |
| | | if (StrUtil.isNotEmpty(thing)) { |
| | | JSONObject sheet = JSON.parseObject(JSON.toJSONString(JSON.parseArray(JSON.toJSONString(JSON.parseObject(thing).get("data"))).get(0))); |
| | | JSONObject config = JSON.parseObject(JSON.toJSONString(sheet.get("config"))); |
| | | List<JSONObject> cellData = JSON.parseArray(JSON.toJSONString(sheet.get("celldata")), JSONObject.class); |
| | | Map<String, Object> style = new HashMap<>(); |
| | | style.put("rowlen", config.get("rowlen")); |
| | | style.put("columnlen", config.get("columnlen")); |
| | | product.setTemplate(cellData); |
| | | product.setStyle(style); |
| | | product.setTemplateName(standardTemplateService.getStandTempNameById(product.getTemplateId())); |
| | | } |
| | | } |
| | | } |
| | | } |