Commit 3552ea3d by zhaoxiaolei

selector

parent 0c903091
...@@ -83,17 +83,16 @@ public class IntegrateController { ...@@ -83,17 +83,16 @@ public class IntegrateController {
List<Map<String, Object>> constraintCharacteristicValues = new ArrayList<>(); List<Map<String, Object>> constraintCharacteristicValues = new ArrayList<>();
data.forEach(item -> { data.forEach(item -> {
Map<String, Object> constraintCharacteristicValue = new HashMap<>(); Map<String, Object> constraintCharacteristicValue = new HashMap<>();
constraintCharacteristicValue.put("groupNumber", item.getGroupNumber());
List<Map<String, Object>> characteristicValues = new ArrayList<>(); List<Map<String, Object>> characteristicValues = new ArrayList<>();
List<SuperTableInfo> infos = item.getSuperTableInfos(); List<SuperTableInfo> infos = item.getSuperTableInfos();
infos.forEach(info -> { infos.forEach(info -> {
Map<String, Object> characteristicValue = new HashMap<>(); Map<String, Object> characteristicValue = new HashMap<>();
List<String> values = new ArrayList<>(); List<String> values = new ArrayList<>();
List<SuperTableItemInfo> itemInfos = info.getData(); List<SuperTableItemInfo> itemInfos = info.getData();
itemInfos.forEach(itemInfo -> { itemInfos.forEach(itemInfo -> {
constraintCharacteristicValue.put("groupNumber", item.getGroupNumber());
String characteristicCode = itemInfo.getCharacteristicCode(); String characteristicCode = itemInfo.getCharacteristicCode();
String cName = integrateService.getNameByCode(characteristicCode,selectorEntity.getIsShow()); String cName = integrateService.getNameByCode(characteristicCode,selectorEntity.getIsShow(), item.getGroupNumber());
if (!StringUtils.isEmpty(cName)) { if (!StringUtils.isEmpty(cName)) {
characteristicValue.put("characteristicName", cName); characteristicValue.put("characteristicName", cName);
String characteristicValueCode = itemInfo.getCharacteristicValueCode(); String characteristicValueCode = itemInfo.getCharacteristicValueCode();
...@@ -107,15 +106,14 @@ public class IntegrateController { ...@@ -107,15 +106,14 @@ public class IntegrateController {
characteristicValue.put("values", values); characteristicValue.put("values", values);
characteristicValues.add(characteristicValue); characteristicValues.add(characteristicValue);
}); });
constraintCharacteristicValue.put("characteristicValues", characteristicValues);
constraintCharacteristicValues.add(constraintCharacteristicValue); constraintCharacteristicValues.add(constraintCharacteristicValue);
}); });
map.put("constraintCharacteristicValues", constraintCharacteristicValues); map.put("constraintCharacteristicValues", constraintCharacteristicValues);
map.put("constraintCharacteristicName", featureComponentNames); map.put("constraintCharacteristicName", featureComponentNames);
redisEntity.setData(map); redisEntity.setData(map);
redisEntities.add(redisEntity); redisEntities.add(redisEntity);
redisHelper.set(RedisKey.getVariantTableKey(selectorEntity.getSystem(), selectorEntity.getProductClassCode(), selectorEntity.getSuperBomCode()), JSONObject.toJSONString(redisEntities), 86400);
}); });
redisHelper.set(RedisKey.getVariantTableKey(selectorEntity.getSystem(), selectorEntity.getProductClassCode(), selectorEntity.getSuperBomCode()), JSONObject.toJSONString(redisEntities), 86400);
} }
ConfigurableBom configurableBom = integrateService.getOdInfo(selectorEntity); ConfigurableBom configurableBom = integrateService.getOdInfo(selectorEntity);
......
...@@ -68,7 +68,7 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser ...@@ -68,7 +68,7 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
Characteristic findByCharacteristicName(String characteristicName,String superBomCode); Characteristic findByCharacteristicName(String characteristicName,String superBomCode);
String getNameByCode(String characteristicCode,Integer isShow); String getNameByCode(String characteristicCode,Integer isShow,String groupNumber);
Characteristic getCNameByCode(String characteristicCode,String superBomCode); Characteristic getCNameByCode(String characteristicCode,String superBomCode);
......
...@@ -102,5 +102,5 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal ...@@ -102,5 +102,5 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
CharacteristicValue getCharacteristicValueInfoByName(String characteristicValueName,String superBomCode,String characteristicName); CharacteristicValue getCharacteristicValueInfoByName(String characteristicValueName,String superBomCode,String characteristicName);
CharacteristicValue getCharacteristicValueInfoByCode(String h3cVCode, String h3cPn,String politicalMiningId,String patern); CharacteristicValue getCharacteristicValueInfoByCode(String h3cVCode, String h3cPn);
} }
...@@ -106,4 +106,5 @@ public interface CtoBomMapper extends IBaseMapper<ConfigurableBom> ...@@ -106,4 +106,5 @@ public interface CtoBomMapper extends IBaseMapper<ConfigurableBom>
SuperBomSkuInfo getSkuInfo(GetSkuInputInfo getSkuInputInfo); SuperBomSkuInfo getSkuInfo(GetSkuInputInfo getSkuInputInfo);
ConfigurableBom getConfigId(String h3cPn);
} }
package cn.com.uitech.authorization.mapper; package cn.com.uitech.authorization.mapper;
import cn.com.uitech.authorization.pojo.dto.ResultDto;
import cn.com.uitech.authorization.pojo.dto.SuperTableInfoDto; import cn.com.uitech.authorization.pojo.dto.SuperTableInfoDto;
import cn.com.uitech.authorization.pojo.dto.SuperTableInfoLog; import cn.com.uitech.authorization.pojo.dto.SuperTableInfoLog;
import cn.com.uitech.authorization.pojo.entity.SuperTableInfo; import cn.com.uitech.authorization.pojo.entity.SuperTableInfo;
import org.apache.ibatis.annotations.Mapper; import org.apache.ibatis.annotations.Mapper;
import java.util.List; import java.util.List;
import java.util.Map;
@Mapper @Mapper
public interface SuperTableInfoMapper extends IBaseMapper<SuperTableInfo>{ public interface SuperTableInfoMapper extends IBaseMapper<SuperTableInfo>{
......
package cn.com.uitech.authorization.pojo.dto;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
import java.util.List;
@Accessors(chain = true)
@NoArgsConstructor
@Getter
@Setter
@ToString
public class CharacteristicValues {
private List<String> values;
private String characteristicName;
}
package cn.com.uitech.authorization.pojo.dto;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@Getter
@Setter
@ToString
public class ResultDto {
private String tableName;
private String tableId;
private String tableNumber;
private String groupNumber;
private String characteristicName;
private String characteristicValueName;
}
...@@ -25,7 +25,7 @@ public interface IntegrateService { ...@@ -25,7 +25,7 @@ public interface IntegrateService {
String getName(Object v); String getName(Object v);
String getNameByCode(String characteristicCode,Integer isShow); String getNameByCode(String characteristicCode,Integer isShow,String groupNumber);
String getVNameByCode(String characteristicValueCode,String characteristicCode); String getVNameByCode(String characteristicValueCode,String characteristicCode);
......
...@@ -341,8 +341,8 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -341,8 +341,8 @@ public class IntegrateServiceImpl implements IntegrateService {
} }
@Override @Override
public String getNameByCode(String characteristicCode, Integer isShow) { public String getNameByCode(String characteristicCode, Integer isShow, String groupNumber) {
return characteristicMapper.getNameByCode(characteristicCode, isShow); return characteristicMapper.getNameByCode(characteristicCode, isShow, groupNumber);
} }
@Override @Override
...@@ -777,66 +777,79 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -777,66 +777,79 @@ public class IntegrateServiceImpl implements IntegrateService {
List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList(); List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList();
for (GetSKUByH3CConfigInfo.H3CPNList cpnList : h3CPNList) { for (GetSKUByH3CConfigInfo.H3CPNList cpnList : h3CPNList) {
ConfigurableBom configurableBom = ctoBomMapper.getConfigId(cpnList.getH3cPn());
boolean flag = false;
if (!CollectionUtils.isEmpty(cpnList.getSelectedCharacteristicList())) { if (!CollectionUtils.isEmpty(cpnList.getSelectedCharacteristicList())) {
List<GetSKUByH3CConfigInfo.KeyValues> selectedCharacteristicList = cpnList.getSelectedCharacteristicList(); List<GetSKUByH3CConfigInfo.KeyValues> selectedCharacteristicList = cpnList.getSelectedCharacteristicList();
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) { if (!ObjectUtils.isEmpty(configurableBom)) {
Integer politicalMiningId = cpnList.getPoliticalMiningId(); if (!StringUtils.isEmpty(configurableBom.getConfigId())) {
String politicalMining = ""; for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) {
if (politicalMiningId.equals(0)) { CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), cpnList.getH3cPn());
politicalMining = "否"; if (ObjectUtils.isEmpty(characteristicValue)) {
} else if (politicalMiningId.equals(1)) { cpnList.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!");
politicalMining = "是"; cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
} return configSkuInfo;
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), cpnList.getH3cPn(), politicalMining, cpnList.getPatern()); } else {
if (ObjectUtils.isEmpty(characteristicValue)) { //不为空时校验是否下架
cpnList.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!"); if (characteristicValue.getIsState() == 0) {
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicValueCode() + "已下架!");
return configSkuInfo; cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
} else { return configSkuInfo;
//不为空时校验是否下架 }else{
if (characteristicValue.getIsState() == 0) { flag = true;
cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicValueCode() + "已下架!"); }
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); }
return configSkuInfo;
} }
}else{
result.setMsg(configurableBom.getSuperBomCode()+"没有维护默认值");
result.setCode(500);
return result;
} }
} else {
result.setMsg("H3CPN没有维护对照关系");
result.setCode(500);
return result;
} }
//没有下架 撞配 封装 撞配信息
SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo(); if(flag){
ArrayList<SuperBomSkuConfigInfo> configs = new ArrayList<>(); //没有下架 撞配 封装 撞配信息
superBomSkuInfo.setSuperBomCode(cpnList.getH3cPn()); SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo();
superBomSkuInfo.setConfigId(cpnList.getConfigId()); ArrayList<SuperBomSkuConfigInfo> configs = new ArrayList<>();
superBomSkuInfo.setApplyUser("H3C"); superBomSkuInfo.setSuperBomCode(configurableBom.getSuperBomCode());
superBomSkuInfo = (SuperBomSkuInfo) superBomSkuInfoMapper.getSkuInfo(superBomSkuInfo); superBomSkuInfo.setConfigId(configurableBom.getConfigId());
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) { superBomSkuInfo.setPatern("CTO");
SuperBomSkuConfigInfo superBomSkuConfigInfo = superBomSkuInfoMapper.getConfigInfoList(cpnList.getConfigId(), keyValues.getH3cVCode()); superBomSkuInfo.setApplyUser("H3C");
configs.add(superBomSkuConfigInfo); GetConfigurationInputDTO getConfigurationInputDTO = new GetConfigurationInputDTO();
} List<Long> configIds = new ArrayList<>();
superBomSkuInfo.setCharacteristicList(configs); configIds.add(Long.valueOf(configurableBom.getConfigId()));
//撞配 找PLM申请SKU getConfigurationInputDTO.setConfigIds(configIds);
ApplySkuCodeResultDto skuInfo = applySkuCode(superBomSkuInfo); Object getConfigData = getConfigInfo(getConfigurationInputDTO);
if (skuInfo.getCode().equals(200)) { //撞配 找PLM申请SKU
ApplySkuCodeResultDto skuInfo = applySkuCode(superBomSkuInfo);
if (skuInfo.getCode().equals(200)) { if (skuInfo.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = skuInfo.getData(); if (skuInfo.getCode().equals(200)) {
data.setConfigId(superBomSkuInfo.getConfigId()); ApplySkuCodeResultDto.data data = skuInfo.getData();
data.setMsg("已回号"); data.setConfigId(superBomSkuInfo.getConfigId());
cpnList.setCode(skuInfo.getCode()); data.setMsg("已回号");
cpnList.setMsg(skuInfo.getMsg()); cpnList.setCode(skuInfo.getCode());
cpnList.setSkuCode(data.getSkuCode()); cpnList.setMsg(skuInfo.getMsg());
cpnList.setSkuName(data.getSkuName()); cpnList.setSkuCode(data.getSkuCode());
data.setUser(SecurityService.getPrincipal().getCode()); cpnList.setSkuName(data.getSkuName());
characteristicMapper.updateSuperBomSkuInfo(data); data.setUser(SecurityService.getPrincipal().getCode());
characteristicMapper.updateSuperBomSkuInfo(data);
} else {
result.setCode(skuInfo.getCode());
result.setMsg("调用PLM申请回号失败");
result.setData(skuInfo);
return result;
}
} else { } else {
result.setMsg(skuInfo.getMsg());
result.setCode(skuInfo.getCode()); result.setCode(skuInfo.getCode());
result.setMsg("调用PLM申请回号失败");
result.setData(skuInfo);
return result; return result;
} }
} else {
result.setMsg(skuInfo.getMsg());
result.setCode(skuInfo.getCode());
return result;
} }
} }
} }
} }
......
...@@ -122,7 +122,13 @@ ...@@ -122,7 +122,13 @@
</select> </select>
<select id="getNameByCode" resultType="java.lang.String"> <select id="getNameByCode" resultType="java.lang.String">
select characteristic_name from super_characteristic_info where characteristic_code = #{characteristicCode} and is_show = #{isShow} SELECT characteristic_name
FROM super_characteristic_info a
left join super_table_item_info b on a.characteristic_code = b.characteristic_code
WHERE a.characteristic_code = #{ characteristicCode }
AND is_show = #{ isShow}
and b.group_number = #{groupNumber}
limit 1
</select> </select>
<select id="getCNameByCode" resultType="cn.com.uitech.authorization.pojo.entity.Characteristic"> <select id="getCNameByCode" resultType="cn.com.uitech.authorization.pojo.entity.Characteristic">
......
...@@ -312,7 +312,5 @@ ...@@ -312,7 +312,5 @@
select * from super_characteristic_value_info select * from super_characteristic_value_info
where h3c_c_value = #{h3cVCode} where h3c_c_value = #{h3cVCode}
and super_bom_code = #{h3cPn} and super_bom_code = #{h3cPn}
<!--and political_mining_id = #{param3}
and patern = #{param4}-->
</select> </select>
</mapper> </mapper>
...@@ -372,4 +372,7 @@ ...@@ -372,4 +372,7 @@
select * from super_bom_sku_info where cpq_config_id = #{cpqConfigId} and super_bom_code = #{superPartNumber} select * from super_bom_sku_info where cpq_config_id = #{cpqConfigId} and super_bom_code = #{superPartNumber}
</select> </select>
<select id="getConfigId" resultType="cn.com.uitech.authorization.pojo.entity.ConfigurableBom">
select config_id from super_bom_info where h3c_pn = #{h3cPn}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -64,9 +64,10 @@ ...@@ -64,9 +64,10 @@
</resultMap> </resultMap>
<select id="findBySuperBomCode" resultMap="baseResultMap"> <select id="findBySuperBomCode" resultMap="baseResultMap">
select * from select * from super_table_info a
super_table_info a left join super_table_item_info b on a.table_number = b.table_number
left join super_table_item_info b on a.table_number = b.table_number left join super_characteristic_info c on b.characteristic_code = c.characteristic_code
left join super_characteristic_value_info d on b.characteristic_value_code = d.characteristic_value_code
where a.super_bom_code = #{superBomCode} where a.super_bom_code = #{superBomCode}
order by b.characteristic_code order by b.characteristic_code
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment