Commit 309244d6 by zhaoxiaolei

增加token

parent 43598ab9
...@@ -25,4 +25,5 @@ public class GetConfigurationInputDTO { ...@@ -25,4 +25,5 @@ public class GetConfigurationInputDTO {
private List<String> configIds; private List<String> configIds;
private String skuCode; private String skuCode;
private String token;
} }
...@@ -21,5 +21,6 @@ public class SuperBomEntity { ...@@ -21,5 +21,6 @@ public class SuperBomEntity {
String h3cpn; String h3cpn;
String unisSalesName; String unisSalesName;
String configId; String configId;
String token;
List<Characteristics> characteristicList; List<Characteristics> characteristicList;
} }
package cn.com.uitech.authorization.service.impl; package cn.com.uitech.authorization.service.impl;
import cn.com.uitech.authorization.exception.BusinessException;
import cn.com.uitech.authorization.mapper.BomStatusMapper; import cn.com.uitech.authorization.mapper.BomStatusMapper;
import cn.com.uitech.authorization.mapper.CtoBomMapper; import cn.com.uitech.authorization.mapper.CtoBomMapper;
import cn.com.uitech.authorization.pojo.dto.ConfigurableBomLogOpera; import cn.com.uitech.authorization.pojo.dto.ConfigurableBomLogOpera;
import cn.com.uitech.authorization.pojo.dto.CtoBomRequestParamDto; import cn.com.uitech.authorization.pojo.dto.CtoBomRequestParamDto;
import cn.com.uitech.authorization.pojo.dto.GetProductOutDto;
import cn.com.uitech.authorization.pojo.entity.ConfigurableBom; import cn.com.uitech.authorization.pojo.entity.ConfigurableBom;
import cn.com.uitech.authorization.pojo.entity.ProductGroup; import cn.com.uitech.authorization.pojo.entity.ProductGroup;
import cn.com.uitech.authorization.service.CtoBomService; import cn.com.uitech.authorization.service.CtoBomService;
import cn.com.uitech.authorization.utils.ApiResult;
import cn.com.uitech.authorization.utils.RedisHelper; import cn.com.uitech.authorization.utils.RedisHelper;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
...@@ -33,7 +36,7 @@ public class CtoBomServiceImpl implements CtoBomService { ...@@ -33,7 +36,7 @@ public class CtoBomServiceImpl implements CtoBomService {
@Autowired @Autowired
private CtoBomMapper ctoBomMapper; private CtoBomMapper ctoBomMapper;
@Autowired @Autowired
private BomStatusMapper bomStatusMapper; private IntegrateServiceImpl integrateService;
@Resource @Resource
private RedisHelper redisHelper; private RedisHelper redisHelper;
...@@ -46,20 +49,13 @@ public class CtoBomServiceImpl implements CtoBomService { ...@@ -46,20 +49,13 @@ public class CtoBomServiceImpl implements CtoBomService {
*/ */
@Override @Override
public Object getCtoBoms(CtoBomRequestParamDto ctoBomRequestParamDto) { public Object getCtoBoms(CtoBomRequestParamDto ctoBomRequestParamDto) {
if (!org.springframework.util.StringUtils.isEmpty(ctoBomRequestParamDto.getToken())) { GetProductOutDto getProductOutDto = integrateService.checkToken(ctoBomRequestParamDto.getToken());
String redisToken = redisHelper.get("unis_cpq:" + ctoBomRequestParamDto.getToken()); if(getProductOutDto.getCode().equals(200)){
if (!org.springframework.util.StringUtils.isEmpty(redisToken)) { PageHelper.startPage(ctoBomRequestParamDto.getPage(), ctoBomRequestParamDto.getPerPage());
PageHelper.startPage(ctoBomRequestParamDto.getPage(), ctoBomRequestParamDto.getPerPage()); List<ConfigurableBom> ctoBoms = ctoBomMapper.getCtoBoms(ctoBomRequestParamDto);
List<ConfigurableBom> ctoBoms = ctoBomMapper.getCtoBoms(ctoBomRequestParamDto); return new PageInfo(ctoBoms);
return new PageInfo(ctoBoms); }else{
throw new BusinessException(ApiResult.UNAUTHORIZED.getCode(),"token失效!");
} else {
ctoBomRequestParamDto.setToken(ctoBomRequestParamDto.getToken() + "token已失效,请重新申请");
return ctoBomRequestParamDto;
}
} else {
ctoBomRequestParamDto.setToken("请传入正确的token");
return ctoBomRequestParamDto;
} }
} }
...@@ -149,9 +145,11 @@ public class CtoBomServiceImpl implements CtoBomService { ...@@ -149,9 +145,11 @@ public class CtoBomServiceImpl implements CtoBomService {
@Override @Override
public PageInfo<ConfigurableBom> getCtoBom(CtoBomRequestParamDto ctoBomRequestParamDto) { public PageInfo<ConfigurableBom> getCtoBom(CtoBomRequestParamDto ctoBomRequestParamDto) {
PageHelper.startPage(ctoBomRequestParamDto.getPage(), ctoBomRequestParamDto.getPerPage());
List<ConfigurableBom> ctoBoms = ctoBomMapper.getCtoBoms(ctoBomRequestParamDto); PageHelper.startPage(ctoBomRequestParamDto.getPage(), ctoBomRequestParamDto.getPerPage());
return new PageInfo(ctoBoms); List<ConfigurableBom> ctoBoms = ctoBomMapper.getCtoBoms(ctoBomRequestParamDto);
return new PageInfo(ctoBoms);
} }
......
...@@ -405,147 +405,32 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -405,147 +405,32 @@ public class IntegrateServiceImpl implements IntegrateService {
public Object GetSKUByConfigInfo(SuperBomSkuInfo superBomSkuInfo, HttpServletRequest request,Integer temp) { public Object GetSKUByConfigInfo(SuperBomSkuInfo superBomSkuInfo, HttpServletRequest request,Integer temp) {
GetProductOutDto result = new GetProductOutDto(); GetProductOutDto result = new GetProductOutDto();
//checkToken(superBomSkuInfo.getToken()); GetProductOutDto getProductOutDto = checkToken(superBomSkuInfo.getToken());
if (!ObjectUtils.isEmpty(superBomSkuInfo)) { if (getProductOutDto.getCode().equals(200)) {
/** if (!ObjectUtils.isEmpty(superBomSkuInfo)) {
1.申请SKU->验证配置是否存在->存在->是否生成SKU->生成SKU->返回SKU信息 /**
2.申请SKU->验证配置是否存在->存在->是否生成SKU->未生成SKU->使用历史configid申请SKU->返回SKU信息 1.申请SKU->验证配置是否存在->存在->是否生成SKU->生成SKU->返回SKU信息
3.申请SKU->验证配置是否存在->不存在->保存配置信息->申请SKU->返回SKU信息 2.申请SKU->验证配置是否存在->存在->是否生成SKU->未生成SKU->使用历史configid申请SKU->返回SKU信息
4.申请失败的SKU->可以再次提交申请->申请SKU->返回SKU信息 3.申请SKU->验证配置是否存在->不存在->保存配置信息->申请SKU->返回SKU信息
**/ 4.申请失败的SKU->可以再次提交申请->申请SKU->返回SKU信息
if (superBomSkuInfo.getPoliticalMiningId() != null && superBomSkuInfo.getPatern() != null && superBomSkuInfo.getSuperBomCode() != null && superBomSkuInfo.getBrand() != null) { **/
//根据 政采 模式 品牌 superbom 查询sku主信息 if (superBomSkuInfo.getPoliticalMiningId() != null && superBomSkuInfo.getPatern() != null && superBomSkuInfo.getSuperBomCode() != null && superBomSkuInfo.getBrand() != null) {
if (superBomSkuInfo.getIsConfig().equals("是")) { //根据 政采 模式 品牌 superbom 查询sku主信息
//todo 01-10 是特配的不做本地验证,每次都重新申请 if (superBomSkuInfo.getIsConfig().equals("是")) {
//根据 政采 模式 品牌 superbom 查询sku主信息 没有查询到信息 //todo 01-10 是特配的不做本地验证,每次都重新申请
//撞配不通过 保存SKU信息&config信息 调用申请SKU接口 applySkuCode
superBomSkuInfo.setId(sequence.nextId());
SuperBomSkuInfoLogOpera logOpera = new SuperBomSkuInfoLogOpera();
BeanUtils.copyProperties(superBomSkuInfo,logOpera);
logOpera.setUpdateUser(request.getHeader("UserCode"));
if(temp==1){
logOpera.setOpera("/integrate/saveSukInfo");
}else if(temp == 2){
logOpera.setOpera("/integrate/GetSKUByH3CConfigInfo");
}else if(temp == 3){
logOpera.setOpera("/integrate/GetConfigBySUKINFO");
}else if(temp == 0){
logOpera.setOpera("/integrate/GetSKUByConfigInfo");
}
superBomSkuInfoMapper.saveLogOpera(logOpera);
superBomSkuInfoMapper.saveSkuInfo(superBomSkuInfo);
List<SuperBomSkuConfigInfo> characteristicList = superBomSkuInfo.getCharacteristicList();
characteristicList.forEach(item -> {
SuperBomSkuConfigInfo config = new SuperBomSkuConfigInfo();
BeanUtils.copyProperties(item, config);
config.setId(sequence.nextId());
config.setConfigId(superBomSkuInfo.getConfigId());
superBomSkuInfoMapper.saveSkuConfig(config);
});
//调用PLM申请sku号 返回后修改sku数据返回
ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo, request);
if (applySkuCodeResultDto.getCode().equals(200)) {
if (applySkuCodeResultDto.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("已回号");
data.setUser(superBomSkuInfo.getApplyUser());
characteristicMapper.updateSuperBomSkuInfo(data);
superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode());
result.setData(superBomSkuInfo);
return result;
} else {
superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg());
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setCode(applySkuCodeResultDto.getCode());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setData(applySkuCodeResultDto);
return result;
}
} else {
superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg());
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode());
return result;
}
} else {
List<SuperBomSkuInfo> skuInfos = superBomSkuInfoMapper.getSkuInfo(superBomSkuInfo);
Boolean flag = true;
if (!CollectionUtils.isEmpty(skuInfos)) {
for (SuperBomSkuInfo skuInfo : skuInfos) {
//对比查出来的skuConfig信息是否完全一样
List<String> items = superBomSkuInfoMapper.getConfigInfos(skuInfo.getConfigId());
List<String> newItems = new ArrayList<>();
ArrayList<SuperBomSkuConfigInfo> params = new ArrayList<>(superBomSkuInfo.getCharacteristicList());
params.forEach(param -> newItems.add(param.getCharacteristicCode() + param.getCharacteristicValueCode() + skuInfo.getSuperBomCode()));
boolean equals = items.containsAll(newItems);
//撞配成功
if (equals) {
SuperBomSkuInfo getSkuByConfigId = superBomSkuInfoMapper.getSkuInfoByConfigId(skuInfo.getConfigId());
if (!StringUtils.isEmpty(getSkuByConfigId.getSkuCode())) {
//1.申请SKU->验证配置是否存在->存在->是否生成SKU->生成SKU->返回SKU信息
superBomSkuInfo.setSkuCode(getSkuByConfigId.getSkuCode());
superBomSkuInfo.setSkuName(getSkuByConfigId.getSkuName());
result.setMsg("配置已存在:SKUCode:" + superBomSkuInfo.getSkuCode());
result.setCode(500);
result.setData(superBomSkuInfo);
return result;
} else {
//2.申请SKU->验证配置是否存在->存在->是否生成SKU->
// 未生成SKU->使用历史configid申请SKU->返回SKU信息
superBomSkuInfo.setConfigId(skuInfo.getConfigId());
ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo, request);
if (applySkuCodeResultDto.getCode().equals(200)) {
if (applySkuCodeResultDto.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("已回号");
data.setUser(superBomSkuInfo.getApplyUser());
characteristicMapper.updateSuperBomSkuInfo(data);
superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
// result.setMsg(applySkuCodeResultDto.getMsg());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(200);
result.setData(superBomSkuInfo);
return result;
} else {
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setCode(500);
result.setMsg(applySkuCodeResultDto.getMsg());
return result;
}
} else {
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode());
return result;
}
}
} else {
//撞配失败赋值false
flag = false;
}
}
} else {
//根据 政采 模式 品牌 superbom 查询sku主信息 没有查询到信息 //根据 政采 模式 品牌 superbom 查询sku主信息 没有查询到信息
//撞配不通过 保存SKU信息&config信息 调用申请SKU接口 applySkuCode //撞配不通过 保存SKU信息&config信息 调用申请SKU接口 applySkuCode
superBomSkuInfo.setId(sequence.nextId()); superBomSkuInfo.setId(sequence.nextId());
SuperBomSkuInfoLogOpera logOpera = new SuperBomSkuInfoLogOpera(); SuperBomSkuInfoLogOpera logOpera = new SuperBomSkuInfoLogOpera();
BeanUtils.copyProperties(superBomSkuInfo,logOpera); BeanUtils.copyProperties(superBomSkuInfo, logOpera);
logOpera.setUpdateUser(request.getHeader("UserCode")); logOpera.setUpdateUser(request.getHeader("UserCode"));
if(temp==1){ if (temp == 1) {
logOpera.setOpera("/integrate/saveSukInfo"); logOpera.setOpera("/integrate/saveSukInfo");
}else if(temp == 2){ } else if (temp == 2) {
logOpera.setOpera("/integrate/GetSKUByH3CConfigInfo"); logOpera.setOpera("/integrate/GetSKUByH3CConfigInfo");
}else if(temp == 3){ } else if (temp == 3) {
logOpera.setOpera("/integrate/GetConfigBySUKINFO"); logOpera.setOpera("/integrate/GetConfigBySUKINFO");
}else if(temp == 0){ } else if (temp == 0) {
logOpera.setOpera("/integrate/GetSKUByConfigInfo"); logOpera.setOpera("/integrate/GetSKUByConfigInfo");
} }
superBomSkuInfoMapper.saveLogOpera(logOpera); superBomSkuInfoMapper.saveLogOpera(logOpera);
...@@ -569,6 +454,10 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -569,6 +454,10 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristicMapper.updateSuperBomSkuInfo(data); characteristicMapper.updateSuperBomSkuInfo(data);
superBomSkuInfo.setSkuCode(data.getSkuCode()); superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName()); superBomSkuInfo.setSkuName(data.getSkuName());
superBomSkuInfo.setDescription(data.getDescription());
superBomSkuInfo.setSncode(data.getSnCode());
superBomSkuInfo.setProductType(data.getProductType());
superBomSkuInfo.setProductSmallType(data.getProductSmallType());
result.setMsg(applySkuCodeResultDto.getMsg()); result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode()); result.setCode(applySkuCodeResultDto.getCode());
result.setData(superBomSkuInfo); result.setData(superBomSkuInfo);
...@@ -588,80 +477,211 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -588,80 +477,211 @@ public class IntegrateServiceImpl implements IntegrateService {
result.setCode(applySkuCodeResultDto.getCode()); result.setCode(applySkuCodeResultDto.getCode());
return result; return result;
} }
} else {
List<SuperBomSkuInfo> skuInfos = superBomSkuInfoMapper.getSkuInfo(superBomSkuInfo);
Boolean flag = true;
if (!CollectionUtils.isEmpty(skuInfos)) {
for (SuperBomSkuInfo skuInfo : skuInfos) {
//对比查出来的skuConfig信息是否完全一样
List<String> items = superBomSkuInfoMapper.getConfigInfos(skuInfo.getConfigId());
List<String> newItems = new ArrayList<>();
ArrayList<SuperBomSkuConfigInfo> params = new ArrayList<>(superBomSkuInfo.getCharacteristicList());
params.forEach(param -> newItems.add(param.getCharacteristicCode() + param.getCharacteristicValueCode() + skuInfo.getSuperBomCode()));
boolean equals = items.containsAll(newItems);
//撞配成功
if (equals) {
SuperBomSkuInfo getSkuByConfigId = superBomSkuInfoMapper.getSkuInfoByConfigId(skuInfo.getConfigId());
if (!StringUtils.isEmpty(getSkuByConfigId.getSkuCode())) {
//1.申请SKU->验证配置是否存在->存在->是否生成SKU->生成SKU->返回SKU信息
superBomSkuInfo.setSkuCode(getSkuByConfigId.getSkuCode());
superBomSkuInfo.setSkuName(getSkuByConfigId.getSkuName());
result.setMsg("配置已存在:SKUCode:" + superBomSkuInfo.getSkuCode());
result.setCode(500);
result.setData(superBomSkuInfo);
return result;
} else {
//2.申请SKU->验证配置是否存在->存在->是否生成SKU->
// 未生成SKU->使用历史configid申请SKU->返回SKU信息
superBomSkuInfo.setConfigId(skuInfo.getConfigId());
ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo, request);
if (applySkuCodeResultDto.getCode().equals(200)) {
if (applySkuCodeResultDto.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("已回号");
data.setUser(superBomSkuInfo.getApplyUser());
characteristicMapper.updateSuperBomSkuInfo(data);
superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
superBomSkuInfo.setDescription(data.getDescription());
superBomSkuInfo.setSncode(data.getSnCode());
superBomSkuInfo.setProductType(data.getProductType());
superBomSkuInfo.setProductSmallType(data.getProductSmallType());
// result.setMsg(applySkuCodeResultDto.getMsg());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(200);
result.setData(superBomSkuInfo);
return result;
} else {
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setCode(500);
result.setMsg(applySkuCodeResultDto.getMsg());
return result;
}
} else {
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode());
return result;
}
}
} } else {
//3.申请SKU->验证配置是否存在->不存在->保存配置信息->申请SKU->返回SKU信息 //撞配失败赋值false
//撞配不通过 保存SKU信息&config信息 调用申请SKU接口 applySkuCode flag = false;
if (flag.equals(false)) { }
superBomSkuInfo.setId(sequence.nextId()); }
SuperBomSkuInfoLogOpera logOpera = new SuperBomSkuInfoLogOpera(); } else {
BeanUtils.copyProperties(superBomSkuInfo,logOpera); //根据 政采 模式 品牌 superbom 查询sku主信息 没有查询到信息
logOpera.setUpdateUser(request.getHeader("UserCode")); //撞配不通过 保存SKU信息&config信息 调用申请SKU接口 applySkuCode
if(temp==1){ superBomSkuInfo.setId(sequence.nextId());
logOpera.setOpera("/integrate/saveSukInfo"); SuperBomSkuInfoLogOpera logOpera = new SuperBomSkuInfoLogOpera();
}else if(temp == 2){ BeanUtils.copyProperties(superBomSkuInfo, logOpera);
logOpera.setOpera("/integrate/GetSKUByH3CConfigInfo"); logOpera.setUpdateUser(request.getHeader("UserCode"));
}else if(temp == 3){ if (temp == 1) {
logOpera.setOpera("/integrate/GetConfigBySUKINFO"); logOpera.setOpera("/integrate/saveSukInfo");
}else if(temp == 0){ } else if (temp == 2) {
logOpera.setOpera("/integrate/GetSKUByConfigInfo"); logOpera.setOpera("/integrate/GetSKUByH3CConfigInfo");
} } else if (temp == 3) {
superBomSkuInfoMapper.saveLogOpera(logOpera); logOpera.setOpera("/integrate/GetConfigBySUKINFO");
superBomSkuInfoMapper.saveSkuInfo(superBomSkuInfo); } else if (temp == 0) {
List<SuperBomSkuConfigInfo> characteristicList = superBomSkuInfo.getCharacteristicList(); logOpera.setOpera("/integrate/GetSKUByConfigInfo");
characteristicList.forEach(item -> { }
SuperBomSkuConfigInfo config = new SuperBomSkuConfigInfo(); superBomSkuInfoMapper.saveLogOpera(logOpera);
BeanUtils.copyProperties(item, config); superBomSkuInfoMapper.saveSkuInfo(superBomSkuInfo);
config.setId(sequence.nextId()); List<SuperBomSkuConfigInfo> characteristicList = superBomSkuInfo.getCharacteristicList();
config.setConfigId(superBomSkuInfo.getConfigId()); characteristicList.forEach(item -> {
superBomSkuInfoMapper.saveSkuConfig(config); SuperBomSkuConfigInfo config = new SuperBomSkuConfigInfo();
}); BeanUtils.copyProperties(item, config);
//调用PLM申请sku号 返回后修改sku数据返回 config.setId(sequence.nextId());
ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo, request); config.setConfigId(superBomSkuInfo.getConfigId());
if (applySkuCodeResultDto.getCode().equals(200)) { superBomSkuInfoMapper.saveSkuConfig(config);
});
//调用PLM申请sku号 返回后修改sku数据返回
ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo, request);
if (applySkuCodeResultDto.getCode().equals(200)) { if (applySkuCodeResultDto.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData(); if (applySkuCodeResultDto.getCode().equals(200)) {
data.setConfigId(superBomSkuInfo.getConfigId()); ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setMsg("已回号"); data.setConfigId(superBomSkuInfo.getConfigId());
data.setUser(superBomSkuInfo.getApplyUser()); data.setMsg("已回号");
characteristicMapper.updateSuperBomSkuInfo(data); data.setUser(superBomSkuInfo.getApplyUser());
superBomSkuInfo.setSkuCode(data.getSkuCode()); characteristicMapper.updateSuperBomSkuInfo(data);
superBomSkuInfo.setSkuName(data.getSkuName()); superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
superBomSkuInfo.setDescription(data.getDescription());
superBomSkuInfo.setSncode(data.getSnCode());
superBomSkuInfo.setProductType(data.getProductType());
superBomSkuInfo.setProductSmallType(data.getProductSmallType());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode());
result.setData(superBomSkuInfo);
return result;
} else {
superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg());
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setCode(applySkuCodeResultDto.getCode());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setData(applySkuCodeResultDto);
return result;
}
} else {
superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg());
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setMsg(applySkuCodeResultDto.getMsg()); result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode()); result.setCode(applySkuCodeResultDto.getCode());
result.setData(superBomSkuInfo);
return result; return result;
}
}
//3.申请SKU->验证配置是否存在->不存在->保存配置信息->申请SKU->返回SKU信息
//撞配不通过 保存SKU信息&config信息 调用申请SKU接口 applySkuCode
if (flag.equals(false)) {
superBomSkuInfo.setId(sequence.nextId());
SuperBomSkuInfoLogOpera logOpera = new SuperBomSkuInfoLogOpera();
BeanUtils.copyProperties(superBomSkuInfo, logOpera);
logOpera.setUpdateUser(request.getHeader("UserCode"));
if (temp == 1) {
logOpera.setOpera("/integrate/saveSukInfo");
} else if (temp == 2) {
logOpera.setOpera("/integrate/GetSKUByH3CConfigInfo");
} else if (temp == 3) {
logOpera.setOpera("/integrate/GetConfigBySUKINFO");
} else if (temp == 0) {
logOpera.setOpera("/integrate/GetSKUByConfigInfo");
}
superBomSkuInfoMapper.saveLogOpera(logOpera);
superBomSkuInfoMapper.saveSkuInfo(superBomSkuInfo);
List<SuperBomSkuConfigInfo> characteristicList = superBomSkuInfo.getCharacteristicList();
characteristicList.forEach(item -> {
SuperBomSkuConfigInfo config = new SuperBomSkuConfigInfo();
BeanUtils.copyProperties(item, config);
config.setId(sequence.nextId());
config.setConfigId(superBomSkuInfo.getConfigId());
superBomSkuInfoMapper.saveSkuConfig(config);
});
//调用PLM申请sku号 返回后修改sku数据返回
ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo, request);
if (applySkuCodeResultDto.getCode().equals(200)) {
if (applySkuCodeResultDto.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("已回号");
data.setUser(superBomSkuInfo.getApplyUser());
characteristicMapper.updateSuperBomSkuInfo(data);
superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
superBomSkuInfo.setDescription(data.getDescription());
superBomSkuInfo.setSncode(data.getSnCode());
superBomSkuInfo.setProductType(data.getProductType());
superBomSkuInfo.setProductSmallType(data.getProductSmallType());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode());
result.setData(superBomSkuInfo);
return result;
} else {
superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg());
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setCode(applySkuCodeResultDto.getCode());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setData(applySkuCodeResultDto);
return result;
}
} else { } else {
superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg()); superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg());
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo); superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setCode(applySkuCodeResultDto.getCode());
result.setMsg(applySkuCodeResultDto.getMsg()); result.setMsg(applySkuCodeResultDto.getMsg());
result.setData(applySkuCodeResultDto); result.setCode(applySkuCodeResultDto.getCode());
return result; return result;
} }
} else { } else {
superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg()); result.setMsg("配置已存在,请勿重复申请");
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo); result.setCode(500);
result.setMsg(applySkuCodeResultDto.getMsg()); result.setData(superBomSkuInfo);
result.setCode(applySkuCodeResultDto.getCode());
return result; return result;
}
} else {
result.setMsg("配置已存在,请勿重复申请");
result.setCode(500);
result.setData(superBomSkuInfo);
return result;
}
} }
} else {
result.setMsg("是否政采/模式/产品编码/品牌是否,不能为空!");
result.setCode(500);
result.setData(superBomSkuInfo);
return result;
} }
} else {
result.setMsg("是否政采/模式/产品编码/品牌是否,不能为空!");
result.setCode(500);
result.setData(superBomSkuInfo);
return result;
} }
} else {
return getProductOutDto;
} }
return result; return result;
...@@ -677,32 +697,35 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -677,32 +697,35 @@ public class IntegrateServiceImpl implements IntegrateService {
**/ **/
public Object GetConfigBySUKINFO(SuperBomSkuInfo superBomSkuInfo, HttpServletRequest request) { public Object GetConfigBySUKINFO(SuperBomSkuInfo superBomSkuInfo, HttpServletRequest request) {
GetProductOutDto result = new GetProductOutDto(); GetProductOutDto result = new GetProductOutDto();
//checkToken(superBomSkuInfo.getToken()); GetProductOutDto getProductOutDto = checkToken(superBomSkuInfo.getToken());
if (getProductOutDto.getCode().equals(200)) {
//撞配 //撞配
Object ob = GetSKUByConfigInfo(superBomSkuInfo, request,3); superBomSkuInfo.setIsConfig("否");
boolean flag = ob instanceof GetProductOutDto; Object ob = GetSKUByConfigInfo(superBomSkuInfo, request, 3);
if (flag) { boolean flag = ob instanceof GetProductOutDto;
Object o = JSONObject.toJSON(ob); if (flag) {
Map<String, Object> map = (Map<String, Object>) o; Object o = JSONObject.toJSON(ob);
Integer code = (Integer) map.get("code"); Map<String, Object> map = (Map<String, Object>) o;
if (code.equals(200)) { Integer code = (Integer) map.get("code");
JSONObject data = (JSONObject) map.get("data"); if (code.equals(200)) {
result.setCode(200); JSONObject data = (JSONObject) map.get("data");
result.setData(data); result.setCode(200);
result.setData(data);
} else {
result.setCode(code);
result.setMsg((String) map.get("msg"));
result.setData(superBomSkuInfo);
}
return result;
} else { } else {
result.setCode(code); GetProductOutDto ss = (GetProductOutDto) ob;
result.setMsg((String) map.get("msg")); result.setCode(ss.getCode());
result.setData(superBomSkuInfo); result.setMsg(ss.getMsg());
return result;
} }
return result;
} else { } else {
GetProductOutDto ss = (GetProductOutDto) ob; return getProductOutDto;
result.setCode(ss.getCode());
result.setMsg(ss.getMsg());
return result;
} }
} }
/** /**
...@@ -712,22 +735,23 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -712,22 +735,23 @@ public class IntegrateServiceImpl implements IntegrateService {
* @Date 2021/12/29 14:23 * @Date 2021/12/29 14:23
* @Param * @Param
**/ **/
private GetProductOutDto checkToken(String token) { GetProductOutDto checkToken(String token) {
GetProductOutDto result = new GetProductOutDto(); GetProductOutDto result = new GetProductOutDto();
if (!StringUtils.isEmpty(token)) { if (!StringUtils.isEmpty(token)) {
String redisToken = redisHelper.get("unis_cpq:" + token); String redisToken = redisHelper.get("unis_cpq:" + token);
if (!StringUtils.isEmpty(redisToken)) { if (!StringUtils.isEmpty(redisToken)) {
result.setCode(200);
return result;
} else { } else {
result.setMsg(token + "token已失效,请重新申请"); result.setMsg(token + " token已失效,请重新申请");
result.setCode(500); result.setCode(ApiResult.UNAUTHORIZED.getCode());
return result; return result;
} }
} else { } else {
result.setMsg("请传入正确的token"); result.setMsg("请传入正确的token");
result.setCode(500); result.setCode(ApiResult.UNAUTHORIZED.getCode());
return result; return result;
} }
return result;
} }
...@@ -770,7 +794,8 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -770,7 +794,8 @@ public class IntegrateServiceImpl implements IntegrateService {
String doubleMd5 = MD5Util.getMD5Str(md5Str); String doubleMd5 = MD5Util.getMD5Str(md5Str);
result.setData(doubleMd5); result.setData(doubleMd5);
result.setCode(200); result.setCode(200);
redisHelper.set("unis_cpq:" + getOne.getUserCode().toUpperCase(), doubleMd5, 86400); //用于代码校验token
redisHelper.set("unis_cpq:" + doubleMd5, doubleMd5, 86400);
} else { } else {
result.setData(redis); result.setData(redis);
result.setCode(200); result.setCode(200);
...@@ -855,7 +880,7 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -855,7 +880,7 @@ public class IntegrateServiceImpl implements IntegrateService {
result.setCode(200); result.setCode(200);
redisHelper.set("unis_cpq:" + userinfo.getUserCode().toUpperCase(), doubleMd5, 86400); redisHelper.set("unis_cpq:" + userinfo.getUserCode().toUpperCase(), doubleMd5, 86400);
//用于代码校验token //用于代码校验token
//redisHelper.set("unis_cpq:" + doubleMd5, doubleMd5, 86400); redisHelper.set("unis_cpq:" + doubleMd5, doubleMd5, 86400);
} else { } else {
result.setMsg(null); result.setMsg(null);
result.setCode(200); result.setCode(200);
...@@ -1069,51 +1094,64 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -1069,51 +1094,64 @@ public class IntegrateServiceImpl implements IntegrateService {
**/ **/
public Object GetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo, HttpServletRequest request) { public Object GetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo, HttpServletRequest request) {
//checkToken(configSkuInfo.getToken()); GetProductOutDto getProductOutDto = checkToken(configSkuInfo.getToken());
if (getProductOutDto.getCode().equals(200)) {
/* /*
1.使用H3CPN匹配SKU表中SuperBOM 1.使用H3CPN匹配SKU表中SuperBOM
2.比对SKU下的所有配置,都在H3C清单中,就算匹配成功 2.比对SKU下的所有配置,都在H3C清单中,就算匹配成功
3.匹配不成功的,先查看配置是否满足VT约束,满足以后调用生成配置接口,获取配置JSON后GetSKUByConfigInfo 找PLM申请SKU 3.匹配不成功的,先查看配置是否满足VT约束,满足以后调用生成配置接口,获取配置JSON后GetSKUByConfigInfo 找PLM申请SKU
不支持特配,是否特配,默认不是 不支持特配,是否特配,默认不是
* */ * */
if (!CollectionUtils.isEmpty(configSkuInfo.getH3CPNList())) { if (!CollectionUtils.isEmpty(configSkuInfo.getH3CPNList())) {
List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList(); List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList();
for (GetSKUByH3CConfigInfo.H3CPNList cpnList : h3CPNList) { for (GetSKUByH3CConfigInfo.H3CPNList cpnList : h3CPNList) {
//根据H3CPN查询superbom //根据H3CPN查询superbom
ConfigurableBom configurableBom = ctoBomMapper.getConfigId(cpnList.getH3cPn()); ConfigurableBom configurableBom = ctoBomMapper.getConfigId(cpnList.getH3cPn());
boolean flag = false; 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();
//有superbom //有superbom
if (!ObjectUtils.isEmpty(configurableBom)) { if (!ObjectUtils.isEmpty(configurableBom)) {
//有configid //有configid
if (!StringUtils.isEmpty(configurableBom.getConfigId())) { if (!StringUtils.isEmpty(configurableBom.getConfigId())) {
//查询出superBom下所有isH3C的数据 //查询出superBom下所有isH3C的数据
List<Characteristic> characteristicH3CList = characteristicMapper.getCharacteristicH3CList(configurableBom.getSuperBomCode()); List<Characteristic> characteristicH3CList = characteristicMapper.getCharacteristicH3CList(configurableBom.getSuperBomCode());
List<String> h3cCodeList = new ArrayList<>(); List<String> h3cCodeList = new ArrayList<>();
for (Characteristic characteristic : characteristicH3CList) { for (Characteristic characteristic : characteristicH3CList) {
h3cCodeList.add(characteristic.getCharacteristicCode()); h3cCodeList.add(characteristic.getCharacteristicCode());
} }
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) { for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) {
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), configurableBom.getSuperBomCode()); CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), configurableBom.getSuperBomCode());
//验证H3CVCODE 是否存在 //验证H3CVCODE 是否存在
if (ObjectUtils.isEmpty(characteristicValue)) { if (ObjectUtils.isEmpty(characteristicValue)) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!"); cpnList.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
flag = false; flag = false;
break; break;
} else { } else {
// 查询出superBom下所有isH3C的数据 characteristicH3CList 比较 是否都有传 // 查询出superBom下所有isH3C的数据 characteristicH3CList 比较 是否都有传
boolean contains = h3cCodeList.contains(characteristicValue.getCharacteristicCode()); boolean contains = h3cCodeList.contains(characteristicValue.getCharacteristicCode());
if (!contains) { if (!contains) {
Integer isH3C = characteristicMapper.getCharacteristicInfo(characteristicValue.getCharacteristicCode(), configurableBom.getSuperBomCode()); Integer isH3C = characteristicMapper.getCharacteristicInfo(characteristicValue.getCharacteristicCode(), configurableBom.getSuperBomCode());
if (isH3C.equals(1)) { if (isH3C.equals(1)) {
//不存在数据库isH3C的数据返回报错 //不存在数据库isH3C的数据返回报错
cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicCode() + "特征不能为空!"); cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicCode() + "特征不能为空!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
flag = false; flag = false;
break; 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 { } else {
//验证H3CVCODE是否下架 //验证H3CVCODE是否下架
if (characteristicValue.getIsState() == 0) { if (characteristicValue.getIsState() == 0) {
...@@ -1126,207 +1164,204 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -1126,207 +1164,204 @@ public class IntegrateServiceImpl implements IntegrateService {
flag = 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
cpnList.setMsg(configurableBom.getSuperBomCode() + "没有维护默认值");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
continue;
} }
} else { } else {
//没有configid //没有superbom
cpnList.setMsg(configurableBom.getSuperBomCode() + "没有维护默认值"); cpnList.setMsg("H3CPN没有维护对照关系");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
continue; continue;
} }
} else { //有superbom 有configid h3cvcode存在 没有下架 设置true进行撞配
//没有superbom if (flag) {
cpnList.setMsg("H3CPN没有维护对照关系"); //根据configId生成配置
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); GetConfigurationInputDTO getConfigurationInputDTO = new GetConfigurationInputDTO();
continue; List<String> configIds = new ArrayList<>();
} configIds.add(configurableBom.getConfigId());
//有superbom 有configid h3cvcode存在 没有下架 设置true进行撞配 getConfigurationInputDTO.setConfigIds(configIds);
if (flag) { //调用生成配置接口
//根据configId生成配置 Object getConfigData = getConfigInfo(getConfigurationInputDTO);
GetConfigurationInputDTO getConfigurationInputDTO = new GetConfigurationInputDTO(); Object o = JSONObject.toJSON(getConfigData);
List<String> configIds = new ArrayList<>(); List<Object> objects = (List<Object>) o;
configIds.add(configurableBom.getConfigId()); Map<String, Object> map = (Map<String, Object>) objects.get(0);
getConfigurationInputDTO.setConfigIds(configIds); Object superBomInfo = map.get("superBomInfo");
//调用生成配置接口 SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo();
Object getConfigData = getConfigInfo(getConfigurationInputDTO); ArrayList<SuperBomSkuConfigInfo> configs = new ArrayList<>();
Object o = JSONObject.toJSON(getConfigData); superBomSkuInfo.setSuperBomCode(configurableBom.getSuperBomCode());
List<Object> objects = (List<Object>) o; superBomSkuInfo.setConfigId(configurableBom.getConfigId());
Map<String, Object> map = (Map<String, Object>) objects.get(0); //H3C 过来写死 CTO 不是特配
Object superBomInfo = map.get("superBomInfo"); BeanUtils.copyProperties(superBomInfo, superBomSkuInfo);
SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo(); superBomSkuInfo.setToken(configSkuInfo.getToken());
ArrayList<SuperBomSkuConfigInfo> configs = new ArrayList<>(); superBomSkuInfo.setPatern("CTO");
superBomSkuInfo.setSuperBomCode(configurableBom.getSuperBomCode()); superBomSkuInfo.setIsConfig("否");
superBomSkuInfo.setConfigId(configurableBom.getConfigId()); Integer politicalMiningId = cpnList.getPoliticalMiningId();
//H3C 过来写死 CTO if (politicalMiningId.equals(1)) {
BeanUtils.copyProperties(superBomInfo, superBomSkuInfo); superBomSkuInfo.setPoliticalMiningId("是");
superBomSkuInfo.setToken(configSkuInfo.getToken()); } else {
superBomSkuInfo.setPatern("CTO"); superBomSkuInfo.setPoliticalMiningId("否");
Integer politicalMiningId = cpnList.getPoliticalMiningId(); }
if (politicalMiningId.equals(1)) { SuperBomSkuInfo aa = (SuperBomSkuInfo) superBomInfo;
superBomSkuInfo.setPoliticalMiningId("是"); //获取list信息
} else { List<SuperBomSkuConfigInfo> characteristicList = aa.getCharacteristicList();
superBomSkuInfo.setPoliticalMiningId("否"); superBomSkuInfo.setCharacteristicList(characteristicList);
} //根据ccode vcode 替换list信息
SuperBomSkuInfo aa = (SuperBomSkuInfo) superBomInfo; List<GetSKUByH3CConfigInfo.KeyValues> paramList = cpnList.getSelectedCharacteristicList();
//获取list信息 //循环配置表信息
List<SuperBomSkuConfigInfo> characteristicList = aa.getCharacteristicList(); characteristicList.forEach(characteristic -> {
superBomSkuInfo.setCharacteristicList(characteristicList); //循环传进来的值信息
//根据ccode vcode 替换list信息 paramList.forEach(param -> {
List<GetSKUByH3CConfigInfo.KeyValues> paramList = cpnList.getSelectedCharacteristicList(); CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(param.getH3cVCode(), configurableBom.getSuperBomCode());
//循环配置表信息 if (characteristic.getCharacteristicCode().equals(characteristicValue.getCharacteristicCode())) {
characteristicList.forEach(characteristic -> { characteristic.setCharacteristicValueCode(characteristicValue.getCharacteristicValueCode());
//循环传进来的值信息 characteristic.setCharacteristicValueName(characteristicValue.getCharacteristicValueName());
paramList.forEach(param -> { characteristic.setUnisSalesVName(characteristicValue.getUnisSalesVName());
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(param.getH3cVCode(), configurableBom.getSuperBomCode()); characteristic.setH3cVValue(characteristicValue.getH3cDeliverCode());
if (characteristic.getCharacteristicCode().equals(characteristicValue.getCharacteristicCode())) { characteristic.setZphCode(characteristicValue.getZphCode());
characteristic.setCharacteristicValueCode(characteristicValue.getCharacteristicValueCode()); characteristic.setZphName(characteristicValue.getZphName());
characteristic.setCharacteristicValueName(characteristicValue.getCharacteristicValueName()); }
characteristic.setUnisSalesVName(characteristicValue.getUnisSalesVName());
characteristic.setH3cVValue(characteristicValue.getH3cDeliverCode());
characteristic.setZphCode(characteristicValue.getZphCode());
characteristic.setZphName(characteristicValue.getZphName());
}
});
}); });
});
//带着配置调用生成配置接口 获取configid赋值到撞配里面 //带着配置调用生成配置接口 获取configid赋值到撞配里面
BuildConfigurationInputDTO buildConfigurationInputDTO = new BuildConfigurationInputDTO(); BuildConfigurationInputDTO buildConfigurationInputDTO = new BuildConfigurationInputDTO();
buildConfigurationInputDTO.setProductGroupCode(superBomSkuInfo.getProductClassCode()); buildConfigurationInputDTO.setProductGroupCode(superBomSkuInfo.getProductClassCode());
buildConfigurationInputDTO.setProductClassCode(superBomSkuInfo.getProductClassCode()); buildConfigurationInputDTO.setProductClassCode(superBomSkuInfo.getProductClassCode());
buildConfigurationInputDTO.setMaterialCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode()); buildConfigurationInputDTO.setMaterialCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode());
buildConfigurationInputDTO.setOperator("system"); buildConfigurationInputDTO.setOperator("system");
buildConfigurationInputDTO.setSelectedComplete(true); buildConfigurationInputDTO.setSelectedComplete(true);
//构建初始化接口 获取sessionId //构建初始化接口 获取sessionId
SelectorEntity selectorEntity = new SelectorEntity(); SelectorEntity selectorEntity = new SelectorEntity();
selectorEntity.setIsShow(1); selectorEntity.setIsShow(1);
selectorEntity.setOperator("system"); selectorEntity.setOperator("system");
selectorEntity.setSystem("ZG"); selectorEntity.setSystem("ZG");
selectorEntity.setProductClassCode(((SuperBomSkuInfo) superBomInfo).getProductClassCode()); selectorEntity.setProductClassCode(((SuperBomSkuInfo) superBomInfo).getProductClassCode());
selectorEntity.setSuperBomCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode()); selectorEntity.setSuperBomCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode());
Object initializationData = integrateController.initializationData(selectorEntity); Object initializationData = integrateController.initializationData(selectorEntity);
Map<String, Object> initMap = (Map<String, Object>) JSONObject.toJSON(initializationData); Map<String, Object> initMap = (Map<String, Object>) JSONObject.toJSON(initializationData);
Map<String, Object> dataMap = (Map<String, Object>) initMap.get("data"); Map<String, Object> dataMap = (Map<String, Object>) initMap.get("data");
String sessionId = (String) dataMap.get("sessionId"); String sessionId = (String) dataMap.get("sessionId");
buildConfigurationInputDTO.setSessionId(sessionId); buildConfigurationInputDTO.setSessionId(sessionId);
List<BuildConfigurationInputDTO.SelectedCharacteristicListBean> selectedCharacteristicListBeans = new ArrayList<>(); List<BuildConfigurationInputDTO.SelectedCharacteristicListBean> selectedCharacteristicListBeans = new ArrayList<>();
//传入的pnlist //传入的pnlist
superBomSkuInfo.getCharacteristicList().forEach(selectedCharacteristic -> { superBomSkuInfo.getCharacteristicList().forEach(selectedCharacteristic -> {
BuildConfigurationInputDTO.SelectedCharacteristicListBean selectedCharacteristicListBean = new BuildConfigurationInputDTO.SelectedCharacteristicListBean(); BuildConfigurationInputDTO.SelectedCharacteristicListBean selectedCharacteristicListBean = new BuildConfigurationInputDTO.SelectedCharacteristicListBean();
//根据 list里面的vcode 查询v信息和c信息 赋值到 生成配置的对象里 //根据 list里面的vcode 查询v信息和c信息 赋值到 生成配置的对象里
selectedCharacteristicListBean.setCharacteristicName(selectedCharacteristic.getCharacteristicName()); selectedCharacteristicListBean.setCharacteristicName(selectedCharacteristic.getCharacteristicName());
selectedCharacteristicListBean.setCharacteristicValueName(selectedCharacteristic.getCharacteristicValueName()); selectedCharacteristicListBean.setCharacteristicValueName(selectedCharacteristic.getCharacteristicValueName());
selectedCharacteristicListBean.setQuantity(1); selectedCharacteristicListBean.setQuantity(1);
selectedCharacteristicListBeans.add(selectedCharacteristicListBean); selectedCharacteristicListBeans.add(selectedCharacteristicListBean);
}); });
buildConfigurationInputDTO.setSelectedCharacteristicList(selectedCharacteristicListBeans); buildConfigurationInputDTO.setSelectedCharacteristicList(selectedCharacteristicListBeans);
buildConfigurationInputDTO.setKeyValues(null); buildConfigurationInputDTO.setKeyValues(null);
Object buildConfiguration = integrateController.buildConfiguration(buildConfigurationInputDTO, null); Object buildConfiguration = integrateController.buildConfiguration(buildConfigurationInputDTO, null);
Map<String, Object> buildConfigurationMap = (Map<String, Object>) JSONObject.toJSON(buildConfiguration); Map<String, Object> buildConfigurationMap = (Map<String, Object>) JSONObject.toJSON(buildConfiguration);
String configId = (String) buildConfigurationMap.get("configId"); String configId = (String) buildConfigurationMap.get("configId");
superBomSkuInfo.setConfigId(configId); superBomSkuInfo.setConfigId(configId);
//撞配之前调用前置验证 //撞配之前调用前置验证
//构建前置验证数据结构 //构建前置验证数据结构
PostVerifyInputDTO postVerifyInputDTO = new PostVerifyInputDTO(); PostVerifyInputDTO postVerifyInputDTO = new PostVerifyInputDTO();
postVerifyInputDTO.setProductClassCode(((SuperBomSkuInfo) superBomInfo).getProductClassCode()); postVerifyInputDTO.setProductClassCode(((SuperBomSkuInfo) superBomInfo).getProductClassCode());
postVerifyInputDTO.setSuperBomCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode()); postVerifyInputDTO.setSuperBomCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode());
postVerifyInputDTO.setOperator("system"); postVerifyInputDTO.setOperator("system");
postVerifyInputDTO.setSessionId(sessionId); postVerifyInputDTO.setSessionId(sessionId);
List<PostVerifyInputDTO.SelectedCharacteristicListBean> selectedCharacteristicLists = new ArrayList<>(); List<PostVerifyInputDTO.SelectedCharacteristicListBean> selectedCharacteristicLists = new ArrayList<>();
superBomSkuInfo.getCharacteristicList().forEach(selectedCharacteristic -> { superBomSkuInfo.getCharacteristicList().forEach(selectedCharacteristic -> {
PostVerifyInputDTO.SelectedCharacteristicListBean selectedCharacteristicListBean = new PostVerifyInputDTO.SelectedCharacteristicListBean(); PostVerifyInputDTO.SelectedCharacteristicListBean selectedCharacteristicListBean = new PostVerifyInputDTO.SelectedCharacteristicListBean();
//根据 list里面的vcode 查询v信息和c信息 赋值到 生成配置的对象里 //根据 list里面的vcode 查询v信息和c信息 赋值到 生成配置的对象里
selectedCharacteristicListBean.setCharacteristicName(selectedCharacteristic.getCharacteristicName()); selectedCharacteristicListBean.setCharacteristicName(selectedCharacteristic.getCharacteristicName());
selectedCharacteristicListBean.setCharacteristicValueName(selectedCharacteristic.getCharacteristicValueName()); selectedCharacteristicListBean.setCharacteristicValueName(selectedCharacteristic.getCharacteristicValueName());
selectedCharacteristicListBean.setQuantity(1); selectedCharacteristicListBean.setQuantity(1);
selectedCharacteristicLists.add(selectedCharacteristicListBean); selectedCharacteristicLists.add(selectedCharacteristicListBean);
}); });
postVerifyInputDTO.setSelectedCharacteristicList(selectedCharacteristicLists); postVerifyInputDTO.setSelectedCharacteristicList(selectedCharacteristicLists);
Object preVerify = integrateController.preVerify(postVerifyInputDTO, null); Object preVerify = integrateController.preVerify(postVerifyInputDTO, null);
Map<String, Object> preVerifyMap = (Map<String, Object>) JSONObject.toJSON(preVerify); Map<String, Object> preVerifyMap = (Map<String, Object>) JSONObject.toJSON(preVerify);
if (preVerifyMap.get("result").equals(true)) { if (preVerifyMap.get("result").equals(true)) {
//撞配 找PLM申请SKU //撞配 找PLM申请SKU
Object ob = GetSKUByConfigInfo(superBomSkuInfo, request,2); Object ob = GetSKUByConfigInfo(superBomSkuInfo, request, 2);
boolean flag1 = ob instanceof GetProductOutDto; boolean flag1 = ob instanceof GetProductOutDto;
if (flag1) { if (flag1) {
Object o1 = JSONObject.toJSON(ob); Object o1 = JSONObject.toJSON(ob);
Map<String, Object> map1 = (Map<String, Object>) o1; Map<String, Object> map1 = (Map<String, Object>) o1;
Integer code = (Integer) map1.get("code"); Integer code = (Integer) map1.get("code");
if (code.equals(200)) { if (code.equals(200)) {
JSONObject data = (JSONObject) map1.get("data"); JSONObject data = (JSONObject) map1.get("data");
cpnList.setSkuCode((String) data.get("skuCode")); cpnList.setSkuCode((String) data.get("skuCode"));
cpnList.setSkuName((String) data.get("skuName")); cpnList.setSkuName((String) data.get("skuName"));
cpnList.setCode(code); cpnList.setCode(code);
} else {
Object data = map1.get("data");
if (!ObjectUtils.isEmpty(data)) {
Object data2 = JSONObject.toJSON(data);
Map<String, Object> map2 = (Map<String, Object>) data2;
if (!ObjectUtils.isEmpty(map2)) {
cpnList.setSkuCode((String) map2.get("skuCode"));
cpnList.setSkuName((String) map2.get("skuName"));
cpnList.setPatern("CTO");
cpnList.setCode(200);
}
} else { } else {
cpnList.setMsg((String) map1.get("msg")); Object data = map1.get("data");
cpnList.setCode(500); if (!ObjectUtils.isEmpty(data)) {
} Object data2 = JSONObject.toJSON(data);
Map<String, Object> map2 = (Map<String, Object>) data2;
if (!ObjectUtils.isEmpty(map2)) {
cpnList.setSkuCode((String) map2.get("skuCode"));
cpnList.setSkuName((String) map2.get("skuName"));
cpnList.setPatern("CTO");
cpnList.setCode(200);
}
} else {
cpnList.setMsg((String) map1.get("msg"));
cpnList.setCode(500);
}
}
} }
} else {
cpnList.setCode(500);
cpnList.setMsg("配置结果违反约束冲突" + (String) preVerifyMap.get("message"));
} }
} else { }
cpnList.setCode(500); } else {
cpnList.setMsg("配置结果违反约束冲突" + (String) preVerifyMap.get("message")); if (!ObjectUtils.isEmpty(configurableBom)) {
if (!ObjectUtils.isEmpty(configurableBom.getConfigId())) {
//查询出superBom下所有isH3C的数据
List<Characteristic> characteristicH3CList = characteristicMapper.getCharacteristicH3CList(configurableBom.getSuperBomCode());
List<String> h3cCodeList = new ArrayList<>();
for (Characteristic characteristic : characteristicH3CList) {
if (characteristic.getIsH3C().equals(1)) {
h3cCodeList.add(characteristic.getCharacteristicName());
}
} }
} //验证H3CVCODE 是否存在
}else{ for (String name : h3cCodeList) {
if (!ObjectUtils.isEmpty(configurableBom)) { cpnList.setMsg("CPQ数据验证失败,失败原因:" + name + "特征不能为空!");
if (!ObjectUtils.isEmpty(configurableBom.getConfigId())) { cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
//查询出superBom下所有isH3C的数据 break;
List<Characteristic> characteristicH3CList = characteristicMapper.getCharacteristicH3CList(configurableBom.getSuperBomCode());
List<String> h3cCodeList = new ArrayList<>();
for (Characteristic characteristic : characteristicH3CList) {
if (characteristic.getIsH3C().equals(1)) {
h3cCodeList.add(characteristic.getCharacteristicName());
} }
} } else {
//验证H3CVCODE 是否存在 //没有configid
for (String name : h3cCodeList) { cpnList.setMsg(configurableBom.getSuperBomCode() + "没有维护默认值");
cpnList.setMsg("CPQ数据验证失败,失败原因:" + name + "特征不能为空!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
break; continue;
} }
} else { } else {
//没有configid //没有superbom
cpnList.setMsg(configurableBom.getSuperBomCode() + "没有维护默认值"); cpnList.setMsg("H3CPN没有维护对照关系");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
continue; continue;
}
} else {
//没有superbom
cpnList.setMsg("H3CPN没有维护对照关系");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
continue;
}
} }
} }
} }
characteristicMapper.saveApplyOpera(configSkuInfo.toString(), request.getHeader("UserCode"), "H3C-撞配");
} else {
List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList();
h3CPNList.forEach(item -> {
item.setCode(getProductOutDto.getCode());
item.setMsg(getProductOutDto.getMsg());
});
return configSkuInfo;
} }
characteristicMapper.saveApplyOpera(configSkuInfo.toString(),request.getHeader("UserCode"),"H3C-撞配");
return configSkuInfo; return configSkuInfo;
} }
...@@ -1339,32 +1374,39 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -1339,32 +1374,39 @@ public class IntegrateServiceImpl implements IntegrateService {
* @return java.lang.Object * @return java.lang.Object
**/ **/
public Object getConfigInfo(GetConfigurationInputDTO getConfigurationInputDTO) { public Object getConfigInfo(GetConfigurationInputDTO getConfigurationInputDTO) {
if (CollectionUtils.isEmpty(getConfigurationInputDTO.getConfigIds())) { GetProductOutDto getProductOutDto = checkToken(getConfigurationInputDTO.getToken());
if (!StringUtils.isEmpty(getConfigurationInputDTO.getSkuCode())) { if (getProductOutDto.getCode().equals(200)) {
String configId = superBomSkuInfoMapper.getConfigId(getConfigurationInputDTO.getSkuCode());
List<String> configIds = new ArrayList<>(); if (CollectionUtils.isEmpty(getConfigurationInputDTO.getConfigIds())) {
configIds.add(configId); if (!StringUtils.isEmpty(getConfigurationInputDTO.getSkuCode())) {
getConfigurationInputDTO.setConfigIds(configIds); String configId = superBomSkuInfoMapper.getConfigId(getConfigurationInputDTO.getSkuCode());
} else { List<String> configIds = new ArrayList<>();
return "请输入skuCode/ConfigId"; configIds.add(configId);
getConfigurationInputDTO.setConfigIds(configIds);
} else {
return "请输入skuCode/ConfigId";
}
} }
}
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = getHttpHeader(); HttpHeaders headers = getHttpHeader();
getConfigurationInputDTO.setOperator("system"); getConfigurationInputDTO.setOperator("system");
HttpEntity<String> requestEntity = new HttpEntity<String>(JSON.toJSONString(getConfigurationInputDTO), headers); HttpEntity<String> requestEntity = new HttpEntity<String>(JSON.toJSONString(getConfigurationInputDTO), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange(selectorUrl+"/configurations", HttpMethod.POST, requestEntity, String.class); ResponseEntity<String> responseEntity = restTemplate.exchange(selectorUrl+"/configurations", HttpMethod.POST, requestEntity, String.class);
JSONObject object = JSONObject.parseObject(responseEntity.getBody()); JSONObject object = JSONObject.parseObject(responseEntity.getBody());
if (!ObjectUtils.isEmpty(object)) { if (!ObjectUtils.isEmpty(object)) {
Object data = object.get("data"); Object data = object.get("data");
if (!ObjectUtils.isEmpty(data)) { if (!ObjectUtils.isEmpty(data)) {
List list = (List) data; List list = (List) data;
Map<String, Object> map = (Map<String, Object>) list.get(0); Map<String, Object> map = (Map<String, Object>) list.get(0);
getSuperBomInfoByConfigId(map); getSuperBomInfoByConfigId(map);
}
} }
return object.get("data");
} else {
return getProductOutDto;
} }
return object.get("data");
} }
@Override @Override
......
...@@ -22,6 +22,7 @@ import org.apache.poi.openxml4j.util.ZipSecureFile; ...@@ -22,6 +22,7 @@ import org.apache.poi.openxml4j.util.ZipSecureFile;
import org.apache.poi.ss.usermodel.*; import org.apache.poi.ss.usermodel.*;
import org.apache.poi.xssf.usermodel.XSSFWorkbook; import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus; import org.springframework.http.HttpStatus;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
...@@ -53,6 +54,8 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate ...@@ -53,6 +54,8 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate
private SuperBomPriceCalculateMapper superBomPriceCalculateMapper; private SuperBomPriceCalculateMapper superBomPriceCalculateMapper;
@Resource @Resource
private BasicsPriceInfoMapper basicsPriceInfoMapper; private BasicsPriceInfoMapper basicsPriceInfoMapper;
@Autowired
private IntegrateServiceImpl integrateService;
/** /**
...@@ -63,94 +66,99 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate ...@@ -63,94 +66,99 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate
*/ */
@Override @Override
public Object getPriceByConfigInfo(SuperBomEntity superBomEntity) { public Object getPriceByConfigInfo(SuperBomEntity superBomEntity) {
// 1、获取cto价格信息 GetProductOutDto getProductOutDto = integrateService.checkToken(superBomEntity.getToken());
SuperBomPriceInfoEntity superBomPriceInfoEntity = new SuperBomPriceInfoEntity(); if (getProductOutDto.getCode().equals(200)) {
GetProductOutDto result = new GetProductOutDto(); // 1、获取cto价格信息
// 计算后的成本信息 SuperBomPriceInfoEntity superBomPriceInfoEntity = new SuperBomPriceInfoEntity();
String bomCodeTemp = superBomEntity.getSuperBomCode(); GetProductOutDto result = new GetProductOutDto();
List<Characteristics> selectedCharacteristicList = superBomEntity.getCharacteristicList(); // 计算后的成本信息
// 查询各级别价格系数以及定价方法是标准成本还是市场定价 String bomCodeTemp = superBomEntity.getSuperBomCode();
BasicsPriceInfoEntity basicsPriceInfoEntity = basicsPriceInfoMapper.queryBasicsPriceInfo(superBomEntity); List<Characteristics> selectedCharacteristicList = superBomEntity.getCharacteristicList();
if (ObjectUtils.isEmpty(basicsPriceInfoEntity)) { // 查询各级别价格系数以及定价方法是标准成本还是市场定价
superBomEntity.setSuperBomCode(null); BasicsPriceInfoEntity basicsPriceInfoEntity = basicsPriceInfoMapper.queryBasicsPriceInfo(superBomEntity);
basicsPriceInfoEntity = basicsPriceInfoMapper.queryBasicsPriceInfo(superBomEntity);
if (ObjectUtils.isEmpty(basicsPriceInfoEntity)) { if (ObjectUtils.isEmpty(basicsPriceInfoEntity)) {
result.setMsg("请维护价格系数"); superBomEntity.setSuperBomCode(null);
result.setCode(500); basicsPriceInfoEntity = basicsPriceInfoMapper.queryBasicsPriceInfo(superBomEntity);
return result; if (ObjectUtils.isEmpty(basicsPriceInfoEntity)) {
result.setMsg("请维护价格系数");
result.setCode(500);
return result;
}
} }
} if (!ObjectUtils.isEmpty(basicsPriceInfoEntity)) {
if (!ObjectUtils.isEmpty(basicsPriceInfoEntity)) { // 成本定价法 使用标准成本价*各级别系数计算
// 成本定价法 使用标准成本价*各级别系数计算 if ("0".equals(basicsPriceInfoEntity.getPriceType())) {
if ("0".equals(basicsPriceInfoEntity.getPriceType())) { BasicsPriceInfoEntity finalBasicsPriceInfoEntity = basicsPriceInfoEntity;
BasicsPriceInfoEntity finalBasicsPriceInfoEntity = basicsPriceInfoEntity; for (Characteristics characteristics : selectedCharacteristicList) {
for (Characteristics characteristics : selectedCharacteristicList) { superBomEntity.setSuperBomCode(bomCodeTemp);
superBomEntity.setSuperBomCode(bomCodeTemp); SuperBomPriceInfoEntity characteristicBomPriceInfo = getSuperBomPriceInfoEntity(superBomEntity, superBomPriceInfoEntity, characteristics);
SuperBomPriceInfoEntity characteristicBomPriceInfo = getSuperBomPriceInfoEntity(superBomEntity, superBomPriceInfoEntity, characteristics); if (ObjectUtils.isEmpty(characteristicBomPriceInfo)) {
if (ObjectUtils.isEmpty(characteristicBomPriceInfo)) { result.setMsg("请维护价格系数");
result.setMsg("请维护价格系数"); result.setCode(500);
result.setCode(500); return result;
return result; }
}
/* /*
一级价格调整价 一级价格调整价
*/ */
characteristics.setLeve1Price(characteristicBomPriceInfo.getLeve1Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getLeve0Price().multiply(finalBasicsPriceInfoEntity.getLeve1Ratio()) : characteristicBomPriceInfo.getLeve1Price()); characteristics.setLeve1Price(characteristicBomPriceInfo.getLeve1Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getLeve0Price().multiply(finalBasicsPriceInfoEntity.getLeve1Ratio()) : characteristicBomPriceInfo.getLeve1Price());
superBomPriceInfoEntity.setLeve1Price(superBomPriceInfoEntity.getLeve1Price().add(characteristics.getLeve1Price())); superBomPriceInfoEntity.setLeve1Price(superBomPriceInfoEntity.getLeve1Price().add(characteristics.getLeve1Price()));
/* /*
二级价格调整价 二级价格调整价
*/ */
characteristics.setLeve2Price(characteristicBomPriceInfo.getLeve2Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getLeve0Price().multiply(finalBasicsPriceInfoEntity.getLeve2Ratio()) : characteristicBomPriceInfo.getLeve2Price()); characteristics.setLeve2Price(characteristicBomPriceInfo.getLeve2Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getLeve0Price().multiply(finalBasicsPriceInfoEntity.getLeve2Ratio()) : characteristicBomPriceInfo.getLeve2Price());
superBomPriceInfoEntity.setLeve2Price(superBomPriceInfoEntity.getLeve2Price().add(characteristics.getLeve2Price())); superBomPriceInfoEntity.setLeve2Price(superBomPriceInfoEntity.getLeve2Price().add(characteristics.getLeve2Price()));
/* /*
三级价格调整价 三级价格调整价
*/ */
characteristics.setLeve3Price(characteristicBomPriceInfo.getLeve3Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getLeve0Price().multiply(finalBasicsPriceInfoEntity.getLeve3Ratio()) : characteristicBomPriceInfo.getLeve3Price()); characteristics.setLeve3Price(characteristicBomPriceInfo.getLeve3Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getLeve0Price().multiply(finalBasicsPriceInfoEntity.getLeve3Ratio()) : characteristicBomPriceInfo.getLeve3Price());
superBomPriceInfoEntity.setLeve3Price(superBomPriceInfoEntity.getLeve3Price().add(characteristics.getLeve3Price())); superBomPriceInfoEntity.setLeve3Price(superBomPriceInfoEntity.getLeve3Price().add(characteristics.getLeve3Price()));
/* /*
四级价格调整价 四级价格调整价
*/ */
characteristics.setLeve4Price(characteristicBomPriceInfo.getLeve4Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getLeve0Price().multiply(finalBasicsPriceInfoEntity.getLeve4Ratio()) : characteristicBomPriceInfo.getLeve4Price()); characteristics.setLeve4Price(characteristicBomPriceInfo.getLeve4Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getLeve0Price().multiply(finalBasicsPriceInfoEntity.getLeve4Ratio()) : characteristicBomPriceInfo.getLeve4Price());
superBomPriceInfoEntity.setLeve4Price(superBomPriceInfoEntity.getLeve4Price().add(characteristics.getLeve4Price())); superBomPriceInfoEntity.setLeve4Price(superBomPriceInfoEntity.getLeve4Price().add(characteristics.getLeve4Price()));
}
} else {
// 市场定价法 使用代理价*各级别系数计算
BasicsPriceInfoEntity finalBasicsPriceInfoEntity1 = basicsPriceInfoEntity;
for (Characteristics characteristics : selectedCharacteristicList) {
superBomEntity.setSuperBomCode(bomCodeTemp);
// 3、查询特征值价格信息
SuperBomPriceInfoEntity characteristicBomPriceInfo = getSuperBomPriceInfoEntity(superBomEntity, superBomPriceInfoEntity, characteristics);
if (ObjectUtils.isEmpty(characteristicBomPriceInfo)) {
result.setMsg("请维护价格系数");
result.setCode(500);
return result;
} }
} else {
// 市场定价法 使用代理价*各级别系数计算
BasicsPriceInfoEntity finalBasicsPriceInfoEntity1 = basicsPriceInfoEntity;
for (Characteristics characteristics : selectedCharacteristicList) {
superBomEntity.setSuperBomCode(bomCodeTemp);
// 3、查询特征值价格信息
SuperBomPriceInfoEntity characteristicBomPriceInfo = getSuperBomPriceInfoEntity(superBomEntity, superBomPriceInfoEntity, characteristics);
if (ObjectUtils.isEmpty(characteristicBomPriceInfo)) {
result.setMsg("请维护价格系数");
result.setCode(500);
return result;
}
/* /*
一级价格调整价 一级价格调整价
*/ */
characteristics.setLeve1Price(characteristicBomPriceInfo.getLeve1Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getAgentPrice().multiply(finalBasicsPriceInfoEntity1.getLeve1Ratio()) : characteristicBomPriceInfo.getLeve1Price()); characteristics.setLeve1Price(characteristicBomPriceInfo.getLeve1Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getAgentPrice().multiply(finalBasicsPriceInfoEntity1.getLeve1Ratio()) : characteristicBomPriceInfo.getLeve1Price());
superBomPriceInfoEntity.setLeve1Price(superBomPriceInfoEntity.getLeve1Price().add(characteristics.getLeve1Price())); superBomPriceInfoEntity.setLeve1Price(superBomPriceInfoEntity.getLeve1Price().add(characteristics.getLeve1Price()));
/* /*
二级价格调整价 二级价格调整价
*/ */
characteristics.setLeve2Price(characteristicBomPriceInfo.getLeve2Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getAgentPrice().multiply(finalBasicsPriceInfoEntity1.getLeve2Ratio()) : characteristicBomPriceInfo.getLeve2Price()); characteristics.setLeve2Price(characteristicBomPriceInfo.getLeve2Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getAgentPrice().multiply(finalBasicsPriceInfoEntity1.getLeve2Ratio()) : characteristicBomPriceInfo.getLeve2Price());
superBomPriceInfoEntity.setLeve2Price(superBomPriceInfoEntity.getLeve2Price().add(characteristics.getLeve2Price())); superBomPriceInfoEntity.setLeve2Price(superBomPriceInfoEntity.getLeve2Price().add(characteristics.getLeve2Price()));
/* /*
三级价格调整价 三级价格调整价
*/ */
characteristics.setLeve3Price(characteristicBomPriceInfo.getLeve3Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getAgentPrice().multiply(finalBasicsPriceInfoEntity1.getLeve3Ratio()) : characteristicBomPriceInfo.getLeve3Price()); characteristics.setLeve3Price(characteristicBomPriceInfo.getLeve3Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getAgentPrice().multiply(finalBasicsPriceInfoEntity1.getLeve3Ratio()) : characteristicBomPriceInfo.getLeve3Price());
superBomPriceInfoEntity.setLeve3Price(superBomPriceInfoEntity.getLeve3Price().add(characteristics.getLeve3Price())); superBomPriceInfoEntity.setLeve3Price(superBomPriceInfoEntity.getLeve3Price().add(characteristics.getLeve3Price()));
/* /*
四级价格调整价 四级价格调整价
*/ */
characteristics.setLeve4Price(characteristicBomPriceInfo.getLeve4Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getAgentPrice().multiply(finalBasicsPriceInfoEntity1.getLeve4Ratio()) : characteristicBomPriceInfo.getLeve4Price()); characteristics.setLeve4Price(characteristicBomPriceInfo.getLeve4Price().equals(BigDecimal.ZERO) ? characteristicBomPriceInfo.getAgentPrice().multiply(finalBasicsPriceInfoEntity1.getLeve4Ratio()) : characteristicBomPriceInfo.getLeve4Price());
superBomPriceInfoEntity.setLeve4Price(superBomPriceInfoEntity.getLeve4Price().add(characteristics.getLeve4Price())); superBomPriceInfoEntity.setLeve4Price(superBomPriceInfoEntity.getLeve4Price().add(characteristics.getLeve4Price()));
}
} }
} }
}
superBomPriceInfoEntity.setSelectedCharacteristicList(selectedCharacteristicList); superBomPriceInfoEntity.setSelectedCharacteristicList(selectedCharacteristicList);
return superBomPriceInfoEntity; return superBomPriceInfoEntity;
} else {
return getProductOutDto;
}
} }
/** /**
......
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