Commit 603c665e by zhaoxiaolei

增加修改特征/特征值后清空缓存功能

parent 8405366c
......@@ -35,7 +35,7 @@ import java.util.List;
@RestController
@RequestMapping("/characteristic")
@Api(tags = {"Characteristic 特征管理"})
//@ApiIgnore
@ApiIgnore
public class CharacteristicController {
......
......@@ -66,7 +66,7 @@ public class IntegrateController {
@PostMapping("/SetSuperTableInfo")
@ApiOperation(value = "集成OD约束关系", notes = "SetSuperTableInfo", httpMethod = "POST")
public CrmResponseEntity<?> SetSuperTableInfo(@RequestBody List<SaveTableInputDto> saveTableInputDtos) {
public CrmResponseEntity<?> setSuperTableInfo(@RequestBody List<SaveTableInputDto> saveTableInputDtos) {
return ResultGenerator.genSuccessResult(integrateService.SetSuperTableInfo(saveTableInputDtos));
}
......@@ -226,7 +226,7 @@ public class IntegrateController {
HttpHeaders headers = getHttpHeader();
preVerifyInputDTO.setProductGroupCode(preVerifyInputDTO.getProductClassCode());
HttpEntity<String> requestEntity = new HttpEntity<String>(JSON.toJSONString(preVerifyInputDTO), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange("http://127.0.0.1:8080/api/v1/selector/preVerify", HttpMethod.POST, requestEntity, String.class);
ResponseEntity<String> responseEntity = restTemplate.exchange(selectorUrl+"/preVerify", HttpMethod.POST, requestEntity, String.class);
JSONObject object = JSONObject.parseObject(responseEntity.getBody());
PreVerifyOutputDTO preVerifyOutputDTO = JSON.toJavaObject((JSON) object.get("data"), PreVerifyOutputDTO.class);
......@@ -241,7 +241,7 @@ public class IntegrateController {
activeValue.setCharacteristicName(characteristic.getCharacteristicName());
List<String> values2 = activeValue.getValues();
for (int i = 0; i < values2.size(); i++) {
String name = integrateService.getName(values2.get(i));
String name = integrateService.getName(values2.get(i),preVerifyInputDTO.getMaterialCode());
values2.add(name);
values2.remove(i);
}
......@@ -262,7 +262,7 @@ public class IntegrateController {
postVerifyInputDTO.setProductGroupCode(postVerifyInputDTO.getProductClassCode());
postVerifyInputDTO.setMaterialCode(postVerifyInputDTO.getSuperBomCode());
HttpEntity<String> requestEntity = new HttpEntity<String>(JSON.toJSONString(postVerifyInputDTO), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange("http://127.0.0.1:8080/api/v1/selector/postVerify", HttpMethod.POST, requestEntity, String.class);
ResponseEntity<String> responseEntity = restTemplate.exchange(selectorUrl+"/postVerify", HttpMethod.POST, requestEntity, String.class);
JSONObject object = JSONObject.parseObject(responseEntity.getBody());
return object.get("data");
}
......@@ -304,27 +304,32 @@ public class IntegrateController {
}
@PostMapping("/GetConfigBySUKINFO")
@ApiOperation(value = "SKU配置接口CRM", notes = "GetConfigBySUKINFO", httpMethod = "POST")
public CrmResponseEntity<?> GetConfigBySUKINFO(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
@ApiOperation(value = "CRM-SKU配置接口", notes = "GetConfigBySUKINFO", httpMethod = "POST")
public CrmResponseEntity<?> getConfigBySUKINFO(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
superBomSkuInfo.setApplyUser(request.getHeader("UserCode"));
return ResultGenerator.genSuccessResult(integrateService.GetConfigBySUKINFO(superBomSkuInfo,request));
}
@PostMapping("/GetSKUByConfigInfo")
@ApiOperation(value = "撞配", notes = "GetSKUByConfigInfo", httpMethod = "POST")
public CrmResponseEntity<?> GetSKUByConfigInfo(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
public CrmResponseEntity<?> getSKUByConfigInfo(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
superBomSkuInfo.setApplyUser(request.getHeader("UserCode"));
return ResultGenerator.genSuccessResult(integrateService.GetSKUByConfigInfo(superBomSkuInfo,request,0));
}
@PostMapping("/GetSKUByH3CConfigInfo")
@ApiOperation(value = "SKU配置接口H3C", notes = "GetSKUByH3CConfigInfo", httpMethod = "POST")
public CrmResponseEntity<?> GetSKUByH3CConfigInfo(@RequestBody GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request){
@ApiOperation(value = "H3C-SKU配置接口", notes = "GetSKUByH3CConfigInfo", httpMethod = "POST")
public CrmResponseEntity<?> getSKUByH3CConfigInfo(@RequestBody GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request){
return ResultGenerator.genSuccessResult(integrateService.GetSKUByH3CConfigInfo(configSkuInfo,request));
}
@PostMapping("/newGetSKUByH3CConfigInfo")
@ApiOperation(value = "H3C-新SKU配置接口", notes = "GetSKUByH3CConfigInfo", httpMethod = "POST")
public CrmResponseEntity<?> newGetSKUByH3CConfigInfo(@RequestBody GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request){
return ResultGenerator.genSuccessResult(integrateService.newGetSKUByH3CConfigInfo(configSkuInfo,request));
}
@PostMapping("/saveSukInfo")
@ApiOperation(value = "保存Sku信息CPQ", notes = "applySukCode", httpMethod = "POST")
@ApiOperation(value = "CPQ-保存Sku信息", notes = "applySukCode", httpMethod = "POST")
public CrmResponseEntity<?> saveSukInfo(@RequestBody SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request){
superBomSkuInfo.setApplyUser(request.getHeader("UserCode"));
return ResultGenerator.genSuccessResult(integrateService.saveSukInfo(superBomSkuInfo,request));
......
......@@ -28,7 +28,7 @@ import java.util.Map;
@RestController
@RequestMapping("/superBom")
@Api(tags = {"部件产品价格系数维护"})
//@ApiIgnore
@ApiIgnore
public class SuperBomPriceCalculateController {
@Resource
......
......@@ -95,7 +95,7 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
CharacteristicValue findByCharacteristicValueName(String characteristicName,String characteristicValueName,String superBomCode);
String getName(Object v);
String getName(String v,String superBomCode);
String getVNameByCode(String characteristicValueCode,String characteristicCode);
......
......@@ -23,14 +23,14 @@ public interface StandardModelManageMapper extends IBaseMapper<Characteristic>{
List<Characteristic> getStandardModel(StandardModelManageDto standardModelManageDto);
/**
* 修改特征的默认值为0
* @param characteristi
* 修改特征的默认值为0
* @param
* @return 行数
*/
void updateDefaultValueZero(@Param("list") List<String> characteristi,@Param("superBomCode") String superBomCode);
void updateDefaultValueZero(@Param("superBomCode") String superBomCode);
/**
* 修改特征的默认值为1
* 修改特征的默认值为1
* @param characteristiValue
* @return 行数
*/
......
......@@ -24,12 +24,14 @@ public interface IntegrateService {
CharacteristicValue findByCharacteristicValueName(String characteristicName,String characteristicValueName,String superBomCode);
String getName(Object v);
String getName(String v,String superBomCode);
Object getSuperBomInfoByConfigId(Map<String, Object> map);
Object GetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request);
Object newGetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo,HttpServletRequest request);
Object getConfigInfo(GetConfigurationInputDTO getConfigurationInputDTO);
Object saveSukInfo(SuperBomSkuInfo superBomSkuInfo,HttpServletRequest request);
......@@ -53,4 +55,6 @@ public interface IntegrateService {
Object ldapAuth(UserInfo userinfo);
void saveUserOperationLog(HttpServletRequest request, UserOperationLog log);
void cleanRedisData(String superBomCode,String productClassCode);
}
......@@ -2,16 +2,17 @@ package cn.com.uitech.authorization.service.impl;
import cn.com.uitech.authorization.exception.BizException;
import cn.com.uitech.authorization.mapper.CharacteristicMapper;
import cn.com.uitech.authorization.mapper.CtoBomMapper;
import cn.com.uitech.authorization.mapper.SuperBomPriceCalculateMapper;
import cn.com.uitech.authorization.pojo.dto.CharacteristicExportDto;
import cn.com.uitech.authorization.pojo.dto.CharacteristicLogOpera;
import cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto;
import cn.com.uitech.authorization.pojo.dto.GetProductOutDto;
import cn.com.uitech.authorization.pojo.entity.Characteristic;
import cn.com.uitech.authorization.pojo.entity.ConfigurableBom;
import cn.com.uitech.authorization.service.CharacteristicService;
import cn.com.uitech.authorization.service.CtoBomService;
import cn.com.uitech.authorization.service.IntegrateService;
import cn.com.uitech.authorization.utils.ApiResult;
import cn.com.uitech.authorization.utils.DateUitl;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
......@@ -38,7 +39,10 @@ import java.io.IOException;
import java.nio.charset.StandardCharsets;
import java.text.DecimalFormat;
import java.text.ParseException;
import java.util.*;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Objects;
/**
* @author yangkuo
......@@ -55,7 +59,10 @@ public class CharacteristicServiceImpl implements CharacteristicService {
private SuperBomPriceCalculateMapper superBomPriceCalculateMapper;
@Autowired
private CtoBomService ctoBomService;
private IntegrateService integrateService;
@Autowired
private CtoBomMapper ctoBomMapper;
/**
* 分页查询特征列表
......@@ -84,6 +91,10 @@ public class CharacteristicServiceImpl implements CharacteristicService {
logOpera.setOpera("/characteristic/update");
characteristicMapper.saveLogOpera(logOpera);
requestParamDto.setUpdateUser(request.getHeader("UserCode"));
//清空缓存
String superBomCode = requestParamDto.getSuperBomCode();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
integrateService.cleanRedisData(superBomCode,cto.getProductClassCode());
return characteristicMapper.updateCharacteristic(requestParamDto);
}
......@@ -381,6 +392,12 @@ public class CharacteristicServiceImpl implements CharacteristicService {
info.setUpdateUser(request.getHeader("UserCode"));
characteristicMapper.updateCharacteristicInfo(info);
}
if(!CollectionUtils.isEmpty(updateList)){
//清空缓存
String superBomCode = updateList.get(0).getSuperBomCode();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
integrateService.cleanRedisData(superBomCode,cto.getProductClassCode());
}
}
/**
......
......@@ -2,11 +2,14 @@ package cn.com.uitech.authorization.service.impl;
import cn.com.uitech.authorization.exception.BizException;
import cn.com.uitech.authorization.mapper.CharacteristicValueMapper;
import cn.com.uitech.authorization.mapper.CtoBomMapper;
import cn.com.uitech.authorization.mapper.SuperBomPriceCalculateMapper;
import cn.com.uitech.authorization.pojo.dto.*;
import cn.com.uitech.authorization.pojo.entity.CharacteristicValue;
import cn.com.uitech.authorization.pojo.entity.ConfigurableBom;
import cn.com.uitech.authorization.pojo.entity.OdRelation;
import cn.com.uitech.authorization.service.CharacteristicValueService;
import cn.com.uitech.authorization.service.IntegrateService;
import cn.com.uitech.authorization.utils.ApiResult;
import cn.com.uitech.authorization.utils.DateUitl;
import com.alibaba.fastjson.JSON;
......@@ -72,6 +75,13 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
private String plmUrlH;
@Autowired
private IntegrateService integrateService;
@Autowired
private CtoBomMapper ctoBomMapper;
/**
* 分页查询特征值数据
*
......@@ -110,6 +120,7 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
@Override
public Integer batchModifyBomStatus(CharacteristicValueRequestParamDto dto,HttpServletRequest request) {
List<Map<String, String>> characteristicValueCodes = dto.getCharacteristicValueCodes();
List<String> superBomCodes = new ArrayList<String>();
characteristicValueCodes.forEach(item->{
CharacteristicValue characteristicValue = characteristicValueMapper.getVByCode(item.get("characteristicValueCode"), item.get("superBomCode"));
CharacteristicValueLogOpera logOpera = new CharacteristicValueLogOpera();
......@@ -119,7 +130,16 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
characteristicValueMapper.saveLogOpera(logOpera);
dto.setUpdateUser(request.getHeader("UserCode"));
characteristicValueMapper.batchModifyBomStatus(item.get("characteristicValueCode"), item.get("superBomCode"),dto.getIsState(),request.getHeader("UserCode"));
superBomCodes.remove(item.get("characteristicValueCode")+"--"+item.get("superBomCode"));
superBomCodes.add(item.get("characteristicValueCode")+"--"+item.get("superBomCode"));
});
if(!CollectionUtils.isEmpty(superBomCodes)){
superBomCodes.forEach(item->{
//清空缓存
String[] split = item.split("--");
integrateService.cleanRedisData(split[0],split[1]);
});
}
return null;
}
......@@ -179,6 +199,10 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
logOpera.setOpera("/characteristicValue/editCharacteristicValue");
characteristicValueMapper.saveLogOpera(logOpera);
dto.setUpdateUser(request.getHeader("UserCode"));
//清空缓存
String superBomCode = dto.getSuperBomCode();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
integrateService.cleanRedisData(superBomCode,cto.getProductClassCode());
return characteristicValueMapper.editCharacteristicValue(dto);
}
}
......@@ -524,6 +548,12 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
v.setUpdateUser(request.getHeader("UserCode"));
characteristicValueMapper.updateCharacteristicValue(v);
}
if(!CollectionUtils.isEmpty(updateList)){
//清空缓存
String superBomCode = updateList.get(0).getSuperBomCode();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
integrateService.cleanRedisData(superBomCode,cto.getProductClassCode());
}
}
;
......
......@@ -133,6 +133,10 @@ public class IntegrateServiceImpl implements IntegrateService {
result.setMsg("请检查数据格式");
return result;
}
//清空缓存
String superBomCode = saveSuperBomInputDto.getScuxItemNumber();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
cleanRedisData(superBomCode, cto.getProductClassCode());
}
result.setCode(ApiResult.SUCCESS.getCode());
result.setMsg("数据集成完成,成功条数:" + flag);
......@@ -179,6 +183,10 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristicMapper.saveBom(characteristic);
}
}
//清空缓存
String superBomCode = saveSuperCharacterInputDtos.get(0).getSuperNumber();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
cleanRedisData(superBomCode, cto.getProductClassCode());
}
} catch (Exception e) {
new BusinessException(ApiResult.INTERNAL_SERVER_ERROR.getMsg());
......@@ -238,6 +246,10 @@ public class IntegrateServiceImpl implements IntegrateService {
flag++;
}
}
//清空缓存
String superBomCode = saveSuperCharacterValueInputDtos.get(0).getSuperNumber();
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
cleanRedisData(superBomCode, cto.getProductClassCode());
result.setMsg("table数据集成成功,成功条数:" + flag);
result.setCode(ApiResult.SUCCESS.getCode());
return result;
......@@ -264,6 +276,9 @@ public class IntegrateServiceImpl implements IntegrateService {
for (SaveTableInputDto saveTableInputDto : saveTableInputDtos) {
List<String> superBomCodeList = saveTableInputDto.getSuperBomCode();
for (String superBomCode : superBomCodeList) {
//清空缓存
ConfigurableBom cto = ctoBomMapper.getCto(superBomCode);
cleanRedisData(superBomCode, cto.getProductClassCode());
SuperTableInfo superTableInfo = new SuperTableInfo();
superTableInfo.setId(sequence.nextId());
superTableInfo.setSuperBomCode(superBomCode);
......@@ -378,8 +393,8 @@ public class IntegrateServiceImpl implements IntegrateService {
* @Param [v]
* @return java.lang.String
**/
public String getName(Object v) {
return characteristicValueMapper.getName(v);
public String getName(String v,String superBomCode) {
return characteristicValueMapper.getName(v,superBomCode);
}
@Override
......@@ -478,65 +493,6 @@ public class IntegrateServiceImpl implements IntegrateService {
return result;
}
} else {
//todo 0119 暂时关闭 撞配
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 {
superBomSkuInfo.setPlmMsg(applySkuCodeResultDto.getMsg());
superBomSkuInfoMapper.updateSkuStatus(superBomSkuInfo);
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode());
return result;
}
/*
List<SuperBomSkuInfo> skuInfos = superBomSkuInfoMapper.getSkuInfo(superBomSkuInfo);
Boolean flag = true;
if (!CollectionUtils.isEmpty(skuInfos)) {
......@@ -729,7 +685,6 @@ public class IntegrateServiceImpl implements IntegrateService {
return result;
}
*/
}
} else {
......@@ -960,6 +915,12 @@ public class IntegrateServiceImpl implements IntegrateService {
userInfoMapper.saveUserOperationLog(log);
}
@Override
public void cleanRedisData(String superBomCode, String productClassCode) {
redisHelper.del(RedisKey.getVariantTableKey("ZG", productClassCode, superBomCode));
}
/**
* @Author 赵晓雷
......@@ -1246,6 +1207,7 @@ public class IntegrateServiceImpl implements IntegrateService {
List<String> configIds = new ArrayList<>();
configIds.add(configurableBom.getConfigId());
getConfigurationInputDTO.setConfigIds(configIds);
getConfigurationInputDTO.setToken(configSkuInfo.getToken());
//调用生成配置接口
Object getConfigData = getConfigInfo(getConfigurationInputDTO);
Object o = JSONObject.toJSON(getConfigData);
......@@ -1426,6 +1388,244 @@ public class IntegrateServiceImpl implements IntegrateService {
}
@Override
public Object newGetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo, HttpServletRequest request) {
GetProductOutDto getProductOutDto = checkToken(configSkuInfo.getToken());
if (getProductOutDto.getCode().equals(200)) {
if (!CollectionUtils.isEmpty(configSkuInfo.getH3CPNList())) {
List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList();
for (GetSKUByH3CConfigInfo.H3CPNList cpnList : h3CPNList) {
//根据H3CPN查询superbom
ConfigurableBom configurableBom = ctoBomMapper.getConfigId(cpnList.getH3cPn());
boolean flag = false;
if (!CollectionUtils.isEmpty(cpnList.getSelectedCharacteristicList())) {
List<GetSKUByH3CConfigInfo.KeyValues> selectedCharacteristicList = cpnList.getSelectedCharacteristicList();
//有superbom
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 是否存在
if (ObjectUtils.isEmpty(characteristicValue)) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
flag = false;
break;
} else {
// 查询出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
cpnList.setMsg(configurableBom.getSuperBomCode() + "没有维护默认值");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
continue;
}
} else {
//没有superbom
cpnList.setMsg("H3CPN没有维护对照关系");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
continue;
}
//有superbom 有configid h3cvcode存在 没有下架 设置true进行撞配
if (flag) {
//根据configId生成配置
GetConfigurationInputDTO getConfigurationInputDTO = new GetConfigurationInputDTO();
List<String> configIds = new ArrayList<>();
configIds.add(configurableBom.getConfigId());
getConfigurationInputDTO.setConfigIds(configIds);
getConfigurationInputDTO.setToken(configSkuInfo.getToken());
//调用生成配置接口
Object getConfigData = getConfigInfo(getConfigurationInputDTO);
Object o = JSONObject.toJSON(getConfigData);
List<Object> objects = (List<Object>) o;
Map<String, Object> map = (Map<String, Object>) objects.get(0);
Object superBomInfo = map.get("superBomInfo");
SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo();
ArrayList<SuperBomSkuConfigInfo> configs = new ArrayList<>();
superBomSkuInfo.setSuperBomCode(configurableBom.getSuperBomCode());
superBomSkuInfo.setConfigId(configurableBom.getConfigId());
//H3C 过来写死 CTO 不是特配
BeanUtils.copyProperties(superBomInfo, superBomSkuInfo);
superBomSkuInfo.setToken(configSkuInfo.getToken());
superBomSkuInfo.setPatern("CTO");
superBomSkuInfo.setIsConfig("否");
Integer politicalMiningId = cpnList.getPoliticalMiningId();
if (politicalMiningId.equals(1)) {
superBomSkuInfo.setPoliticalMiningId("是");
} else {
superBomSkuInfo.setPoliticalMiningId("否");
}
SuperBomSkuInfo aa = (SuperBomSkuInfo) superBomInfo;
//获取list信息
List<SuperBomSkuConfigInfo> characteristicList = aa.getCharacteristicList();
superBomSkuInfo.setCharacteristicList(characteristicList);
//根据ccode vcode 替换list信息
List<GetSKUByH3CConfigInfo.KeyValues> paramList = cpnList.getSelectedCharacteristicList();
//循环配置表信息
characteristicList.forEach(characteristic -> {
//循环传进来的值信息
paramList.forEach(param -> {
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(param.getH3cVCode(), configurableBom.getSuperBomCode());
if (characteristic.getCharacteristicCode().equals(characteristicValue.getCharacteristicCode())) {
characteristic.setCharacteristicValueCode(characteristicValue.getCharacteristicValueCode());
characteristic.setCharacteristicValueName(characteristicValue.getCharacteristicValueName());
characteristic.setUnisSalesVName(characteristicValue.getUnisSalesVName());
characteristic.setH3cVValue(characteristicValue.getH3cDeliverCode());
characteristic.setZphCode(characteristicValue.getZphCode());
characteristic.setZphName(characteristicValue.getZphName());
}
});
});
//带着配置调用生成配置接口 获取configid赋值到撞配里面
BuildConfigurationInputDTO buildConfigurationInputDTO = new BuildConfigurationInputDTO();
buildConfigurationInputDTO.setProductGroupCode(superBomSkuInfo.getProductClassCode());
buildConfigurationInputDTO.setProductClassCode(superBomSkuInfo.getProductClassCode());
buildConfigurationInputDTO.setMaterialCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode());
buildConfigurationInputDTO.setOperator("system");
buildConfigurationInputDTO.setSelectedComplete(true);
//构建初始化接口 获取sessionId
SelectorEntity selectorEntity = new SelectorEntity();
selectorEntity.setIsShow(1);
selectorEntity.setOperator("system");
selectorEntity.setSystem("ZG");
selectorEntity.setProductClassCode(((SuperBomSkuInfo) superBomInfo).getProductClassCode());
selectorEntity.setSuperBomCode(((SuperBomSkuInfo) superBomInfo).getSuperBomCode());
Object initializationData = integrateController.initializationData(selectorEntity);
Map<String, Object> initMap = (Map<String, Object>) JSONObject.toJSON(initializationData);
Map<String, Object> dataMap = (Map<String, Object>) initMap.get("data");
String sessionId = (String) dataMap.get("sessionId");
buildConfigurationInputDTO.setSessionId(sessionId);
List<BuildConfigurationInputDTO.SelectedCharacteristicListBean> selectedCharacteristicListBeans = new ArrayList<>();
//传入的pnlist
superBomSkuInfo.getCharacteristicList().forEach(selectedCharacteristic -> {
BuildConfigurationInputDTO.SelectedCharacteristicListBean selectedCharacteristicListBean = new BuildConfigurationInputDTO.SelectedCharacteristicListBean();
//根据 list里面的vcode 查询v信息和c信息 赋值到 生成配置的对象里
selectedCharacteristicListBean.setCharacteristicName(selectedCharacteristic.getCharacteristicName());
selectedCharacteristicListBean.setCharacteristicValueName(selectedCharacteristic.getCharacteristicValueName());
selectedCharacteristicListBean.setQuantity(1);
selectedCharacteristicListBeans.add(selectedCharacteristicListBean);
});
buildConfigurationInputDTO.setSelectedCharacteristicList(selectedCharacteristicListBeans);
buildConfigurationInputDTO.setKeyValues(null);
Object buildConfiguration = integrateController.buildConfiguration(buildConfigurationInputDTO, null);
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)) {
continue;
} else {
cpnList.setCode(500);
cpnList.setMsg("配置结果违反约束冲突" + preVerifyMap.get("message"));
}
}
} else {
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 是否存在
for (String name : h3cCodeList) {
cpnList.setMsg("CPQ数据验证失败,失败原因:" + name + "特征不能为空!");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
break;
}
} else {
//没有configid
cpnList.setMsg(configurableBom.getSuperBomCode() + "没有维护默认值");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
continue;
}
} else {
//没有superbom
cpnList.setMsg("H3CPN没有维护对照关系");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
continue;
}
}
}
}
characteristicMapper.saveApplyOpera(configSkuInfo.toString(), request.getHeader("UserCode"), "H3C-撞配-NEW");
} else {
List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList();
h3CPNList.forEach(item -> {
item.setCode(getProductOutDto.getCode());
item.setMsg(getProductOutDto.getMsg());
});
return configSkuInfo;
}
return configSkuInfo;
}
@Override
/**
* @Author 赵晓雷
* @Description 根据configid获取配置
......
......@@ -88,8 +88,8 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic
}else {
throw new BizException(ApiResult.API_REQ_DATA_IS_FAIL);
}
//根据特征编码把下面所有的特征值更行成0非默认
standardModelManageMapper.updateDefaultValueZero(characteristi,dto.getSuperBomCode());
//根据superBom把下面所有的特征值更行成0非默认
standardModelManageMapper.updateDefaultValueZero(dto.getSuperBomCode());
//根据特征值编码把特征值更新为1 默认选中
standardModelManageMapper.updateDefaultValueOne(characteristiValue,dto.getSuperBomCode());
//更新cto的configId
......
......@@ -311,9 +311,8 @@
select characteristic_value_name
from super_table_item_info a
left join super_characteristic_value_info b
on a.characteristic_value_code = b.characteristic_value_code
where b.characteristic_value_code = #{v}
group by b.characteristic_value_name
on a.characteristic_value_code = b.characteristic_value_code and b.super_bom_code = a.super_bom_code
where b.characteristic_value_name = #{v} and b.super_bom_code = #{superBomCode}
</select>
<select id="getVNameByCode" resultType="java.lang.String">
......@@ -356,7 +355,10 @@
h3c_Deliver_Code = #{h3cDeliverCode},
update_time = now(),
update_user = #{updateUser}
where super_bom_code = #{superBomCode} and characteristic_Code = #{characteristicCode} and characteristic_Value_Code = #{characteristicValueCode}
where
super_bom_code = #{superBomCode}
and characteristic_Code = #{characteristicCode}
and characteristic_Value_Code = #{characteristicValueCode}
</update>
<insert id="saveLogOpera">
......
......@@ -45,17 +45,11 @@
</update>
<!--根据特征值编码把所有特征值更新为默认1-->
<!--根据特征值编码把所有特征值更新为默认0-->
<update id="updateDefaultValueZero" >
UPDATE super_characteristic_info
SET is_Show=1
UPDATE super_characteristic_value_info
SET is_base=0
<where>
<if test="list!=null and list.size()>0">
and characteristic_Code in
<foreach collection="list" item="item" open="(" separator="," close=")">
#{item}
</foreach>
</if>
<if test="superBomCode !=null and superBomCode !='' ">
and super_bom_code = #{superBomCode}
</if>
......
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