| | |
| | | import com.alibaba.fastjson.JSON; |
| | | import com.baomidou.dynamic.datasource.annotation.DS; |
| | | import com.example.erp.entity.sd.BasicGlassType; |
| | | import com.example.erp.entity.sd.ProcessAttributeConfig; |
| | | import com.example.erp.mapper.sd.BasicGlassTypeMapper; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | | import org.springframework.stereotype.Service; |
| | |
| | | for (BasicGlassType basicGlassType : twoGlassType) { |
| | | if (Objects.equals(basicGlassType.getBelong(), glassType.getTypeId())) { |
| | | Map<String,String> getMap = JSON.parseObject(JSON.toJSONString(basicGlassType), Map.class); |
| | | getMap.put("value",getMap.get("typeID")); |
| | | getMap.put("value",getMap.get("typeId")); |
| | | getMap.put("label",getMap.get("typeName")); |
| | | equalList.add(JSON.toJSONString(getMap) ); |
| | | } |
| | |
| | | basicGlassTypeS.setTypeName((String) map.get("value")); |
| | | }else if(list.size()==2) { |
| | | BasicGlassType basicGlassType = basicGlassTypeMapper.selectMaxTowLevelType((String) list.get(1)); |
| | | int maxId = Integer.parseInt(basicGlassType.getTypeId().substring(2)); |
| | | Integer maxId = null; |
| | | if(basicGlassType==null){ |
| | | maxId = 0; |
| | | }else { |
| | | maxId = Integer.parseInt(basicGlassType.getTypeId().substring(2)); |
| | | } |
| | | |
| | | String newTypeId =list.get(1) + String.format("%02d", maxId+1); |
| | | basicGlassTypeS.setLevel((Integer) list.get(0)); |
| | | basicGlassTypeS.setTypeId(newTypeId); |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | public List<ProcessAttributeConfig> findAllConfig() { |
| | | return basicGlassTypeMapper.getFindAllConfig(); |
| | | } |
| | | |
| | | public List<Map<String,Object>> getOneLevelListMapConfig() { |
| | | List<ProcessAttributeConfig> processAttributeConfigList = basicGlassTypeMapper.getOneLevelListMapConfig(); |
| | | List<Map<String,Object>> list = new ArrayList<>(); |
| | | for (ProcessAttributeConfig processAttributeConfig : processAttributeConfigList) { |
| | | Map<String,Object> map = new HashMap<>(); |
| | | map.put("value", processAttributeConfig.getInputType()); |
| | | map.put("label", processAttributeConfig.getProcessName()); |
| | | list.add(map); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public Boolean addConfig(Map<String, Object> map) { |
| | | List<Object> list = (List<Object>) map.get("glassLevel"); |
| | | if(list.get(0)==null |
| | | || map.get("processType") == null |
| | | || map.get("processType").equals("")){ |
| | | return false; |
| | | } |
| | | ProcessAttributeConfig processAttributeConfigS = new ProcessAttributeConfig(); |
| | | if(map.get("type").equals("add")){ |
| | | if(list.size()==1){ |
| | | ProcessAttributeConfig processAttributeConfig = basicGlassTypeMapper.selectMaxTypeConfig((Integer) list.get(0)); |
| | | int maxId = Integer.parseInt(processAttributeConfig.getInputType()); |
| | | String newTypeId = String.format("%02d", maxId+1); |
| | | processAttributeConfigS.setLevel((Integer) list.get(0)); |
| | | processAttributeConfigS.setInputType(newTypeId); |
| | | processAttributeConfigS.setProcessType((String) map.get("processType")); |
| | | processAttributeConfigS.setProcessName((String) map.get("processName")); |
| | | }else if(list.size()==2) { |
| | | processAttributeConfigS.setLevel((Integer) list.get(0)); |
| | | processAttributeConfigS.setInputType((String) map.get("inputType")); |
| | | processAttributeConfigS.setProcessType((String) map.get("processType")); |
| | | processAttributeConfigS.setProcessName((String) map.get("processName")); |
| | | processAttributeConfigS.setBelong((String) list.get(1)); |
| | | } |
| | | return basicGlassTypeMapper.insertProcessAttributeConfig(processAttributeConfigS); |
| | | }else{ |
| | | processAttributeConfigS.setId((Integer) map.get("id")); |
| | | processAttributeConfigS.setInputType((String) map.get("inputType")); |
| | | processAttributeConfigS.setProcessType((String) map.get("processType")); |
| | | processAttributeConfigS.setProcessName((String) map.get("processName")); |
| | | return basicGlassTypeMapper.updateProcessAttributeConfig(processAttributeConfigS); |
| | | } |
| | | |
| | | } |
| | | |
| | | public Boolean deleteProcessAttributeConfig(Integer id) { |
| | | return basicGlassTypeMapper.deleteProcessAttributeConfig(id); |
| | | } |
| | | } |