Commit 3552ea3d by zhaoxiaolei

selector

parent 0c903091
......@@ -83,17 +83,16 @@ public class IntegrateController {
List<Map<String, Object>> constraintCharacteristicValues = new ArrayList<>();
data.forEach(item -> {
Map<String, Object> constraintCharacteristicValue = new HashMap<>();
constraintCharacteristicValue.put("groupNumber", item.getGroupNumber());
List<Map<String, Object>> characteristicValues = new ArrayList<>();
List<SuperTableInfo> infos = item.getSuperTableInfos();
infos.forEach(info -> {
Map<String, Object> characteristicValue = new HashMap<>();
List<String> values = new ArrayList<>();
List<SuperTableItemInfo> itemInfos = info.getData();
itemInfos.forEach(itemInfo -> {
constraintCharacteristicValue.put("groupNumber", item.getGroupNumber());
String characteristicCode = itemInfo.getCharacteristicCode();
String cName = integrateService.getNameByCode(characteristicCode,selectorEntity.getIsShow());
String cName = integrateService.getNameByCode(characteristicCode,selectorEntity.getIsShow(), item.getGroupNumber());
if (!StringUtils.isEmpty(cName)) {
characteristicValue.put("characteristicName", cName);
String characteristicValueCode = itemInfo.getCharacteristicValueCode();
......@@ -107,15 +106,14 @@ public class IntegrateController {
characteristicValue.put("values", values);
characteristicValues.add(characteristicValue);
});
constraintCharacteristicValue.put("characteristicValues", characteristicValues);
constraintCharacteristicValues.add(constraintCharacteristicValue);
});
map.put("constraintCharacteristicValues", constraintCharacteristicValues);
map.put("constraintCharacteristicName", featureComponentNames);
redisEntity.setData(map);
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);
......
......@@ -68,7 +68,7 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
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);
......
......@@ -102,5 +102,5 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
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>
SuperBomSkuInfo getSkuInfo(GetSkuInputInfo getSkuInputInfo);
ConfigurableBom getConfigId(String h3cPn);
}
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.SuperTableInfoLog;
import cn.com.uitech.authorization.pojo.entity.SuperTableInfo;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
import java.util.Map;
@Mapper
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 {
String getName(Object v);
String getNameByCode(String characteristicCode,Integer isShow);
String getNameByCode(String characteristicCode,Integer isShow,String groupNumber);
String getVNameByCode(String characteristicValueCode,String characteristicCode);
......
......@@ -341,8 +341,8 @@ public class IntegrateServiceImpl implements IntegrateService {
}
@Override
public String getNameByCode(String characteristicCode, Integer isShow) {
return characteristicMapper.getNameByCode(characteristicCode, isShow);
public String getNameByCode(String characteristicCode, Integer isShow, String groupNumber) {
return characteristicMapper.getNameByCode(characteristicCode, isShow, groupNumber);
}
@Override
......@@ -777,66 +777,79 @@ public class IntegrateServiceImpl implements IntegrateService {
List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList();
for (GetSKUByH3CConfigInfo.H3CPNList cpnList : h3CPNList) {
ConfigurableBom configurableBom = ctoBomMapper.getConfigId(cpnList.getH3cPn());
boolean flag = false;
if (!CollectionUtils.isEmpty(cpnList.getSelectedCharacteristicList())) {
List<GetSKUByH3CConfigInfo.KeyValues> selectedCharacteristicList = cpnList.getSelectedCharacteristicList();
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) {
Integer politicalMiningId = cpnList.getPoliticalMiningId();
String politicalMining = "";
if (politicalMiningId.equals(0)) {
politicalMining = "否";
} else if (politicalMiningId.equals(1)) {
politicalMining = "是";
}
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), cpnList.getH3cPn(), politicalMining, cpnList.getPatern());
if (ObjectUtils.isEmpty(characteristicValue)) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
return configSkuInfo;
} else {
//不为空时校验是否下架
if (characteristicValue.getIsState() == 0) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicValueCode() + "已下架!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
return configSkuInfo;
if (!ObjectUtils.isEmpty(configurableBom)) {
if (!StringUtils.isEmpty(configurableBom.getConfigId())) {
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) {
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), cpnList.getH3cPn());
if (ObjectUtils.isEmpty(characteristicValue)) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
return configSkuInfo;
} else {
//不为空时校验是否下架
if (characteristicValue.getIsState() == 0) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicValueCode() + "已下架!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
return configSkuInfo;
}else{
flag = true;
}
}
}
}else{
result.setMsg(configurableBom.getSuperBomCode()+"没有维护默认值");
result.setCode(500);
return result;
}
} else {
result.setMsg("H3CPN没有维护对照关系");
result.setCode(500);
return result;
}
//没有下架 撞配 封装 撞配信息
SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo();
ArrayList<SuperBomSkuConfigInfo> configs = new ArrayList<>();
superBomSkuInfo.setSuperBomCode(cpnList.getH3cPn());
superBomSkuInfo.setConfigId(cpnList.getConfigId());
superBomSkuInfo.setApplyUser("H3C");
superBomSkuInfo = (SuperBomSkuInfo) superBomSkuInfoMapper.getSkuInfo(superBomSkuInfo);
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) {
SuperBomSkuConfigInfo superBomSkuConfigInfo = superBomSkuInfoMapper.getConfigInfoList(cpnList.getConfigId(), keyValues.getH3cVCode());
configs.add(superBomSkuConfigInfo);
}
superBomSkuInfo.setCharacteristicList(configs);
//撞配 找PLM申请SKU
ApplySkuCodeResultDto skuInfo = applySkuCode(superBomSkuInfo);
if (skuInfo.getCode().equals(200)) {
if(flag){
//没有下架 撞配 封装 撞配信息
SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo();
ArrayList<SuperBomSkuConfigInfo> configs = new ArrayList<>();
superBomSkuInfo.setSuperBomCode(configurableBom.getSuperBomCode());
superBomSkuInfo.setConfigId(configurableBom.getConfigId());
superBomSkuInfo.setPatern("CTO");
superBomSkuInfo.setApplyUser("H3C");
GetConfigurationInputDTO getConfigurationInputDTO = new GetConfigurationInputDTO();
List<Long> configIds = new ArrayList<>();
configIds.add(Long.valueOf(configurableBom.getConfigId()));
getConfigurationInputDTO.setConfigIds(configIds);
Object getConfigData = getConfigInfo(getConfigurationInputDTO);
//撞配 找PLM申请SKU
ApplySkuCodeResultDto skuInfo = applySkuCode(superBomSkuInfo);
if (skuInfo.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = skuInfo.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("已回号");
cpnList.setCode(skuInfo.getCode());
cpnList.setMsg(skuInfo.getMsg());
cpnList.setSkuCode(data.getSkuCode());
cpnList.setSkuName(data.getSkuName());
data.setUser(SecurityService.getPrincipal().getCode());
characteristicMapper.updateSuperBomSkuInfo(data);
if (skuInfo.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = skuInfo.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("已回号");
cpnList.setCode(skuInfo.getCode());
cpnList.setMsg(skuInfo.getMsg());
cpnList.setSkuCode(data.getSkuCode());
cpnList.setSkuName(data.getSkuName());
data.setUser(SecurityService.getPrincipal().getCode());
characteristicMapper.updateSuperBomSkuInfo(data);
} else {
result.setCode(skuInfo.getCode());
result.setMsg("调用PLM申请回号失败");
result.setData(skuInfo);
return result;
}
} else {
result.setMsg(skuInfo.getMsg());
result.setCode(skuInfo.getCode());
result.setMsg("调用PLM申请回号失败");
result.setData(skuInfo);
return result;
}
} else {
result.setMsg(skuInfo.getMsg());
result.setCode(skuInfo.getCode());
return result;
}
}
}
}
......
......@@ -122,7 +122,13 @@
</select>
<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 id="getCNameByCode" resultType="cn.com.uitech.authorization.pojo.entity.Characteristic">
......
......@@ -312,7 +312,5 @@
select * from super_characteristic_value_info
where h3c_c_value = #{h3cVCode}
and super_bom_code = #{h3cPn}
<!--and political_mining_id = #{param3}
and patern = #{param4}-->
</select>
</mapper>
......@@ -372,4 +372,7 @@
select * from super_bom_sku_info where cpq_config_id = #{cpqConfigId} and super_bom_code = #{superPartNumber}
</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>
\ No newline at end of file
......@@ -64,9 +64,10 @@
</resultMap>
<select id="findBySuperBomCode" resultMap="baseResultMap">
select * from
super_table_info a
left join super_table_item_info b on a.table_number = b.table_number
select * from super_table_info a
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}
order by b.characteristic_code
</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