Commit a62af0d0 by zhaoxiaolei

修改H3C逻辑

修改特征.特征值.价格系数等bug
parent 3e44293e
......@@ -75,7 +75,6 @@ public class CharacteristicValueController {
public CrmResponseEntity<?> editCharacteristicValue(@Validated({EditSave.class}) @RequestBody CharacteristicValue dto) {
String code = SecurityService.getPrincipal().getCode();
logger.info("基础信息特征值管理维护 保存详情 ,操作人:{},物料:{}",code,dto.getCharacteristicValueCode());
ctoBomService.clearCache(dto.getSuperBomCode());
return ResultGenerator.genSuccessResult(characteristicValueService.editCharacteristicValue(dto));
}
......
......@@ -62,7 +62,6 @@ public class CtoBomController {
Integer rows = ctoBomService.updateCtoBomByBomCode(ctoBomRequestParamDto);
String code = SecurityService.getPrincipal().getCode();
logger.info("基础信息CTO维护 修改 ,操作人:{},物料{}",code,ctoBomRequestParamDto.getSuperBomCode());
clearcache(ctoBomRequestParamDto.getSuperBomCode());
return ResultGenerator.genSuccessResult(rows);
}
......@@ -141,12 +140,6 @@ public class CtoBomController {
return ResultGenerator.genSuccessResult();
}
@GetMapping("/cache/{bomCode}")
@ApiOperation(value = "基础信息CTO维护 cto 清除redis缓存", notes = "基础信息CTO维护 cto 清除redis缓存", httpMethod = "GET")
public CrmResponseEntity<?> clearcache(@PathVariable String bomCode) {
return ResultGenerator.genSuccessResult(ctoBomService.clearCache(bomCode));
}
@PostMapping("/getProductGroupList")
@ApiOperation(value = "基础信息 获取产品组信息", notes = "基础信息 获取产品组信息", httpMethod = "POST")
public CrmResponseEntity<?> getProductGroupList() {
......
......@@ -181,6 +181,25 @@ public class IntegrateController {
});
}
map.put("selectedValues", selectedValueList);
List<Map<String, Object>> characteristicListNew = new ArrayList<>();
Object characteristicLists = map.get("characteristicList");
List<Map<String, Object>> list = (List<Map<String, Object>>) characteristicLists;
list.forEach(item -> {
Map<String, Object> characteristicMap = new HashMap<>(6);
String characteristicName = (String) item.get("name");
Characteristic characteristic = integrateService.findByCharacteristicName(characteristicName, selectorEntity.getSuperBomCode());
characteristicMap.put("sort",characteristic.getSort());
characteristicMap.put("isDerive",item.get("isDerive"));
characteristicMap.put("name",item.get("name"));
characteristicMap.put("pairCharacteristicValueName",item.get("pairCharacteristicValueName"));
characteristicMap.put("type",item.get("type"));
characteristicMap.put("unisCName",item.get("unisCName"));
characteristicMap.put("values",item.get("values"));
characteristicListNew.add(characteristicMap);
});
map.remove("characteristicList");
map.put("characteristicList",characteristicListNew);
}
return object;
}
......
......@@ -58,6 +58,16 @@ public class CharacteristicRequestParamDto extends BasePageDto implements Seria
@ApiModelProperty(name = "isH3C",value = "isH3C",dataType ="Integer")
private Integer isH3C;
@ApiModelProperty(name = "sort",value = "排序",dataType ="Integer")
private Integer sort;
@ApiModelProperty(name = "plmName",value = "plm名称",dataType ="String")
private String plmName;
@ApiModelProperty(name = "productClassCode",value = "产品类型",dataType ="String")
private String productClassCode;
@ApiModelProperty(name = "brand",value = "品牌",dataType ="String")
private String brand;
/**
* 批量更新接口
......
......@@ -46,15 +46,27 @@ public class CharacteristicValueRequestParamDto extends BasePageDto implements S
/**
* cto机型是否可卖
*/
@ApiModelProperty(name = "bomStatus",value = "cto机型是否可卖",dataType ="Integer")
@ApiModelProperty(name = "bomStatus",value = "cto是否可卖",dataType ="Integer")
private Integer bomStatus;
@NotNull(message = "缺少特征值编码",groups = BathUpdate.class)
@ApiModelProperty(name = "characteristicValueCodes",value = "特征值编码",dataType ="String")
private String[] characteristicValueCodes;
@ApiModelProperty(name = "plmName",value = "plm名称",dataType ="String")
private String plmName;
@ApiModelProperty(name = "brand",value = "品牌",dataType ="String")
private String brand;
@ApiModelProperty(name = "productClassCode",value = "产品类型",dataType ="String")
private String productClassCode;
@ApiModelProperty(name = "isH3C",value = "isH3C",dataType ="Integer")
private Integer isH3C;
@ApiModelProperty(name = "isState",value = "特征值是否可卖",dataType ="Integer")
private Integer isState;
/**
* 特征列表是否可卖
*/
@ApiModelProperty(name = "status",value = "特征列表是否可卖",dataType ="Integer")
@ApiModelProperty(name = "status",value = "特征是否可卖",dataType ="Integer")
private Integer status;
}
......@@ -53,6 +53,9 @@ public class CtoBomRequestParamDto extends BasePageDto implements Serializable{
private String productClassCode;
@ApiModelProperty(name = "brand",value = "品牌",dataType ="String")
private String brand;
@ApiModelProperty(name = "plmName",value = "plm名称",dataType ="String")
private String plmName;
private List<String> superBomCodes;
......
package cn.com.uitech.authorization.pojo.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import lombok.ToString;
import lombok.experimental.Accessors;
@Accessors(chain = true)
@NoArgsConstructor
@Getter
@Setter
@ToString
public class SendDataToPlm {
@ApiModelProperty(name = "superBomCode",value = "cto编号",dataType ="String")
private String superBomCode;
@ApiModelProperty(name = "unisSalesVName",value = "销售特征值名称",dataType ="String")
private String unisSalesVName;
@ApiModelProperty(name = "h3cCValue",value = "H3C对照关系",dataType ="String")
private String h3cCValue;
@ApiModelProperty(name = "h3cDeliverCode",value = "H3C交付代码",dataType ="String")
private String h3cDeliverCode;
}
......@@ -63,6 +63,9 @@ public class Characteristic implements Serializable{
@Column(name="is_h3c")
@ApiModelProperty(name = "isH3C",value = "isH3C",dataType ="Integer",example = "1/0")
private Integer isH3C;
@Column(name="sort")
@ApiModelProperty(name = "sort",value = "sort",dataType ="Integer",example = "1/0")
private Integer sort;
@Transient
......
package cn.com.uitech.authorization.pojo.entity;
import cn.com.uitech.authorization.pojo.dto.BasePageDto;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
......@@ -13,6 +14,7 @@ import javax.persistence.Transient;
import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;
@Accessors(chain = true)
......@@ -152,7 +154,8 @@ public class SuperBomSkuInfo extends BasePageDto implements Serializable {
* 已回号/未回号
*/
@Column(name = "apply_time")
private Timestamp applyTime;
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
private Date applyTime;
/**
* 集成来的
......
......@@ -67,12 +67,6 @@ public interface CtoBomService {
void updateInsertCustomerbelongtoByBom(BomStatusEntity bomStatusEntity);
/**
* 清除redis缓存
* @param bomCode
*/
String clearCache(String bomCode);
void insertCto(List<ConfigurableBom> configurableBoms);
Object getProductGroupList();
......
......@@ -55,40 +55,9 @@ public class CharacteristicServiceImpl implements CharacteristicService {
*/
@Override
public Integer updateCharacteristic(CharacteristicRequestParamDto requestParamDto) {
//清理CTO缓存
ctoClearCache(requestParamDto);
return characteristicMapper.updateCharacteristic(requestParamDto);
}
/**
* 清理CTO缓存
* @param requestParamDto
*/
private void ctoClearCache(CharacteristicRequestParamDto requestParamDto) {
if(!StringUtils.isEmpty(requestParamDto.getCharacteristicCode())){
List<String> superBomCodes = characteristicMapper.getBomCodeByCcode(requestParamDto.getCharacteristicCode());
if(!CollectionUtils.isEmpty(superBomCodes)){
try {
superBomCodes.forEach(superBomCode->{
ctoBomService.clearCache(superBomCode);
});
} catch (Exception e) {
e.printStackTrace();
}
}
}else if(requestParamDto.getCharacteristicCodes()!=null && requestParamDto.getCharacteristicCodes().length>0){
List<String> superBomCodes = characteristicMapper.getBomCodeByCcodeList(requestParamDto);
if(!CollectionUtils.isEmpty(superBomCodes)){
try {
superBomCodes.forEach(superBomCode->{
ctoBomService.clearCache(superBomCode);
});
} catch (Exception e) {
e.printStackTrace();
}
}
}
}
/**
* 跟新是否可显示列
......@@ -97,8 +66,6 @@ public class CharacteristicServiceImpl implements CharacteristicService {
*/
@Override
public Integer updateVisibleType (CharacteristicRequestParamDto requestParamDto){
// 清理CTO缓存
ctoClearCache(requestParamDto);
return characteristicMapper.updateVisibleType(requestParamDto);
}
......
......@@ -8,10 +8,7 @@ import cn.com.uitech.authorization.mapper.CharacteristicMapper;
import cn.com.uitech.authorization.mapper.CharacteristicValueMapper;
import cn.com.uitech.authorization.mapper.CtoBomMapper;
import cn.com.uitech.authorization.mapper.OdRelationMapper;
import cn.com.uitech.authorization.pojo.dto.CharacteristicValueExportDto;
import cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto;
import cn.com.uitech.authorization.pojo.dto.ComponentCargoDto;
import cn.com.uitech.authorization.pojo.dto.ConsultationConfigurationAndPriceDto;
import cn.com.uitech.authorization.pojo.dto.*;
import cn.com.uitech.authorization.pojo.entity.CharacteristicValue;
import cn.com.uitech.authorization.pojo.entity.GetSKUByH3CConfigInfo;
import cn.com.uitech.authorization.pojo.entity.OdRelation;
......@@ -20,6 +17,7 @@ import cn.com.uitech.authorization.service.CtoBomService;
import cn.com.uitech.authorization.service.SecurityService;
import cn.com.uitech.authorization.utils.ApiResult;
import cn.com.uitech.authorization.utils.ProductExportUtils;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
......@@ -37,9 +35,15 @@ import org.apache.poi.xssf.usermodel.XSSFWorkbook;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils;
import org.springframework.web.client.RestTemplate;
import org.springframework.web.multipart.MultipartFile;
import tk.mybatis.mapper.entity.Condition;
......@@ -63,17 +67,8 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
private CharacteristicValueMapper characteristicValueMapper;
@Autowired
private CtoBomMapper ctoBomMapper;
@Autowired
private CharacteristicMapper characteristicMapper;
@Autowired
private OdRelationMapper odRelationMapper;
@Autowired
private CtoBomService ctoBomService;
private static Logger logger = LoggerFactory.getLogger(CharacteristicValueServiceImpl.class);
/**
......@@ -98,35 +93,12 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
*/
@Override
public Integer modifyBomStatusAll(CharacteristicValueRequestParamDto dto) {
//修改为不可卖是发送邮件给bs is os
if (dto.getStatus() == CtoStatusEnum.NO.getCode()) {
String updateUser = SecurityService.getPrincipal().getCode();
logger.info("修改v值{},修改人{}updateUser", updateUser);
}
//清理CTO缓存
ctoClearCache(dto);
return characteristicValueMapper.modifyBomStatusAll(dto);
}
/**
* 清理CTO缓存
*
* @param dto
*/
private void ctoClearCache(CharacteristicValueRequestParamDto dto) {
//有bomCode 用bom 没有用VCode
if (!StringUtils.isEmpty(dto.getSuperBomCode())) {
ctoBomService.clearCache(dto.getSuperBomCode());
} else {
List<String> bomCodes = characteristicValueMapper.getBomCodeByValueCode(dto);
if (!CollectionUtils.isEmpty(bomCodes)) {
bomCodes.forEach(bomCode -> {
ctoBomService.clearCache(bomCode);
});
}
}
}
/**
* 批量更新特征值状态 是否可卖
......@@ -136,12 +108,6 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
*/
@Override
public Integer batchModifyBomStatus(CharacteristicValueRequestParamDto dto) {
//修改为不可卖是发送邮件给bs is os
if (dto.getStatus() == CtoStatusEnum.NO.getCode()) {
String updateUser = SecurityService.getPrincipal().getCode();
logger.info("批量修改v值{},修改人{}updateUser", dto.getCharacteristicValueCodes().toString(), updateUser);
}
ctoClearCache(dto);
return characteristicValueMapper.batchModifyBomStatus(dto);
}
......@@ -153,10 +119,26 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
*/
@Override
public Integer editCharacteristicValue(CharacteristicValue dto) {
GetSKUByH3CConfigInfo getSKUByH3CConfigInfo = new GetSKUByH3CConfigInfo();
//getSKUByH3CConfigInfo.setH3CPNList()
//当CPQ系统中维护 H3C_PN、H3C_交付代码、特征值-销售可见名称 这些字段的任意一个时,出发调用这个接口 调用PLM
/*if(!ObjectUtils.isEmpty(dto.getH3cDeliverCode()) || !ObjectUtils.isEmpty(dto.getH3cCValue()) || !ObjectUtils.isEmpty(dto.getUnisSalesVName())){
SendDataToPlm sendDataToPlm = new SendDataToPlm();
sendDataToPlm.setSuperBomCode(dto.getSuperBomCode());
sendDataToPlm.setH3cCValue(dto.getH3cCValue());
sendDataToPlm.setH3cDeliverCode(dto.getH3cDeliverCode());
sendDataToPlm.setUnisSalesVName(dto.getUnisSalesVName());
RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = getHttpHeader();
HttpEntity<String> requestEntity = new HttpEntity<String>(JSON.toJSONString(sendDataToPlm), headers);
ResponseEntity<String> responseEntity = restTemplate.exchange("", HttpMethod.POST, requestEntity, String.class);
}*/
return characteristicValueMapper.editCharacteristicValue(dto);
}
private HttpHeaders getHttpHeader() {
HttpHeaders headers = new HttpHeaders();
headers.add("Content-Type", "application/json");
return headers;
}
/**
* 根据产品组,层次id查询所有的cto物料
......
......@@ -44,12 +44,6 @@ import java.util.Set;
@Service
public class CtoBomServiceImpl implements CtoBomService {
@Value("${spring.redis.cto-database}")
private int ctoRedisDbNumber;
@Value("${spring.redis.db-database}")
private int mainRedisDbNumber;
@Autowired
private CtoBomMapper ctoBomMapper;
......@@ -58,13 +52,8 @@ public class CtoBomServiceImpl implements CtoBomService {
private ProductDescriptionMapper productDescriptionMapper;
@Autowired
private PricecalexpressionMapper pricecalexpressionMapper;
@Autowired
private BomStatusMapper bomStatusMapper;
@Autowired
private RedisTemplate redisTemplate;
private static final org.slf4j.Logger LOGGER = LoggerFactory.getLogger(CtoBomServiceImpl.class);
......@@ -194,47 +183,6 @@ public class CtoBomServiceImpl implements CtoBomService {
}
/**
* 清除cto缓存
*
* @param superBomCode
*/
@Override
public String clearCache(String superBomCode) {
if (StringUtils.isEmpty(superBomCode)) {
throw new BizException(ApiResult.IS_NOT_NULL, "请填写物料编号");
}
Condition condition = ctoBomMapper.getCondition();
condition.createCriteria().andEqualTo("superBomCode", superBomCode);
List<ConfigurableBom> configurableBoms = ctoBomMapper.selectByExample(condition);
if (CollectionUtils.isEmpty(configurableBoms)) {
throw new BizException(ApiResult.IS_NOT_NULL, "该物料不存在,请填写正确的物料编号");
}
LettuceConnectionFactory factory = (LettuceConnectionFactory) redisTemplate.getConnectionFactory();
factory.setDatabase(ctoRedisDbNumber);
redisTemplate.setConnectionFactory(factory);
factory.afterPropertiesSet();
factory.resetConnection();
try {
Set keys = redisTemplate.keys("*" + superBomCode + "*");
if (!CollectionUtils.isEmpty(keys)) {
Long delete = redisTemplate.delete(keys);
LOGGER.info("物料:{}cto缓存清除成功,共计{}组数据", superBomCode, keys.size());
return "物料:" + superBomCode + "cto缓存清除成功,共计" + keys.size();
}
} catch (Exception e) {
e.printStackTrace();
} finally {
factory.setDatabase(mainRedisDbNumber);
redisTemplate.setConnectionFactory(factory);
factory.afterPropertiesSet();
factory.resetConnection();
}
return "没有缓存信息,不需要清理";
}
@Override
public void insertCto(List<ConfigurableBom> configurableBoms) {
......
......@@ -8,19 +8,12 @@ import cn.com.uitech.authorization.pojo.dto.*;
import cn.com.uitech.authorization.pojo.entity.*;
import cn.com.uitech.authorization.service.IntegrateService;
import cn.com.uitech.authorization.service.SecurityService;
import cn.com.uitech.authorization.utils.ApiResult;
import cn.com.uitech.authorization.utils.MD5Util;
import cn.com.uitech.authorization.utils.RedisHelper;
import cn.com.uitech.authorization.utils.Sequence;
import cn.com.uitech.authorization.utils.*;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.message.BasicNameValuePair;
import org.apache.http.util.EntityUtils;
import com.sun.corba.se.impl.presentation.rmi.ExceptionHandler;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
......@@ -39,7 +32,6 @@ import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.*;
import java.util.stream.Stream;
@Service
......@@ -651,6 +643,7 @@ public class IntegrateServiceImpl implements IntegrateService {
toPLMDto.setOptionChoiceMaps(maps);
HttpHeaders headers = getHttpHeaderPlm(nonce);
HttpEntity httpEntity = new HttpEntity<>(JSONObject.toJSON(toPLMDto), headers);
restTemplate.setErrorHandler(new CustomResponseErrorHandler());
map = (Map<String, Object>) restTemplate.exchange(plmUrl, HttpMethod.POST, httpEntity, Object.class).getBody();
Integer code = (Integer) map.get("code");
if (!ObjectUtils.isEmpty(code)) {
......@@ -673,8 +666,11 @@ public class IntegrateServiceImpl implements IntegrateService {
dto.setData((ApplySkuCodeResultDto.data) map.get("data"));
}
}
} catch (Exception e) {
dto.setMsg("调用PLM申请回号报错:" + e.getMessage());
} catch (Throwable e) {
String message = e.getMessage();
Object parse = JSON.parse(message);
Map<String,Object> ma = (Map<String,Object>)parse;
dto.setMsg("调用PLM申请回号报错:" + ma.get("message"));
dto.setCode(500);
return dto;
}
......@@ -851,14 +847,14 @@ public class IntegrateServiceImpl implements IntegrateService {
cpnList.setMsg(configurableBom.getSuperBomCode()+"没有维护默认值");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
flag = false;
break;
continue;
}
} else {
//没有superbom
cpnList.setMsg("H3CPN没有维护对照关系");
cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
flag = false;
break;
continue;
}
//有superbom 有configid h3cvcode存在 没有下架 设置true进行撞配
if(flag){
......
package cn.com.uitech.authorization.service.impl;
import org.springframework.http.HttpMethod;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.stereotype.Service;
import org.springframework.web.client.ResponseErrorHandler;
import java.io.IOException;
import java.net.URI;
/**
* @Author: ZXN
* @Date: 2021/12/16/18:13
* @Description:
* @version: 1.0
* This Class Created with IntelliJ IDEA 2019.1.4
*/
@Service
public class MyRestErrorHandlerImpl implements ResponseErrorHandler {
@Override
public boolean hasError(ClientHttpResponse clientHttpResponse) throws IOException {
return false;
}
@Override
public void handleError(ClientHttpResponse clientHttpResponse) throws IOException {
System.out.println("1111111111111111");
}
@Override
public void handleError(URI url, HttpMethod method, ClientHttpResponse response) throws IOException {
System.out.println("1111111111111111");
}
}
\ No newline at end of file
......@@ -189,7 +189,43 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate
if (StringUtils.isBlank(basicsPriceInfoEntity.getBrand()) || StringUtils.isBlank(basicsPriceInfoEntity.getProductClassCode())) {
throw new BusinessException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "产品类型或品牌不能为空!");
}
return superBomPriceCalculateMapper.getBasicsPriceInfo(basicsPriceInfoEntity);
BasicsPriceInfoEntity basicsPriceInfo;
if(!ObjectUtils.isEmpty(basicsPriceInfoEntity.getPriceType())){
basicsPriceInfo = superBomPriceCalculateMapper.getBasicsPriceInfo(basicsPriceInfoEntity);
if(ObjectUtils.isEmpty(basicsPriceInfo) ){
if(!StringUtils.isEmpty(basicsPriceInfoEntity.getSuperBomCode())){
basicsPriceInfoEntity.setSuperBomCode(null);
basicsPriceInfo = superBomPriceCalculateMapper.getBasicsPriceInfo(basicsPriceInfoEntity);
if(ObjectUtils.isEmpty(basicsPriceInfo)){
throw new BusinessException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "请维护价格系数!");
}
}
}
}else{
basicsPriceInfo = superBomPriceCalculateMapper.getBasicsPriceInfo(basicsPriceInfoEntity);
if(ObjectUtils.isEmpty(basicsPriceInfo)){
basicsPriceInfoEntity.setPriceType(1);
basicsPriceInfo = superBomPriceCalculateMapper.getBasicsPriceInfo(basicsPriceInfoEntity);
if(ObjectUtils.isEmpty(basicsPriceInfo) && !StringUtils.isEmpty(basicsPriceInfoEntity.getSuperBomCode())){
basicsPriceInfoEntity.setSuperBomCode(null);
basicsPriceInfo = superBomPriceCalculateMapper.getBasicsPriceInfo(basicsPriceInfoEntity);
if(ObjectUtils.isEmpty(basicsPriceInfo)){
basicsPriceInfoEntity.setPriceType(2);
basicsPriceInfo = superBomPriceCalculateMapper.getBasicsPriceInfo(basicsPriceInfoEntity);
if(ObjectUtils.isEmpty(basicsPriceInfo) && !StringUtils.isEmpty(basicsPriceInfoEntity.getSuperBomCode())){
basicsPriceInfoEntity.setSuperBomCode(null);
basicsPriceInfo = superBomPriceCalculateMapper.getBasicsPriceInfo(basicsPriceInfoEntity);
if(ObjectUtils.isEmpty(basicsPriceInfo)){
throw new BusinessException(HttpStatus.INTERNAL_SERVER_ERROR.value(), "请维护价格系数!");
}
}
}
}
}
}
return basicsPriceInfo;
}
/**
......
package cn.com.uitech.authorization.utils;
import org.springframework.web.client.RestClientException;
public class CustomException extends RestClientException {
private RestClientException restClientException;
private String body;
public RestClientException getRestClientException() {
return restClientException;
}
public void setRestClientException(RestClientException restClientException) {
this.restClientException = restClientException;
}
public String getBody() {
return body;
}
public void setBody(String body) {
this.body = body;
}
public CustomException(String msg, RestClientException restClientException, String body) {
super(msg);
this.restClientException = restClientException;
this.body = body;
}
}
package cn.com.uitech.authorization.utils;
import org.springframework.http.client.ClientHttpResponse;
import org.springframework.web.client.DefaultResponseErrorHandler;
import org.springframework.web.client.ResponseErrorHandler;
import org.springframework.web.client.RestClientException;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.List;
public class CustomResponseErrorHandler implements ResponseErrorHandler {
private ResponseErrorHandler errorHandler = new DefaultResponseErrorHandler();
@Override
public void handleError(ClientHttpResponse response) throws IOException {
// 队请求头的处理
List<String> customHeader = response.getHeaders().get("x-app-err-id");
String svcErrorMessageID = "";
if (customHeader != null) {
svcErrorMessageID = customHeader.get(0);
}
//对body 的处理 (inputStream)
String body = convertStreamToString(response.getBody());
try {
errorHandler.handleError(response);
} catch (RestClientException scx) {
throw new CustomException(body, scx, body);
}
}
@Override
public boolean hasError(ClientHttpResponse response) throws IOException {
return errorHandler.hasError(response);
}
// inputStream 装换为 string
private String convertStreamToString(InputStream is) {
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringBuilder sb = new StringBuilder();
String line = null;
try {
while ((line = reader.readLine()) != null) {
sb.append(line);
}
} catch (IOException e) {
e.printStackTrace();
} finally {
try {
is.close();
} catch (IOException e) {
e.printStackTrace();
}
}
return sb.toString();
}
}
......@@ -6,6 +6,7 @@
SELECT super_characteristic_info.*
FROM super_characteristic_info
LEFT JOIN super_bom_info on super_characteristic_info.super_bom_code=super_bom_info.super_bom_code
LEFT JOIN a_productclasscode on super_bom_info.product_class_code=a_productclasscode.product_class_code
<where> 1=1
<if test="superBomCode!=null and superBomCode!=''">
and super_bom_info.super_bom_code LIKE CONCAT('%','${superBomCode}','%')
......@@ -19,7 +20,21 @@
<if test="unisSalesCName!=null and unisSalesCName!=''">
and unis_sales_c_name LIKE CONCAT('%','${unisSalesCName}','%')
</if>
<if test="plmName!=null and plmName!=''">
and super_characteristic_info.characteristic_name like CONCAT('%','${plmName}','%')
</if>
<if test="brand!=null and brand!=''">
and super_bom_info.brand like CONCAT('%','${brand}','%')
</if>
<if test="productClassCode!=null and productClassCode!=''">
and a_productclasscode.product_class_code like CONCAT('%','${productClassCode}','%')
</if>
<if test="isH3C!=null">
and super_characteristic_info.is_h3c = #{isH3C}
</if>
</where>
order by sort asc
</select>
<update id="updateCharacteristic" parameterType="cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto" >
......@@ -30,7 +45,8 @@
characteristic_type =#{characteristicType},
h3c_c_code =#{H3CCCode},
is_hidden =#{isHidden},
is_h3c =#{isH3C}
is_h3c =#{isH3C},
sort = #{sort}
where
Characteristic_Code=#{characteristicCode}
</update>
......@@ -80,7 +96,7 @@
</select>
<select id="selectByCode" resultType="cn.com.uitech.authorization.pojo.entity.Characteristic" parameterType="cn.com.uitech.authorization.pojo.entity.Characteristic">
select * from super_characteristic_info where characteristic_Code=#{characteristicCode}
select * from super_characteristic_info where characteristic_Code=#{characteristicCode} and super_bom_code = #{superBomCode}
</select>
<update id="updateBom">
......
......@@ -13,6 +13,7 @@
FROM super_characteristic_value_info a
LEFT JOIN super_characteristic_info b ON a.Characteristic_Code=b.Characteristic_Code
LEFT JOIN super_bom_info c ON a.super_bom_code=c.super_bom_code
LEFT JOIN a_productclasscode d on c.product_class_code=d.product_class_code
<where>
1=1
<if test="characteristicCode!=null and characteristicCode!=''">
......@@ -34,9 +35,25 @@
and c.is_state=#{bomStatus}
</if>
<if test="status!=null">
and a.is_state=#{status}
and b.is_show=#{status}
</if>
<if test="isState!=null">
and a.is_state=#{isState}
</if>
<if test="isH3C!=null">
and b.is_h3c=#{isH3C}
</if>
<if test="plmName!=null and plmName!=''">
and a.Characteristic_Value_name like CONCAT('%','${plmName}','%')
</if>
<if test="brand!=null and brand!=''">
and c.brand like CONCAT('%','${brand}','%')
</if>
<if test="productClassCode!=null and productClassCode!=''">
and d.product_class_code like CONCAT('%','${productClassCode}','%')
</if>
</where>
order by b.sort asc
)a
</select>
......@@ -44,7 +61,7 @@
parameterType="cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto">
UPDATE super_characteristic_value_info
SET is_state=#{status}
SET is_state=#{isState}
where super_bom_code like CONCAT('%','${superBomCode}','%')
</update>
......@@ -52,7 +69,7 @@
<update id="batchModifyBomStatus"
parameterType="cn.com.uitech.authorization.pojo.dto.CharacteristicValueRequestParamDto">
UPDATE super_characteristic_value_info
SET is_state=#{status}
SET is_state=#{isState}
<where>
<if test="characteristicValueCodes!=null">
characteristic_Value_Code IN
......@@ -122,7 +139,8 @@
SELECT
a.*,
c.super_bom_name,
c.is_state as "bomStatus"
c.is_state as "bomStatus",
b.characteristic_name as characteristicName
FROM super_characteristic_value_info a
LEFT JOIN super_characteristic_info b ON
a.Characteristic_Code=b.Characteristic_Code
......@@ -216,7 +234,7 @@
</select>
<select id="selectByCode" resultType="cn.com.uitech.authorization.pojo.entity.CharacteristicValue">
select * from super_characteristic_value_info where Characteristic_Value_Code=#{characteristicValueCode} and Characteristic_Code = #{characteristicCode}
select * from super_characteristic_value_info where Characteristic_Value_Code=#{characteristicValueCode} and Characteristic_Code = #{characteristicCode} and super_bom_code = #{superBomCode}
</select>
<insert id="saveLog">
......
......@@ -25,6 +25,9 @@
<if test="unisSalesName!=null and unisSalesName!=''">
and unis_sales_name like CONCAT('%','${unisSalesName}','%')
</if>
<if test="plmName!=null and plmName!=''">
and super_bom_name like CONCAT('%','${plmName}','%')
</if>
<if test="isState!=null">
and is_state =#{isState}
</if>
......@@ -345,6 +348,7 @@
and a.is_state = 1
and b.is_hidden = 1
and c.is_state = 1
order by sort asc
</select>
<select id="getSuperBomInfo" resultMap="superBomInfo">
......
......@@ -93,10 +93,10 @@
a.super_bom_code = #{superBomCode}
</if>
<if test="characteristicValueName != null and characteristicValueName != ''.toString()">
and c.characteristic_value_name = #{characteristicValueName}
and c.characteristic_value_name like CONCAT('%','${characteristicValueName}','%')
</if>
<if test="characteristicValueCode != null and characteristicValueCode != ''.toString()">
and c.characteristic_value_code = #{characteristicValueCode}
and c.characteristic_value_code like CONCAT('%','${characteristicValueCode}','%')
</if>
<if test="characteristicCode != null and characteristicCode != ''.toString()">
and b.characteristic_code = #{characteristicCode}
......@@ -114,7 +114,7 @@
and a.product_class_code = #{productClassCode}
</if>
</where>
order by a.super_bom_code,b.characteristic_code,c.characteristic_value_code
order by b.sort,a.super_bom_code,b.characteristic_code,c.characteristic_value_code
</select>
<select id="getCharacteristicsPrice" resultType="cn.com.uitech.authorization.pojo.entity.SuperBomPriceInfoEntity">
......
......@@ -103,10 +103,10 @@
and a.super_bom_code = #{superBomCode}
</if>
<if test="skuCode!=null and skuCode!=''.toString()">
and a.sku_code = #{skuCode}
and a.sku_code like CONCAT('%','${skuCode}','%')
</if>
<if test="skuName!=null and skuName!=''.toString()">
and a.sku_name = #{skuName}
and a.sku_name like CONCAT('%','${skuName}','%')
</if>
<if test="politicalMiningId!=null and politicalMiningId!=''.toString()">
and a.political_mining_id = #{politicalMiningId}
......@@ -149,6 +149,7 @@
<result property="applyStatus" column="apply_status"/>
<result property="skuCode" column="sku_code"/>
<result property="skuName" column="sku_name"/>
<result property="descriptionBom" column="description_bom"/>
<collection property="characteristicList" ofType="cn.com.uitech.authorization.pojo.entity.SuperBomSkuConfigInfo">
<!--<id property="id" column="id"/>-->
<result property="configId" column="config_id"/>
......
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