Commit 2a6af525 by zhaoxiaolei

H3C 约束完结

parent 91156b43
......@@ -89,4 +89,8 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
void updateSuperBomSku(SuperBomSkuInfo superBomSkuInfo);
Integer updateCharacteristicIsH3C(CharacteristicRequestParamDto dto);
List<Characteristic> getCharacteristicH3CList(String superBomCode);
Integer getCharacteristicInfo(String characteristicCode, String superBomCode);
}
......@@ -39,6 +39,7 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Stream;
@Service
......@@ -793,6 +794,12 @@ public class IntegrateServiceImpl implements IntegrateService {
if (!ObjectUtils.isEmpty(configurableBom)) {
//有configid
if (!StringUtils.isEmpty(configurableBom.getConfigId())) {
//查询出superBom下所有isH3C的数据
List<Characteristic> characteristicH3CList = characteristicMapper.getCharacteristicH3CList(configurableBom.getSuperBomCode());
List<String> h3cCodeList = new ArrayList<>();
for (Characteristic characteristic : characteristicH3CList) {
h3cCodeList.add(characteristic.getCharacteristicCode());
}
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) {
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), configurableBom.getSuperBomCode());
//验证H3CVCODE 是否存在
......@@ -802,19 +809,42 @@ public class IntegrateServiceImpl implements IntegrateService {
flag = false;
break;
} else {
//验证特征的是否存在
//characteristicValue.get
// 查询出superBom下所有isH3C的数据 characteristicH3CList 比较 是否都有传
boolean contains = h3cCodeList.contains(characteristicValue.getCharacteristicCode());
if(!contains){
Integer isH3C = characteristicMapper.getCharacteristicInfo(characteristicValue.getCharacteristicCode(), configurableBom.getSuperBomCode());
if(isH3C.equals(1)){
//不存在数据库isH3C的数据返回报错
cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicCode() + "特征不能为空!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
flag = false;
break;
}else{
//验证H3CVCODE是否下架
if (characteristicValue.getIsState() == 0) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicValueCode() + "已下架!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
flag = false;
break;
} else {
//有superbom 有configid h3cvcode存在 没有下架 设置true进行撞配
flag = true;
}
}
}else{
//验证H3CVCODE是否下架
if (characteristicValue.getIsState() == 0) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicValueCode() + "已下架!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
flag = false;
break;
} else {
//有superbom 有configid h3cvcode存在 没有下架 设置true进行撞配
flag = true;
}
}
}
}
}else{
//没有configid
......@@ -915,6 +945,26 @@ public class IntegrateServiceImpl implements IntegrateService {
Map<String,Object> buildConfigurationMap = (Map<String, Object>) JSONObject.toJSON(buildConfiguration);
String configId = (String) buildConfigurationMap.get("configId");
superBomSkuInfo.setConfigId(configId);
//撞配之前调用前置验证
//构建前置验证数据结构
PostVerifyInputDTO postVerifyInputDTO = new PostVerifyInputDTO();
postVerifyInputDTO.setProductClassCode(((SuperBomSkuInfo) superBomInfo).getProductClassCode());
postVerifyInputDTO.setSuperBomCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode());
postVerifyInputDTO.setOperator("system");
postVerifyInputDTO.setSessionId(sessionId);
List<PostVerifyInputDTO.SelectedCharacteristicListBean> selectedCharacteristicLists = new ArrayList<>();
superBomSkuInfo.getCharacteristicList().forEach(selectedCharacteristic->{
PostVerifyInputDTO.SelectedCharacteristicListBean selectedCharacteristicListBean = new PostVerifyInputDTO.SelectedCharacteristicListBean();
//根据 list里面的vcode 查询v信息和c信息 赋值到 生成配置的对象里
selectedCharacteristicListBean.setCharacteristicName(selectedCharacteristic.getCharacteristicName());
selectedCharacteristicListBean.setCharacteristicValueName(selectedCharacteristic.getCharacteristicValueName());
selectedCharacteristicListBean.setQuantity(1);
selectedCharacteristicLists.add(selectedCharacteristicListBean);
});
postVerifyInputDTO.setSelectedCharacteristicList(selectedCharacteristicLists);
Object preVerify = integrateController.preVerify(postVerifyInputDTO, null);
Map<String, Object> preVerifyMap = (Map<String, Object>) JSONObject.toJSON(preVerify);
if(preVerifyMap.get("result").equals(true)){
//撞配 找PLM申请SKU
Object ob = GetSKUByConfigInfo(superBomSkuInfo);
boolean flag1 = ob instanceof GetProductOutDto;
......@@ -939,6 +989,10 @@ public class IntegrateServiceImpl implements IntegrateService {
}
}
}
}else{
cpnList.setCode(500);
cpnList.setMsg("配置结果违反约束冲突"+(String) preVerifyMap.get("message"));
}
}
}
}
......
......@@ -208,4 +208,12 @@
</if>
</where>
</update>
<select id="getCharacteristicH3CList" resultType="cn.com.uitech.authorization.pojo.entity.Characteristic">
select * from super_characteristic_info where is_h3c = 1 and super_bom_code = #{superBomCode}
</select>
<select id="getCharacteristicInfo" resultType="java.lang.Integer">
select is_h3c isH3C from super_characteristic_info where characteristic_Code = #{characteristicCode} and super_bom_code = #{superBomCode}
</select>
</mapper>
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