Commit ec5c2953 by zhaoxiaolei

调用PLM

parent 7c751cae
...@@ -3,6 +3,7 @@ package cn.com.uitech.authorization.controller; ...@@ -3,6 +3,7 @@ package cn.com.uitech.authorization.controller;
import cn.com.uitech.authorization.pojo.entity.BasicsPriceInfoEntity; import cn.com.uitech.authorization.pojo.entity.BasicsPriceInfoEntity;
import cn.com.uitech.authorization.service.BasicsPriceInfoService; import cn.com.uitech.authorization.service.BasicsPriceInfoService;
import cn.com.uitech.authorization.utils.CrmResponseEntity; import cn.com.uitech.authorization.utils.CrmResponseEntity;
import cn.com.uitech.authorization.utils.ResultGenerator;
import io.swagger.annotations.Api; import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation; import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.PostMapping;
...@@ -36,8 +37,7 @@ public class BasicsPriceInfoController { ...@@ -36,8 +37,7 @@ public class BasicsPriceInfoController {
*/ */
@PostMapping("/savePriceCoefficient") @PostMapping("/savePriceCoefficient")
@ApiOperation(value = "保存各级别价格系数", notes = "保存各级别价格系数", httpMethod = "POST") @ApiOperation(value = "保存各级别价格系数", notes = "保存各级别价格系数", httpMethod = "POST")
public CrmResponseEntity<Void> savePriceCoefficient(@RequestBody BasicsPriceInfoEntity basicsPriceInfoEntity) { public CrmResponseEntity<?> savePriceCoefficient(@RequestBody BasicsPriceInfoEntity basicsPriceInfoEntity) {
basicsPriceInfoService.savePriceCoefficient(basicsPriceInfoEntity); return ResultGenerator.genSuccessResult(basicsPriceInfoService.savePriceCoefficient(basicsPriceInfoEntity));
return new CrmResponseEntity<>();
} }
} }
...@@ -21,10 +21,7 @@ package cn.com.uitech.authorization.controller; ...@@ -21,10 +21,7 @@ package cn.com.uitech.authorization.controller;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.validation.Errors; import org.springframework.validation.Errors;
import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.*;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource; import javax.annotation.Resource;
...@@ -65,7 +62,7 @@ public class IntegrateController { ...@@ -65,7 +62,7 @@ public class IntegrateController {
@PostMapping("/SetSuperTableInfo") @PostMapping("/SetSuperTableInfo")
@ApiOperation(value = "集成OD约束关系", notes = "SetSuperTableInfo", httpMethod = "POST") @ApiOperation(value = "集成OD约束关系", notes = "SetSuperTableInfo", httpMethod = "POST")
public CrmResponseEntity<?> SetSuperTableInfo(@RequestBody SaveTableInputDto saveTableInputDtos) { public CrmResponseEntity<?> SetSuperTableInfo(@RequestBody List<SaveTableInputDto> saveTableInputDtos) {
return ResultGenerator.genSuccessResult(integrateService.SetSuperTableInfo(saveTableInputDtos)); return ResultGenerator.genSuccessResult(integrateService.SetSuperTableInfo(saveTableInputDtos));
} }
...@@ -117,7 +114,7 @@ public class IntegrateController { ...@@ -117,7 +114,7 @@ public class IntegrateController {
map.put("constraintCharacteristicName", featureComponentNames); map.put("constraintCharacteristicName", featureComponentNames);
redisEntity.setData(map); redisEntity.setData(map);
redisEntities.add(redisEntity); redisEntities.add(redisEntity);
redisHelper.set(RedisKey.getVariantTableKey(selectorEntity.getSystem(), selectorEntity.getProductClassCode(), selectorEntity.getSuperBomCode()), JSONObject.toJSONString(redisEntities)); redisHelper.set(RedisKey.getVariantTableKey(selectorEntity.getSystem(), selectorEntity.getProductClassCode(), selectorEntity.getSuperBomCode()), JSONObject.toJSONString(redisEntities), 86400);
} }
} }
...@@ -208,7 +205,9 @@ public class IntegrateController { ...@@ -208,7 +205,9 @@ public class IntegrateController {
if (!CollectionUtils.isEmpty(activeValues)) { if (!CollectionUtils.isEmpty(activeValues)) {
for (PreVerifyOutputDTO.ActiveValuesBean activeValue : activeValues) { for (PreVerifyOutputDTO.ActiveValuesBean activeValue : activeValues) {
String characteristicName = activeValue.getCharacteristicName(); String characteristicName = activeValue.getCharacteristicName();
activeValue.setCharacteristicName(integrateService.getCNameByCode(characteristicName)); Characteristic characteristic = integrateService.getCNameByCode(characteristicName, preVerifyInputDTO.getMaterialCode());
if (!ObjectUtils.isEmpty(characteristic)) {
activeValue.setCharacteristicName(characteristic.getCharacteristicName());
List<String> values2 = activeValue.getValues(); List<String> values2 = activeValue.getValues();
for (int i = 0; i < values2.size(); i++) { for (int i = 0; i < values2.size(); i++) {
String name = integrateService.getName(values2.get(i)); String name = integrateService.getName(values2.get(i));
...@@ -216,6 +215,8 @@ public class IntegrateController { ...@@ -216,6 +215,8 @@ public class IntegrateController {
values2.remove(i); values2.remove(i);
} }
} }
}
} }
} }
return preVerifyOutputDTO; return preVerifyOutputDTO;
...@@ -298,4 +299,11 @@ public class IntegrateController { ...@@ -298,4 +299,11 @@ public class IntegrateController {
} }
@GetMapping("/querySkuOne/{configId}")
@ApiOperation(value = "查询sku信息One", notes = "querySkuOne", httpMethod = "GET")
public CrmResponseEntity<?> querySkuOne(@PathVariable(value = "configId") String configId) {
return ResultGenerator.genSuccessResult(integrateService.querySkuOne(configId));
}
} }
...@@ -63,7 +63,7 @@ public class SuperBomPriceCalculateController { ...@@ -63,7 +63,7 @@ public class SuperBomPriceCalculateController {
* @return * @return
*/ */
@PostMapping("/getPriceByConfigInfo") @PostMapping("/getPriceByConfigInfo")
public CrmResponseEntity<SuperBomPriceInfoEntity> getPriceByConfigInfo(@RequestBody SuperBomEntity superBomEntity) { public CrmResponseEntity<Object> getPriceByConfigInfo(@RequestBody SuperBomEntity superBomEntity) {
return ResultGenerator.genSuccessResult(superBomPriceCalculateService.getPriceByConfigInfo(superBomEntity)); return ResultGenerator.genSuccessResult(superBomPriceCalculateService.getPriceByConfigInfo(superBomEntity));
} }
} }
...@@ -24,7 +24,7 @@ public interface BasicsPriceInfoMapper { ...@@ -24,7 +24,7 @@ public interface BasicsPriceInfoMapper {
* 新增价格系数 * 新增价格系数
* @param basicsPriceInfoEntity * @param basicsPriceInfoEntity
*/ */
void savePriceCoefficient(BasicsPriceInfoEntity basicsPriceInfoEntity); Integer savePriceCoefficient(BasicsPriceInfoEntity basicsPriceInfoEntity);
/** /**
* 查询各个级别价格系数 * 查询各个级别价格系数
......
...@@ -69,7 +69,7 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser ...@@ -69,7 +69,7 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
String getNameByCode(String characteristicCode,Integer isShow); String getNameByCode(String characteristicCode,Integer isShow);
String getCNameByCode(String characteristicCode); Characteristic getCNameByCode(String characteristicCode,String superBomCode);
List<String> getVNameByConfigId(Long configId); List<String> getVNameByConfigId(Long configId);
...@@ -79,7 +79,7 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser ...@@ -79,7 +79,7 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
Characteristic getCharacteristicInfoByName(String cName,String superBomCode); Characteristic getCharacteristicInfoByName(String cName,String superBomCode);
SuperBomSkuConfigInfo checkConfig(String characteristicCode, String characteristicValueCode,String superBomCode); SuperBomSkuConfigInfo checkConfig(String characteristicCode, String characteristicValueName,String superBomCode,String patern,String politicalMiningId,String configId, String characteristicValueCode);
void updateSuperBomSkuInfo(ApplySkuCodeResultDto.data applySkuCodeResultDto); void updateSuperBomSkuInfo(ApplySkuCodeResultDto.data applySkuCodeResultDto);
......
...@@ -100,7 +100,7 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal ...@@ -100,7 +100,7 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
String getVNameByCode(String characteristicValueCode); String getVNameByCode(String characteristicValueCode);
CharacteristicValue getCharacteristicValueInfoByName(String characteristicValueName,String superBomCode); CharacteristicValue getCharacteristicValueInfoByName(String characteristicValueName,String superBomCode,String characteristicName);
CharacteristicValue getCharacteristicValueInfoByCode(String h3cVCode, String h3cPn); CharacteristicValue getCharacteristicValueInfoByCode(String h3cVCode, String h3cPn,String politicalMiningId,String patern);
} }
...@@ -23,7 +23,7 @@ public interface CtoBomMapper extends IBaseMapper<ConfigurableBom> ...@@ -23,7 +23,7 @@ public interface CtoBomMapper extends IBaseMapper<ConfigurableBom>
* @param ctoBomRequestParamDto * @param ctoBomRequestParamDto
* @return cto物料集合 * @return cto物料集合
*/ */
List<ConfigurableBomResultDto> getCtoBoms(CtoBomRequestParamDto ctoBomRequestParamDto); List<ConfigurableBom> getCtoBoms(CtoBomRequestParamDto ctoBomRequestParamDto);
/** /**
* 根据bomcode修改cto物料 * 根据bomcode修改cto物料
...@@ -102,7 +102,8 @@ public interface CtoBomMapper extends IBaseMapper<ConfigurableBom> ...@@ -102,7 +102,8 @@ public interface CtoBomMapper extends IBaseMapper<ConfigurableBom>
ConfigurableBom getSuperBomInfo(BuildConfigurationInputDTO buildConfigurationInputDTO); ConfigurableBom getSuperBomInfo(BuildConfigurationInputDTO buildConfigurationInputDTO);
ConfigurableBom getSuperBomInfoBySuperBomCode(String superBomCode); String getSuperBomInfoBySuperBomCode(String skuCode);
SuperBomSkuInfo getSkuInfo(GetSkuInputInfo getSkuInputInfo); SuperBomSkuInfo getSkuInfo(GetSkuInputInfo getSkuInputInfo);
} }
...@@ -44,4 +44,6 @@ public interface SuperBomPriceCalculateMapper { ...@@ -44,4 +44,6 @@ public interface SuperBomPriceCalculateMapper {
* @return * @return
*/ */
List<SuperCharacterPriceInfoEntity> getCharacterValueList(CharacteristicValue characteristicValue); List<SuperCharacterPriceInfoEntity> getCharacterValueList(CharacteristicValue characteristicValue);
SuperBomPriceInfoEntity getCharacteristicsPrice(String superBomCode, Integer type);
} }
...@@ -14,10 +14,15 @@ public interface SuperBomSkuInfoMapper extends IBaseMapper<SuperBomSkuInfo> { ...@@ -14,10 +14,15 @@ public interface SuperBomSkuInfoMapper extends IBaseMapper<SuperBomSkuInfo> {
void saveSkuConfig(SuperBomSkuConfigInfo superBomSkuConfigInfo); void saveSkuConfig(SuperBomSkuConfigInfo superBomSkuConfigInfo);
SuperBomSkuConfigInfo getConfigInfoList(String h3cPn,String vCode); SuperBomSkuConfigInfo getConfigInfoList(String configId,String vCode);
void updateSkuInfo(ApplySkuCodeResultDto applySkuCodeResultDto); void updateSkuInfo(ApplySkuCodeResultDto applySkuCodeResultDto);
List<SuperBomSkuInfo> querySkuList(SuperBomSkuInfo superBomSkuInfo); List<SuperBomSkuInfo> querySkuList(SuperBomSkuInfo superBomSkuInfo);
SuperBomSkuInfo querySkuOne(String configId);
SuperBomSkuInfo getSkuInfo(SuperBomSkuInfo returnSkuInfo);
String getConfigId(String skuCode);
} }
...@@ -36,6 +36,8 @@ public class PreVerifyInputDTO implements Serializable { ...@@ -36,6 +36,8 @@ public class PreVerifyInputDTO implements Serializable {
@NotNull @NotNull
private String operator; private String operator;
@NotNull @NotNull
private String token;
@NotNull
private String characteristicValueName; private String characteristicValueName;
@NotNull @NotNull
private String sessionId; private String sessionId;
......
...@@ -39,7 +39,7 @@ public class SaveSuperBomInputDto implements Serializable { ...@@ -39,7 +39,7 @@ public class SaveSuperBomInputDto implements Serializable {
@JsonProperty(value = "TYPE") @JsonProperty(value = "TYPE")
private String type; private String type;
@JsonProperty(value = "STATUS_CODE") @JsonProperty(value = "STATUS_CODE")
private Integer statusCode; private String statusCode;
@JsonProperty(value = "CLASSIFICATION") @JsonProperty(value = "CLASSIFICATION")
private String classification; private String classification;
@JsonProperty(value = "EAN_CODE") @JsonProperty(value = "EAN_CODE")
......
...@@ -23,11 +23,11 @@ public class StandardModelManageDto implements Serializable{ ...@@ -23,11 +23,11 @@ public class StandardModelManageDto implements Serializable{
/** /**
* 选配器返回的cto编码 * 选配器返回的cto编码
*/ */
private String bomCode; private String superBomCode;
/** /**
* 选配器返回的产品组编码 * 选配器返回的产品组编码
*/ */
private String division; private String productClassCode;
/** /**
* 选配器返回的userCode * 选配器返回的userCode
*/ */
...@@ -35,7 +35,7 @@ public class StandardModelManageDto implements Serializable{ ...@@ -35,7 +35,7 @@ public class StandardModelManageDto implements Serializable{
/** /**
* 选配器返回的configId * 选配器返回的configId
*/ */
private Integer configId; private String configId;
/** /**
* 选配器返回的特征/特征值编码数组 * 选配器返回的特征/特征值编码数组
*/ */
......
...@@ -68,7 +68,7 @@ public class ConfigurableBom implements Serializable{ ...@@ -68,7 +68,7 @@ public class ConfigurableBom implements Serializable{
*/ */
@Column(name = "model_status") @Column(name = "model_status")
@ApiModelProperty(name = "modelStatus",value = "物料状态",dataType ="String") @ApiModelProperty(name = "modelStatus",value = "物料状态",dataType ="String")
private Integer modelStatus; private String modelStatus;
/** /**
* CTO类型 1/2 * CTO类型 1/2
......
package cn.com.uitech.authorization.controller; package cn.com.uitech.authorization.pojo.entity;
import cn.com.uitech.authorization.pojo.dto.GetConfigSkuInfo; import cn.com.uitech.authorization.pojo.dto.GetConfigSkuInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter; import lombok.Getter;
import lombok.NoArgsConstructor; import lombok.NoArgsConstructor;
import lombok.Setter; import lombok.Setter;
...@@ -15,7 +16,13 @@ import java.util.List; ...@@ -15,7 +16,13 @@ import java.util.List;
@Setter @Setter
@ToString @ToString
public class GetSKUByH3CConfigInfo { public class GetSKUByH3CConfigInfo {
@JsonProperty(value = "TOKEN")
private String token; private String token;
@JsonProperty(value = "QUOTERID")
private String quoter_id;
@JsonProperty(value = "QUOTERNUMBER")
private String quoter_number;
@JsonProperty(value = "H3CPNLIST")
private List<H3CPNList> h3CPNList; private List<H3CPNList> h3CPNList;
@Accessors(chain = true) @Accessors(chain = true)
...@@ -23,10 +30,28 @@ public class GetSKUByH3CConfigInfo { ...@@ -23,10 +30,28 @@ public class GetSKUByH3CConfigInfo {
@Getter @Getter
@Setter @Setter
@ToString @ToString
public class H3CPNList { public static class H3CPNList {
@JsonProperty(value = "SUBCONFIGID")
private String subConfigId;
@JsonProperty(value = "CONFIGID")
private String configId;
@JsonProperty(value = "CODE")
private Integer code;
@JsonProperty(value = "MSG")
private String msg;
@JsonProperty(value = "H3CID")
private Integer h3cId; private Integer h3cId;
@JsonProperty(value = "H3CPN")
private String h3cPn; private String h3cPn;
@JsonProperty(value = "SKUCODE")
private String skuCode;
@JsonProperty(value = "SKUNAME")
private String skuName;
@JsonProperty(value = "POLITICALMININGID")
private Integer politicalMiningId; private Integer politicalMiningId;
@JsonProperty(value = "MODEL")
private String patern;
@JsonProperty(value = "SELECTEDCHARACTERISTICLIST")
private List<KeyValues> selectedCharacteristicList; private List<KeyValues> selectedCharacteristicList;
} }
...@@ -36,8 +61,10 @@ public class GetSKUByH3CConfigInfo { ...@@ -36,8 +61,10 @@ public class GetSKUByH3CConfigInfo {
@Getter @Getter
@Setter @Setter
@ToString @ToString
public class KeyValues { public static class KeyValues {
@JsonProperty(value = "H3CVCODE")
private String h3cVCode; private String h3cVCode;
@JsonProperty(value = "QTY")
private Integer qty; private Integer qty;
} }
......
...@@ -15,5 +15,5 @@ public interface BasicsPriceInfoService { ...@@ -15,5 +15,5 @@ public interface BasicsPriceInfoService {
* @param basicsPriceInfoEntity * @param basicsPriceInfoEntity
* @return * @return
*/ */
void savePriceCoefficient(BasicsPriceInfoEntity basicsPriceInfoEntity); Object savePriceCoefficient(BasicsPriceInfoEntity basicsPriceInfoEntity);
} }
...@@ -19,7 +19,7 @@ public interface CtoBomService { ...@@ -19,7 +19,7 @@ public interface CtoBomService {
* @param ctoBomRequestParamDto * @param ctoBomRequestParamDto
* @return cto物料集合 * @return cto物料集合
*/ */
PageInfo<ConfigurableBomResultDto> getCtoBoms(CtoBomRequestParamDto ctoBomRequestParamDto); PageInfo<ConfigurableBom> getCtoBoms(CtoBomRequestParamDto ctoBomRequestParamDto);
/** /**
* 根据bomcode修改cto物料 * 根据bomcode修改cto物料
......
package cn.com.uitech.authorization.service; package cn.com.uitech.authorization.service;
import cn.com.uitech.authorization.controller.GetSKUByH3CConfigInfo; import cn.com.uitech.authorization.pojo.entity.GetSKUByH3CConfigInfo;
import cn.com.uitech.authorization.pojo.dto.*; import cn.com.uitech.authorization.pojo.dto.*;
import cn.com.uitech.authorization.pojo.entity.*; import cn.com.uitech.authorization.pojo.entity.*;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
...@@ -16,7 +15,7 @@ public interface IntegrateService { ...@@ -16,7 +15,7 @@ public interface IntegrateService {
GetProductOutDto setSuperCharacterValueInfo(List<SaveSuperCharacterValueInputDto> saveSuperCharacterValueInputDtos); GetProductOutDto setSuperCharacterValueInfo(List<SaveSuperCharacterValueInputDto> saveSuperCharacterValueInputDtos);
GetProductOutDto SetSuperTableInfo(SaveTableInputDto saveTableInputDtos); GetProductOutDto SetSuperTableInfo(List<SaveTableInputDto> saveTableInputDtos);
ConfigurableBom getOdInfo(SelectorEntity selectorEntity); ConfigurableBom getOdInfo(SelectorEntity selectorEntity);
...@@ -38,7 +37,7 @@ public interface IntegrateService { ...@@ -38,7 +37,7 @@ public interface IntegrateService {
Object saveSukInfo(SuperBomSkuInfo superBomSkuInfo); Object saveSukInfo(SuperBomSkuInfo superBomSkuInfo);
String getCNameByCode(String characteristicName); Characteristic getCNameByCode(String characteristicName,String superBomCode);
Object GetSKUByConfigInfo(SuperBomSkuInfo superBomSkuInfo); Object GetSKUByConfigInfo(SuperBomSkuInfo superBomSkuInfo);
...@@ -46,4 +45,5 @@ public interface IntegrateService { ...@@ -46,4 +45,5 @@ public interface IntegrateService {
PageInfo<SuperBomSkuInfo> querySkuList(SuperBomSkuInfo superBomSkuInfo); PageInfo<SuperBomSkuInfo> querySkuList(SuperBomSkuInfo superBomSkuInfo);
Object querySkuOne(String configId);
} }
...@@ -17,7 +17,7 @@ public interface SuperBomPriceCalculateService { ...@@ -17,7 +17,7 @@ public interface SuperBomPriceCalculateService {
* @param superBomEntity * @param superBomEntity
* @return * @return
*/ */
SuperBomPriceInfoEntity getPriceByConfigInfo(SuperBomEntity superBomEntity); Object getPriceByConfigInfo(SuperBomEntity superBomEntity);
/** /**
* 根据条件查询价格系数 * 根据条件查询价格系数
......
...@@ -28,10 +28,10 @@ public class BasicsPriceInfoServiceImpl implements BasicsPriceInfoService { ...@@ -28,10 +28,10 @@ public class BasicsPriceInfoServiceImpl implements BasicsPriceInfoService {
* @return * @return
*/ */
@Override @Override
public void savePriceCoefficient(BasicsPriceInfoEntity basicsPriceInfoEntity) { public Object savePriceCoefficient(BasicsPriceInfoEntity basicsPriceInfoEntity) {
// 根据产品类别、品牌和superBom删除价格系数 // 根据产品类别、品牌和superBom删除价格系数
basicsPriceInfoMapper.deletePriceCoefficient(basicsPriceInfoEntity); basicsPriceInfoMapper.deletePriceCoefficient(basicsPriceInfoEntity);
// 新增价格系数 // 新增价格系数
basicsPriceInfoMapper.savePriceCoefficient(basicsPriceInfoEntity); return basicsPriceInfoMapper.savePriceCoefficient(basicsPriceInfoEntity);
} }
} }
...@@ -77,9 +77,9 @@ public class CtoBomServiceImpl implements CtoBomService { ...@@ -77,9 +77,9 @@ public class CtoBomServiceImpl implements CtoBomService {
* @return cto物料集合 * @return cto物料集合
*/ */
@Override @Override
public PageInfo<ConfigurableBomResultDto> getCtoBoms(CtoBomRequestParamDto ctoBomRequestParamDto) { public PageInfo<ConfigurableBom> getCtoBoms(CtoBomRequestParamDto ctoBomRequestParamDto) {
PageHelper.startPage(ctoBomRequestParamDto.getPage(), ctoBomRequestParamDto.getPerPage()); PageHelper.startPage(ctoBomRequestParamDto.getPage(), ctoBomRequestParamDto.getPerPage());
List<ConfigurableBomResultDto> ctoBoms = ctoBomMapper.getCtoBoms(ctoBomRequestParamDto); List<ConfigurableBom> ctoBoms = ctoBomMapper.getCtoBoms(ctoBomRequestParamDto);
return new PageInfo(ctoBoms); return new PageInfo(ctoBoms);
} }
......
package cn.com.uitech.authorization.service.impl; package cn.com.uitech.authorization.service.impl;
import cn.com.uitech.authorization.controller.GetSKUByH3CConfigInfo; import cn.com.uitech.authorization.pojo.entity.GetSKUByH3CConfigInfo;
import cn.com.uitech.authorization.exception.BizException;
import cn.com.uitech.authorization.exception.BusinessException; import cn.com.uitech.authorization.exception.BusinessException;
import cn.com.uitech.authorization.mapper.*; import cn.com.uitech.authorization.mapper.*;
import cn.com.uitech.authorization.pojo.dto.*; import cn.com.uitech.authorization.pojo.dto.*;
...@@ -14,6 +13,7 @@ import com.alibaba.fastjson.JSON; ...@@ -14,6 +13,7 @@ import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo; import com.github.pagehelper.PageInfo;
import javassist.expr.Instanceof;
import org.springframework.beans.BeanUtils; import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
...@@ -28,7 +28,6 @@ import org.springframework.util.CollectionUtils; ...@@ -28,7 +28,6 @@ import org.springframework.util.CollectionUtils;
import org.springframework.util.ObjectUtils; import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils; import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate; import org.springframework.web.client.RestTemplate;
import springfox.documentation.spring.web.json.Json;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.*; import java.util.*;
...@@ -76,6 +75,7 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -76,6 +75,7 @@ public class IntegrateServiceImpl implements IntegrateService {
configurableBom.setDescription(saveSuperBomInputDto.getDescription()); configurableBom.setDescription(saveSuperBomInputDto.getDescription());
configurableBom.setModelStatus(saveSuperBomInputDto.getStatusCode()); configurableBom.setModelStatus(saveSuperBomInputDto.getStatusCode());
configurableBom.setProductClassCode(saveSuperBomInputDto.getClassification()); configurableBom.setProductClassCode(saveSuperBomInputDto.getClassification());
configurableBom.setProductClassName(saveSuperBomInputDto.getClassification());
configurableBom.setUnisSalesName(saveSuperBomInputDto.getScuxItemName()); configurableBom.setUnisSalesName(saveSuperBomInputDto.getScuxItemName());
configurableBom.setBrand(saveSuperBomInputDto.getBrand()); configurableBom.setBrand(saveSuperBomInputDto.getBrand());
ConfigurableBom getOne = ctoBomMapper.getCtoBomsByCode(configurableBom.getSuperBomCode(), configurableBom.getProductClassName()); ConfigurableBom getOne = ctoBomMapper.getCtoBomsByCode(configurableBom.getSuperBomCode(), configurableBom.getProductClassName());
...@@ -121,7 +121,7 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -121,7 +121,7 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristic.setCharacteristicCode(saveSuperCharacterInputDto.getOptionNumber()); characteristic.setCharacteristicCode(saveSuperCharacterInputDto.getOptionNumber());
characteristic.setCharacteristicName(saveSuperCharacterInputDto.getOptionName()); characteristic.setCharacteristicName(saveSuperCharacterInputDto.getOptionName());
characteristic.setSuperBomCode(saveSuperCharacterInputDto.getSuperNumber()); characteristic.setSuperBomCode(saveSuperCharacterInputDto.getSuperNumber());
characteristic.setIsHidden(0); characteristic.setIsShow(0);
characteristic.setCharacteristicType("否"); characteristic.setCharacteristicType("否");
Characteristic getOne = characteristicMapper.selectByCode(characteristic); Characteristic getOne = characteristicMapper.selectByCode(characteristic);
if (!ObjectUtils.isEmpty(getOne)) { if (!ObjectUtils.isEmpty(getOne)) {
...@@ -165,6 +165,8 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -165,6 +165,8 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristicValue.setZphCode(saveSuperCharacterValueInputDto.getZphCode()); characteristicValue.setZphCode(saveSuperCharacterValueInputDto.getZphCode());
characteristicValue.setZphName(saveSuperCharacterValueInputDto.getZphName()); characteristicValue.setZphName(saveSuperCharacterValueInputDto.getZphName());
characteristicValue.setH3cDeliverCode(saveSuperCharacterValueInputDto.getH3cDeliverCode()); characteristicValue.setH3cDeliverCode(saveSuperCharacterValueInputDto.getH3cDeliverCode());
characteristicValue.setUnisSalesVName(saveSuperCharacterValueInputDto.getChoiceName());
characteristicValue.setUnisSalesCName(saveSuperCharacterValueInputDto.getOptionNumber());
CharacteristicValue getOne = characteristicValueMapper.selectByCode(characteristicValue); CharacteristicValue getOne = characteristicValueMapper.selectByCode(characteristicValue);
if (!ObjectUtils.isEmpty(getOne)) { if (!ObjectUtils.isEmpty(getOne)) {
BeanUtils.copyProperties(characteristicValue, getOne); BeanUtils.copyProperties(characteristicValue, getOne);
...@@ -190,17 +192,19 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -190,17 +192,19 @@ public class IntegrateServiceImpl implements IntegrateService {
} }
@Override @Override
public GetProductOutDto SetSuperTableInfo(SaveTableInputDto saveTableInputDtos) { public GetProductOutDto SetSuperTableInfo(List<SaveTableInputDto> saveTableInputDtos) {
GetProductOutDto result = new GetProductOutDto(); GetProductOutDto result = new GetProductOutDto();
try { try {
for (SaveTableInputDto saveTableInputDto : saveTableInputDtos) {
if (!ObjectUtils.isEmpty(saveTableInputDtos)) { if (!ObjectUtils.isEmpty(saveTableInputDtos)) {
List<String> superBomCodeList = saveTableInputDtos.getSuperBomCode(); List<String> superBomCodeList = saveTableInputDto.getSuperBomCode();
superBomCodeList.forEach(superBomCode->{ for (String superBomCode : superBomCodeList) {
SuperTableInfo superTableInfo = new SuperTableInfo(); SuperTableInfo superTableInfo = new SuperTableInfo();
superTableInfo.setId(sequence.nextId()); superTableInfo.setId(sequence.nextId());
superTableInfo.setSuperBomCode(superBomCode); superTableInfo.setSuperBomCode(superBomCode);
superTableInfo.setTableNumber(saveTableInputDtos.getTableNumber()); superTableInfo.setTableNumber(saveTableInputDto.getTableNumber());
superTableInfo.setTableName(saveTableInputDtos.getTableName()); superTableInfo.setTableName(saveTableInputDto.getTableName());
SuperTableInfo getOne = superTableInfoMapper.getOne(superTableInfo); SuperTableInfo getOne = superTableInfoMapper.getOne(superTableInfo);
if (!ObjectUtils.isEmpty(getOne)) { if (!ObjectUtils.isEmpty(getOne)) {
BeanUtils.copyProperties(superTableInfo, getOne); BeanUtils.copyProperties(superTableInfo, getOne);
...@@ -211,14 +215,14 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -211,14 +215,14 @@ public class IntegrateServiceImpl implements IntegrateService {
superTableInfoMapper.saveLog(log); superTableInfoMapper.saveLog(log);
superTableInfoMapper.deleteBom(getOne); superTableInfoMapper.deleteBom(getOne);
superTableInfoMapper.saveBom(getOne); superTableInfoMapper.saveBom(getOne);
if (!CollectionUtils.isEmpty(saveTableInputDtos.getTableLists())) { if (!CollectionUtils.isEmpty(saveTableInputDto.getTableLists())) {
List<SaveTableInputDto.SuperTableItemDto> tableLists = saveTableInputDtos.getTableLists(); List<SaveTableInputDto.SuperTableItemDto> tableLists = saveTableInputDto.getTableLists();
for (SaveTableInputDto.SuperTableItemDto tableItem : tableLists) { for (SaveTableInputDto.SuperTableItemDto tableItem : tableLists) {
SuperTableItemInfo item = new SuperTableItemInfo(); SuperTableItemInfo item = new SuperTableItemInfo();
item.setId(sequence.nextId()); item.setId(sequence.nextId());
item.setGroupNumber(tableItem.getLineCode()); item.setGroupNumber(tableItem.getLineCode());
item.setSuperBomCode(superBomCode); item.setSuperBomCode(superBomCode);
item.setTableNumber(saveTableInputDtos.getTableNumber()); item.setTableNumber(saveTableInputDto.getTableNumber());
item.setCharacteristicCode(tableItem.getCharacteristicCode()); item.setCharacteristicCode(tableItem.getCharacteristicCode());
item.setCharacteristicValueCode(tableItem.getCharacteristicValueCode()); item.setCharacteristicValueCode(tableItem.getCharacteristicValueCode());
item.setCreateBy(SecurityService.getPrincipal().getCode()); item.setCreateBy(SecurityService.getPrincipal().getCode());
...@@ -229,6 +233,8 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -229,6 +233,8 @@ public class IntegrateServiceImpl implements IntegrateService {
superTableInfoItemMapper.saveBom(item); superTableInfoItemMapper.saveBom(item);
} }
} }
result.setMsg(ApiResult.SUCCESS.getMsg());
result.setCode(ApiResult.SUCCESS.getCode());
} else { } else {
SuperTableInfoLog log = new SuperTableInfoLog(); SuperTableInfoLog log = new SuperTableInfoLog();
BeanUtils.copyProperties(superTableInfo, log); BeanUtils.copyProperties(superTableInfo, log);
...@@ -236,11 +242,19 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -236,11 +242,19 @@ public class IntegrateServiceImpl implements IntegrateService {
log.setCreateBy(SecurityService.getPrincipal().getCode()); log.setCreateBy(SecurityService.getPrincipal().getCode());
superTableInfoMapper.saveLog(log); superTableInfoMapper.saveLog(log);
superTableInfoMapper.saveBom(superTableInfo); superTableInfoMapper.saveBom(superTableInfo);
result.setMsg(ApiResult.SUCCESS.getMsg());
result.setCode(ApiResult.SUCCESS.getCode());
}
}
} }
});
} }
} catch (Exception e) { } catch (Exception e) {
throw new BusinessException(ApiResult.INTERNAL_SERVER_ERROR.getMsg()); result.setMsg(ApiResult.INTERNAL_SERVER_ERROR.getMsg());
result.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
result.setData(new BusinessException());
return result;
} }
return result; return result;
} }
...@@ -272,19 +286,20 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -272,19 +286,20 @@ public class IntegrateServiceImpl implements IntegrateService {
} }
@Override @Override
public String getCNameByCode(String characteristicCode) { public Characteristic getCNameByCode(String characteristicCode,String superBomCode) {
return characteristicMapper.getCNameByCode(characteristicCode); return characteristicMapper.getCNameByCode(characteristicCode,superBomCode);
} }
@Override @Override
public Object GetSKUByConfigInfo(SuperBomSkuInfo superBomSkuInfo) { public Object GetSKUByConfigInfo(SuperBomSkuInfo superBomSkuInfo) {
GetProductOutDto result = new GetProductOutDto();
if (!ObjectUtils.isEmpty(superBomSkuInfo)) { if (!ObjectUtils.isEmpty(superBomSkuInfo)) {
if (!CollectionUtils.isEmpty(superBomSkuInfo.getCharacteristicList())) { if (!CollectionUtils.isEmpty(superBomSkuInfo.getCharacteristicList())) {
List<SuperBomSkuConfigInfo> characteristicList = superBomSkuInfo.getCharacteristicList(); List<SuperBomSkuConfigInfo> characteristicList = superBomSkuInfo.getCharacteristicList();
Boolean flag = true; Boolean flag = true;
for (SuperBomSkuConfigInfo superBomSkuConfigInfo : characteristicList) { for (SuperBomSkuConfigInfo superBomSkuConfigInfo : characteristicList) {
SuperBomSkuConfigInfo skuConfigInfo = characteristicMapper.checkConfig(superBomSkuConfigInfo.getCharacteristicCode(), superBomSkuConfigInfo.getCharacteristicValueCode(), superBomSkuInfo.getSuperBomCode()); SuperBomSkuConfigInfo skuConfigInfo = characteristicMapper.checkConfig(superBomSkuConfigInfo.getCharacteristicCode(), superBomSkuConfigInfo.getCharacteristicValueName(), superBomSkuInfo.getSuperBomCode(), superBomSkuInfo.getPatern(), superBomSkuInfo.getPoliticalMiningId(), superBomSkuInfo.getConfigId(), superBomSkuConfigInfo.getCharacteristicValueCode());
if (!ObjectUtils.isEmpty(skuConfigInfo)) { if (ObjectUtils.isEmpty(skuConfigInfo)) {
//撞配不通过 保存SKU信息 调用申请SKU接口 applySkuCode //撞配不通过 保存SKU信息 调用申请SKU接口 applySkuCode
SuperBomSkuConfigInfo config = new SuperBomSkuConfigInfo(); SuperBomSkuConfigInfo config = new SuperBomSkuConfigInfo();
BeanUtils.copyProperties(superBomSkuConfigInfo, config); BeanUtils.copyProperties(superBomSkuConfigInfo, config);
...@@ -297,18 +312,26 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -297,18 +312,26 @@ public class IntegrateServiceImpl implements IntegrateService {
//调用PLM申请sku号 返回后修改sku数据返回 //调用PLM申请sku号 返回后修改sku数据返回
ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo); ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo);
if (applySkuCodeResultDto.getCode().equals(200)) { if (applySkuCodeResultDto.getCode().equals(200)) {
if (applySkuCodeResultDto.getCode().equals(200)) {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData(); ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setConfigId(superBomSkuInfo.getConfigId()); data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("已回号"); data.setMsg("已回号");
characteristicMapper.updateSuperBomSkuInfo(data); characteristicMapper.updateSuperBomSkuInfo(data);
superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
} else { } else {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData(); ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setConfigId(superBomSkuInfo.getConfigId()); data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("未回号"); data.setMsg("未回号");
characteristicMapper.updateSuperBomSkuStatus(data); characteristicMapper.updateSuperBomSkuStatus(data);
superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
}
} else {
result.setMsg(applySkuCodeResultDto.getMsg());
result.setCode(applySkuCodeResultDto.getCode());
return result;
} }
} else if (flag) {
return superBomSkuInfo;
} }
} }
} }
...@@ -318,7 +341,30 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -318,7 +341,30 @@ public class IntegrateServiceImpl implements IntegrateService {
@Override @Override
public Object GetConfigBySUKINFO(SuperBomSkuInfo superBomSkuInfo) { public Object GetConfigBySUKINFO(SuperBomSkuInfo superBomSkuInfo) {
//撞配 //撞配
return GetSKUByConfigInfo(superBomSkuInfo); SuperBomSkuInfo returnSkuInfo = new SuperBomSkuInfo();
GetProductOutDto result = new GetProductOutDto();
Object ob = GetSKUByConfigInfo(superBomSkuInfo);
boolean flag = ob instanceof SuperBomSkuInfo;
if(flag){
returnSkuInfo = (SuperBomSkuInfo)ob;
SuperBomSkuInfo getSkuInfo = superBomSkuInfoMapper.getSkuInfo(returnSkuInfo);
if(ObjectUtils.isEmpty(getSkuInfo)){
result.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
result.setMsg("该配置不存在");
return result;
}
superBomSkuInfo.setSkuCode(getSkuInfo.getSkuCode());
superBomSkuInfo.setSkuName(getSkuInfo.getSkuName());
return superBomSkuInfo;
}else{
GetProductOutDto ss = (GetProductOutDto)ob;
result.setCode(ss.getCode());
result.setMsg(ss.getMsg());
return result;
}
} }
/** /**
...@@ -333,6 +379,12 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -333,6 +379,12 @@ public class IntegrateServiceImpl implements IntegrateService {
return new PageInfo<>(superBomSkuInfoMapper.querySkuList(superBomSkuInfo)); return new PageInfo<>(superBomSkuInfoMapper.querySkuList(superBomSkuInfo));
} }
@Override
public Object querySkuOne(String configId) {
return superBomSkuInfoMapper.querySkuOne(configId);
}
/** /**
* @return Configid, SKUCode,SKUCode,产品型号,产品小型好,69码 * @return Configid, SKUCode,SKUCode,产品型号,产品小型好,69码
...@@ -344,6 +396,10 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -344,6 +396,10 @@ public class IntegrateServiceImpl implements IntegrateService {
public ApplySkuCodeResultDto applySkuCode(SuperBomSkuInfo superBomSkuInfo) { public ApplySkuCodeResultDto applySkuCode(SuperBomSkuInfo superBomSkuInfo) {
ApplySkuCodeResultDto dto = new ApplySkuCodeResultDto(); ApplySkuCodeResultDto dto = new ApplySkuCodeResultDto();
try {
//调用PLM 申请skuCode //调用PLM 申请skuCode
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
...@@ -360,7 +416,7 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -360,7 +416,7 @@ public class IntegrateServiceImpl implements IntegrateService {
ToPLMDto toPLMDto = new ToPLMDto(); ToPLMDto toPLMDto = new ToPLMDto();
toPLMDto.setConfigId(superBomSkuInfo.getConfigId()); toPLMDto.setConfigId(superBomSkuInfo.getConfigId());
toPLMDto.setSpecial(false); toPLMDto.setSpecial(false);
toPLMDto.setSuperNumber(superBomSkuInfo.getSuperBomName()); toPLMDto.setSuperNumber(superBomSkuInfo.getSuperBomCode());
toPLMDto.setH3cSuperNumber(superBomSkuInfo.getH3cPn()); toPLMDto.setH3cSuperNumber(superBomSkuInfo.getH3cPn());
toPLMDto.setGovernmentId(superBomSkuInfo.getPoliticalMiningId()); toPLMDto.setGovernmentId(superBomSkuInfo.getPoliticalMiningId());
toPLMDto.setModel(superBomSkuInfo.getPatern()); toPLMDto.setModel(superBomSkuInfo.getPatern());
...@@ -398,6 +454,11 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -398,6 +454,11 @@ public class IntegrateServiceImpl implements IntegrateService {
dto.setData((ApplySkuCodeResultDto.data) map.get("data")); dto.setData((ApplySkuCodeResultDto.data) map.get("data"));
} }
} }
} catch (Exception e) {
dto.setMsg("该配置在CPQ不存在,调用PLM申请回号失败!");
dto.setCode(500);
return dto;
}
return dto; return dto;
} }
...@@ -415,9 +476,8 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -415,9 +476,8 @@ public class IntegrateServiceImpl implements IntegrateService {
configurableBom = characteristicMapper.getSuperBomInfo(Long.valueOf(configId)); configurableBom = characteristicMapper.getSuperBomInfo(Long.valueOf(configId));
} else if (!StringUtils.isEmpty(skuCode)) { } else if (!StringUtils.isEmpty(skuCode)) {
//根据skucode查询 skucode 就是申请回号的code //根据skucode查询 skucode 就是申请回号的code
configurableBom = ctoBomMapper.getSuperBomInfoBySuperBomCode(skuCode); String config = ctoBomMapper.getSuperBomInfoBySuperBomCode(skuCode);
} else { configurableBom = characteristicMapper.getSuperBomInfo(Long.valueOf(config));
} }
//根据特征值名称获取物料的信息 //根据特征值名称获取物料的信息
Map<String, Object> supBomInfoMap = new HashMap<>(); Map<String, Object> supBomInfoMap = new HashMap<>();
...@@ -442,7 +502,8 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -442,7 +502,8 @@ public class IntegrateServiceImpl implements IntegrateService {
selectedCharacteristicList.forEach(item -> { selectedCharacteristicList.forEach(item -> {
CharacteristicAndValueDto cDto = new CharacteristicAndValueDto(); CharacteristicAndValueDto cDto = new CharacteristicAndValueDto();
String characteristicValueName = (String) item.get("characteristicValueName"); String characteristicValueName = (String) item.get("characteristicValueName");
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByName(characteristicValueName, finalConfigurableBom.getSuperBomCode()); String characteristicName = (String) item.get("characteristicName");
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByName(characteristicValueName, finalConfigurableBom.getSuperBomCode(), characteristicName);
cDto.setCharacteristicCode(characteristicValue.getCharacteristicCode()); cDto.setCharacteristicCode(characteristicValue.getCharacteristicCode());
cDto.setCharacteristicName(characteristicValue.getCharacteristicName()); cDto.setCharacteristicName(characteristicValue.getCharacteristicName());
cDto.setUnisSalesCName(characteristicValue.getUnisSalesCName()); cDto.setUnisSalesCName(characteristicValue.getUnisSalesCName());
...@@ -495,7 +556,6 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -495,7 +556,6 @@ public class IntegrateServiceImpl implements IntegrateService {
@Override @Override
public Object GetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo) { public Object GetSKUByH3CConfigInfo(GetSKUByH3CConfigInfo configSkuInfo) {
GetProductOutDto result = new GetProductOutDto();
/* /*
1.使用H3CPN匹配SKU表中SuperBOM 1.使用H3CPN匹配SKU表中SuperBOM
...@@ -503,6 +563,7 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -503,6 +563,7 @@ public class IntegrateServiceImpl implements IntegrateService {
3.匹配不成功的,先查看配置是否满足VT约束,满足以后调用生成配置接口,获取配置JSON后GetSKUByConfigInfo 找PLM申请SKU 3.匹配不成功的,先查看配置是否满足VT约束,满足以后调用生成配置接口,获取配置JSON后GetSKUByConfigInfo 找PLM申请SKU
不支持特配,是否特配,默认不是 不支持特配,是否特配,默认不是
* */ * */
GetProductOutDto result = new GetProductOutDto();
if (!CollectionUtils.isEmpty(configSkuInfo.getH3CPNList())) { if (!CollectionUtils.isEmpty(configSkuInfo.getH3CPNList())) {
List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList(); List<GetSKUByH3CConfigInfo.H3CPNList> h3CPNList = configSkuInfo.getH3CPNList();
...@@ -510,51 +571,87 @@ public class IntegrateServiceImpl implements IntegrateService { ...@@ -510,51 +571,87 @@ public class IntegrateServiceImpl implements IntegrateService {
if (!CollectionUtils.isEmpty(cpnList.getSelectedCharacteristicList())) { if (!CollectionUtils.isEmpty(cpnList.getSelectedCharacteristicList())) {
List<GetSKUByH3CConfigInfo.KeyValues> selectedCharacteristicList = cpnList.getSelectedCharacteristicList(); List<GetSKUByH3CConfigInfo.KeyValues> selectedCharacteristicList = cpnList.getSelectedCharacteristicList();
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) { for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) {
//SuperBomSkuConfigInfo superBomSkuConfigInfo = superBomSkuInfoMapper.getConfigInfoList(item.getH3cPn(),keyValues.getH3cVCode()); Integer politicalMiningId = cpnList.getPoliticalMiningId();
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), cpnList.getH3cPn()); String politicalMining = "";
if (politicalMiningId.equals(0)) {
politicalMining = "否";
} else if (politicalMiningId.equals(1)) {
politicalMining = "是";
}
CharacteristicValue characteristicValue = characteristicValueMapper.getCharacteristicValueInfoByCode(keyValues.getH3cVCode(), cpnList.getH3cPn(), politicalMining, cpnList.getPatern());
if (ObjectUtils.isEmpty(characteristicValue)) { if (ObjectUtils.isEmpty(characteristicValue)) {
result.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!"); cpnList.setMsg("CPQ数据验证失败,失败原因:" + keyValues.getH3cVCode() + "关系未维护!");
result.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
return result; return configSkuInfo;
} else { } else {
//不为空时校验是否下架 //不为空时校验是否下架
if (characteristicValue.getIsShow() == 0) { if (characteristicValue.getIsState() == 0) {
result.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicValueCode() + "已下架!"); cpnList.setMsg("CPQ数据验证失败,失败原因:" + characteristicValue.getCharacteristicValueCode() + "已下架!");
result.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode()); cpnList.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
return result; return configSkuInfo;
} }
} }
} }
//没有下架 撞配 封装 撞配信息 //没有下架 撞配 封装 撞配信息
SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo(); SuperBomSkuInfo superBomSkuInfo = new SuperBomSkuInfo();
List<SuperBomSkuConfigInfo> configs = new ArrayList<>(); List<SuperBomSkuConfigInfo> configs = new ArrayList<>();
SuperBomSkuConfigInfo superBomSkuConfigInfo = new SuperBomSkuConfigInfo();
superBomSkuInfo.setSuperBomCode(cpnList.getH3cPn()); superBomSkuInfo.setSuperBomCode(cpnList.getH3cPn());
superBomSkuInfo.setConfigId(cpnList.getConfigId());
superBomSkuInfo = superBomSkuInfoMapper.getSkuInfo(superBomSkuInfo);
for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) { for (GetSKUByH3CConfigInfo.KeyValues keyValues : selectedCharacteristicList) {
superBomSkuConfigInfo.setCharacteristicValueCode(keyValues.getH3cVCode()); SuperBomSkuConfigInfo superBomSkuConfigInfo = superBomSkuInfoMapper.getConfigInfoList(cpnList.getConfigId(), keyValues.getH3cVCode());
configs.add(superBomSkuConfigInfo); configs.add(superBomSkuConfigInfo);
} }
superBomSkuInfo.setCharacteristicList(configs); superBomSkuInfo.setCharacteristicList(configs);
//撞配 找PLM申请SKU //撞配 找PLM申请SKU
SuperBomSkuInfo skuInfo = (SuperBomSkuInfo) GetSKUByConfigInfo(superBomSkuInfo); ApplySkuCodeResultDto skuInfo = applySkuCode(superBomSkuInfo);
if (!ObjectUtils.isEmpty(skuInfo)) { if (skuInfo.getCode().equals(200)) {
result.setCode(ApiResult.SUCCESS.getCode()); if (skuInfo.getCode().equals(200)) {
result.setMsg(ApiResult.SUCCESS.getMsg()); ApplySkuCodeResultDto.data data = skuInfo.getData();
result.setData(skuInfo); data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("已回号");
cpnList.setCode(skuInfo.getCode());
cpnList.setMsg(skuInfo.getMsg());
cpnList.setSkuCode(data.getSkuCode());
cpnList.setSkuName(data.getSkuName());
characteristicMapper.updateSuperBomSkuInfo(data);
} else {
ApplySkuCodeResultDto.data data = skuInfo.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("未回号");
cpnList.setCode(skuInfo.getCode());
cpnList.setMsg(skuInfo.getMsg());
characteristicMapper.updateSuperBomSkuStatus(data);
}
} else {
result.setMsg(skuInfo.getMsg());
result.setCode(skuInfo.getCode());
return result; return result;
} }
} }
} }
} }
return result; return configSkuInfo;
} }
@Override @Override
public Object getConfigInfo(GetConfigurationInputDTO getConfigurationInputDTO) { public Object getConfigInfo(GetConfigurationInputDTO getConfigurationInputDTO) {
if (CollectionUtils.isEmpty(getConfigurationInputDTO.getConfigIds())) {
if (!StringUtils.isEmpty(getConfigurationInputDTO.getSkuCode())) {
String configId = superBomSkuInfoMapper.getConfigId(getConfigurationInputDTO.getSkuCode());
List<Long> configIds = new ArrayList<>();
Long aLong = Long.valueOf(configId);
configIds.add(aLong);
getConfigurationInputDTO.setConfigIds(configIds);
} else {
return "请输入skuCode/ConfigId";
}
}
RestTemplate restTemplate = new RestTemplate(); RestTemplate restTemplate = new RestTemplate();
HttpHeaders headers = getHttpHeader(); HttpHeaders headers = getHttpHeader();
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("http://127.0.0.1:8080/api/v1/selector/configurations", HttpMethod.POST, requestEntity, String.class); ResponseEntity<String> responseEntity = restTemplate.exchange("http://10.0.4.24:8080/api/v1/selector/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");
......
...@@ -50,9 +50,9 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic ...@@ -50,9 +50,9 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic
*/ */
@Override @Override
public StandardModelManageViewDto getStandardModel(StandardModelManageDto standardModelManage) { public StandardModelManageViewDto getStandardModel(StandardModelManageDto standardModelManage) {
String bomCode = standardModelManage.getBomCode(); String superBomCode = standardModelManage.getSuperBomCode();
if(!StringUtils.isNotBlank(bomCode)){ if(!StringUtils.isNotBlank(superBomCode)){
throw new BizException(ApiResult.IS_NOT_NULL,"bomCode信息缺失"); throw new BizException(ApiResult.IS_NOT_NULL,"superBomCode信息缺失");
} }
StandardModelManageViewDto standardModelManageDtoDto = new StandardModelManageViewDto(); StandardModelManageViewDto standardModelManageDtoDto = new StandardModelManageViewDto();
List<Characteristic> cv = standardModelManageMapper.getStandardModel(standardModelManage); List<Characteristic> cv = standardModelManageMapper.getStandardModel(standardModelManage);
...@@ -84,7 +84,7 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic ...@@ -84,7 +84,7 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic
//0715 增加数量级cv更新 //0715 增加数量级cv更新
if(!CollectionUtils.isEmpty(item.getPairCharacteristicValue())){ if(!CollectionUtils.isEmpty(item.getPairCharacteristicValue())){
item.getPairCharacteristicValue().stream().forEach(itemChildren->{ item.getPairCharacteristicValue().stream().forEach(itemChildren->{
characteristiValue.add(bulderVCode(itemChildren,dto.getBomCode())); characteristiValue.add(bulderVCode(itemChildren,dto.getSuperBomCode()));
}); });
} }
}); });
...@@ -95,7 +95,7 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic ...@@ -95,7 +95,7 @@ public class StandardModelManageServiceImpl implements StandardModelManageServic
standardModelManageMapper.updateDefaultValueZero(characteristi); standardModelManageMapper.updateDefaultValueZero(characteristi);
//根据特征值编码把特征值更新为1 默认选中 //根据特征值编码把特征值更新为1 默认选中
standardModelManageMapper.updateDefaultValueOne(characteristiValue); standardModelManageMapper.updateDefaultValueOne(characteristiValue);
//更新cot的configId //更新cto的configId
ctoBomMapper.updateConfigId(dto); ctoBomMapper.updateConfigId(dto);
} }
......
...@@ -3,6 +3,7 @@ package cn.com.uitech.authorization.service.impl; ...@@ -3,6 +3,7 @@ package cn.com.uitech.authorization.service.impl;
import cn.com.uitech.authorization.exception.BusinessException; import cn.com.uitech.authorization.exception.BusinessException;
import cn.com.uitech.authorization.mapper.BasicsPriceInfoMapper; import cn.com.uitech.authorization.mapper.BasicsPriceInfoMapper;
import cn.com.uitech.authorization.mapper.SuperBomPriceCalculateMapper; import cn.com.uitech.authorization.mapper.SuperBomPriceCalculateMapper;
import cn.com.uitech.authorization.pojo.dto.GetProductOutDto;
import cn.com.uitech.authorization.pojo.entity.*; import cn.com.uitech.authorization.pojo.entity.*;
import cn.com.uitech.authorization.service.BasicsPriceInfoService; import cn.com.uitech.authorization.service.BasicsPriceInfoService;
import cn.com.uitech.authorization.service.SuperBomPriceCalculateService; import cn.com.uitech.authorization.service.SuperBomPriceCalculateService;
...@@ -41,66 +42,93 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate ...@@ -41,66 +42,93 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate
* @return * @return
*/ */
@Override @Override
public SuperBomPriceInfoEntity getPriceByConfigInfo(SuperBomEntity superBomEntity) { public Object getPriceByConfigInfo(SuperBomEntity superBomEntity) {
// 1、获取cto价格信息 // 1、获取cto价格信息
SuperBomPriceInfoEntity superBomPriceInfoEntity = new SuperBomPriceInfoEntity(); SuperBomPriceInfoEntity superBomPriceInfoEntity = new SuperBomPriceInfoEntity();
GetProductOutDto result = new GetProductOutDto();
// 计算后的成本信息 // 计算后的成本信息
String bomCodeTemp = superBomEntity.getSuperBomCode();
List<Characteristics> selectedCharacteristicList = superBomEntity.getCharacteristicList(); List<Characteristics> selectedCharacteristicList = superBomEntity.getCharacteristicList();
// 查询各级别价格系数以及定价方法是标准成本还是市场定价 // 查询各级别价格系数以及定价方法是标准成本还是市场定价
BasicsPriceInfoEntity basicsPriceInfoEntity = basicsPriceInfoMapper.queryBasicsPriceInfo(superBomEntity); BasicsPriceInfoEntity basicsPriceInfoEntity = basicsPriceInfoMapper.queryBasicsPriceInfo(superBomEntity);
if (ObjectUtils.isEmpty(basicsPriceInfoEntity)) {
superBomEntity.setSuperBomCode(null);
basicsPriceInfoEntity = basicsPriceInfoMapper.queryBasicsPriceInfo(superBomEntity);
if (ObjectUtils.isEmpty(basicsPriceInfoEntity)) {
result.setMsg("请维护价格系数");
result.setCode(500);
return result;
}
}
if (!ObjectUtils.isEmpty(basicsPriceInfoEntity)) {
// 成本定价法 使用标准成本价*各级别系数计算 // 成本定价法 使用标准成本价*各级别系数计算
if ("0".equals(basicsPriceInfoEntity.getPriceType())) { if ("0".equals(basicsPriceInfoEntity.getPriceType())) {
selectedCharacteristicList.forEach(characteristics -> { BasicsPriceInfoEntity finalBasicsPriceInfoEntity = basicsPriceInfoEntity;
for (Characteristics characteristics : selectedCharacteristicList) {
superBomEntity.setSuperBomCode(bomCodeTemp);
SuperBomPriceInfoEntity characteristicBomPriceInfo = getSuperBomPriceInfoEntity(superBomEntity, superBomPriceInfoEntity, characteristics); 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.getLeve0Price().multiply(basicsPriceInfoEntity.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(basicsPriceInfoEntity.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(basicsPriceInfoEntity.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(basicsPriceInfoEntity.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 { } else {
// 市场定价法 使用代理价*各级别系数计算 // 市场定价法 使用代理价*各级别系数计算
selectedCharacteristicList.forEach(characteristics -> { BasicsPriceInfoEntity finalBasicsPriceInfoEntity1 = basicsPriceInfoEntity;
for (Characteristics characteristics : selectedCharacteristicList) {
superBomEntity.setSuperBomCode(bomCodeTemp);
// 3、查询特征值价格信息 // 3、查询特征值价格信息
SuperBomPriceInfoEntity characteristicBomPriceInfo = getSuperBomPriceInfoEntity(superBomEntity, superBomPriceInfoEntity, characteristics); 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(basicsPriceInfoEntity.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(basicsPriceInfoEntity.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(basicsPriceInfoEntity.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(basicsPriceInfoEntity.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;
} }
...@@ -115,6 +143,21 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate ...@@ -115,6 +143,21 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate
*/ */
private SuperBomPriceInfoEntity getSuperBomPriceInfoEntity(SuperBomEntity superBomEntity, SuperBomPriceInfoEntity superBomPriceInfoEntity, Characteristics characteristics) { private SuperBomPriceInfoEntity getSuperBomPriceInfoEntity(SuperBomEntity superBomEntity, SuperBomPriceInfoEntity superBomPriceInfoEntity, Characteristics characteristics) {
SuperBomPriceInfoEntity characteristicBomPriceInfo = superBomPriceCalculateMapper.getCharacteristicsPriceInfo(superBomEntity.getSuperBomCode(), superBomEntity.getProductClassCode(), characteristics.getCharacteristicValueCode()); SuperBomPriceInfoEntity characteristicBomPriceInfo = superBomPriceCalculateMapper.getCharacteristicsPriceInfo(superBomEntity.getSuperBomCode(), superBomEntity.getProductClassCode(), characteristics.getCharacteristicValueCode());
if (ObjectUtils.isEmpty(characteristicBomPriceInfo)) {
characteristics.setCharacteristicValueCode(null);
characteristicBomPriceInfo = superBomPriceCalculateMapper.getCharacteristicsPriceInfo(superBomEntity.getSuperBomCode(), superBomEntity.getProductClassCode(), characteristics.getCharacteristicValueCode());
if (ObjectUtils.isEmpty(characteristicBomPriceInfo)) {
Integer type = 1;
characteristicBomPriceInfo = superBomPriceCalculateMapper.getCharacteristicsPrice(superBomEntity.getSuperBomCode(), type);
if (ObjectUtils.isEmpty(characteristicBomPriceInfo)) {
Integer type2 = 2;
characteristicBomPriceInfo = superBomPriceCalculateMapper.getCharacteristicsPrice(superBomEntity.getSuperBomCode(), type2);
if (ObjectUtils.isEmpty(characteristicBomPriceInfo)) {
return null;
}
}
}
} else {
// 计算根据系数计算价格 // 计算根据系数计算价格
/* /*
标准成本价 标准成本价
...@@ -131,6 +174,7 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate ...@@ -131,6 +174,7 @@ public class SuperBomPriceCalculateServiceImpl implements SuperBomPriceCalculate
*/ */
characteristics.setAgentPrice(characteristicBomPriceInfo.getAgentPrice()); characteristics.setAgentPrice(characteristicBomPriceInfo.getAgentPrice());
superBomPriceInfoEntity.setAgentPrice(superBomPriceInfoEntity.getAgentPrice().add(characteristicBomPriceInfo.getAgentPrice())); superBomPriceInfoEntity.setAgentPrice(superBomPriceInfoEntity.getAgentPrice().add(characteristicBomPriceInfo.getAgentPrice()));
}
return characteristicBomPriceInfo; return characteristicBomPriceInfo;
} }
......
...@@ -17,18 +17,36 @@ ...@@ -17,18 +17,36 @@
<delete id="deletePriceCoefficient"> <delete id="deletePriceCoefficient">
delete from basics_price_info a delete from basics_price_info a
<where> <where>
<if test="productClassCode != null and productClassCode !=''">
a.product_class_code = #{productClassCode} a.product_class_code = #{productClassCode}
</if>
<if test="brand != null and brand !=''">
and a.brand = #{brand} and a.brand = #{brand}
</if>
<if test="superBomCode != null and superBomCode !=''">
and a.super_bom_code = #{superBomCode} and a.super_bom_code = #{superBomCode}
</if>
<if test="superBomCode == null ">
and a.super_bom_code is null
</if>
</where> </where>
</delete> </delete>
<select id="queryBasicsPriceInfo" <select id="queryBasicsPriceInfo"
resultType="cn.com.uitech.authorization.pojo.entity.BasicsPriceInfoEntity"> resultType="cn.com.uitech.authorization.pojo.entity.BasicsPriceInfoEntity">
select * from basics_price_info a select * from basics_price_info a
<where> <where>
<if test="productClassCode != null and productClassCode !=''">
a.product_class_code = #{productClassCode} a.product_class_code = #{productClassCode}
</if>
<if test="brand != null and brand !=''">
and a.brand = #{brand} and a.brand = #{brand}
</if>
<if test="superBomCode != null and superBomCode !=''">
and a.super_bom_code = #{superBomCode} and a.super_bom_code = #{superBomCode}
</if>
<if test="superBomCode == null ">
and a.super_bom_code is null
</if>
</where> </where>
</select> </select>
</mapper> </mapper>
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
FROM 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 super_bom_info on super_characteristic_info.super_bom_code=super_bom_info.super_bom_code
<where> 1=1 <where> 1=1
and super_bom_info.is_state=1
<if test="superBomCode!=null and superBomCode!=''"> <if test="superBomCode!=null and superBomCode!=''">
and super_bom_info.super_bom_code LIKE CONCAT('%','${superBomCode}','%') and super_bom_info.super_bom_code LIKE CONCAT('%','${superBomCode}','%')
</if> </if>
...@@ -139,8 +138,8 @@ ...@@ -139,8 +138,8 @@
select characteristic_name from super_characteristic_info where characteristic_code = #{characteristicCode} and is_show = #{isShow} select characteristic_name from super_characteristic_info where characteristic_code = #{characteristicCode} and is_show = #{isShow}
</select> </select>
<select id="getCNameByCode" resultType="java.lang.String"> <select id="getCNameByCode" resultType="cn.com.uitech.authorization.pojo.entity.Characteristic">
select characteristic_name from super_characteristic_info where characteristic_code = #{characteristicCode} select * from super_characteristic_info where characteristic_code = #{characteristicCode} and super_bom_code = #{superBomCode}
</select> </select>
<select id="getVNameByConfigId" resultType="java.lang.String"> <select id="getVNameByConfigId" resultType="java.lang.String">
...@@ -153,7 +152,7 @@ ...@@ -153,7 +152,7 @@
<select id="getSuperBomInfo" resultType="cn.com.uitech.authorization.pojo.entity.ConfigurableBom"> <select id="getSuperBomInfo" resultType="cn.com.uitech.authorization.pojo.entity.ConfigurableBom">
select * from super_bom_info a select * from super_bom_info a
left join configuration_basis b on a.super_bom_code = b.material_code left join configuration_basis b on a.super_bom_code = b.material_code
LEFT JOIN super_bom_sku_info c ON A.super_bom_code = c.super_bom_code LEFT JOIN super_bom_sku_info c ON A.super_bom_code = c.super_bom_code and cast(b.config_id as varchar) = c.config_id
left join a_productclasscode d on a.product_class_code = d.product_class_code where b.config_id = #{configId} left join a_productclasscode d on a.product_class_code = d.product_class_code where b.config_id = #{configId}
</select> </select>
...@@ -167,12 +166,24 @@ ...@@ -167,12 +166,24 @@
<if test="characteristicCode != null and characteristicCode!=''"> <if test="characteristicCode != null and characteristicCode!=''">
characteristic_code = #{characteristicCode} characteristic_code = #{characteristicCode}
</if> </if>
<if test="characteristicValueName != null and characteristicValueName!=''">
and characteristic_value_name = #{characteristicValueName}
</if>
<if test="characteristicValueCode != null and characteristicValueCode!=''"> <if test="characteristicValueCode != null and characteristicValueCode!=''">
and characteristic_value_code = #{characteristicValueCode} and characteristic_value_code = #{characteristicValueCode}
</if> </if>
<if test="superBomCode != null and superBomCode!=''"> <if test="superBomCode != null and superBomCode!=''">
and b.super_bom_code = #{superBomCode} and b.super_bom_code = #{superBomCode}
</if> </if>
<if test="patern != null and patern!=''">
and b.patern = #{patern}
</if>
<if test="politicalMiningId != null and politicalMiningId!=''">
and b.political_mining_id = #{politicalMiningId}
</if>
<if test="configId != null and configId!=''">
and b.config_id = #{configId}
</if>
</where> </where>
......
...@@ -315,11 +315,18 @@ ...@@ -315,11 +315,18 @@
<select id="getCharacteristicValueInfoByName" <select id="getCharacteristicValueInfoByName"
resultType="cn.com.uitech.authorization.pojo.entity.CharacteristicValue"> resultType="cn.com.uitech.authorization.pojo.entity.CharacteristicValue">
select * from super_characteristic_value_info a select * from super_characteristic_value_info a
left join super_characteristic_info b on a.characteristic_code = b.characteristic_code where characteristic_value_name = #{characteristicValueName} and a.super_bom_code = #{superBomCode} left join super_characteristic_info b on a.characteristic_code = b.characteristic_code
where characteristic_value_name = #{characteristicValueName}
and a.super_bom_code = #{superBomCode}
and b.characteristic_name= #{characteristicName}
</select> </select>
<select id="getCharacteristicValueInfoByCode" <select id="getCharacteristicValueInfoByCode"
resultType="cn.com.uitech.authorization.pojo.entity.CharacteristicValue"> resultType="cn.com.uitech.authorization.pojo.entity.CharacteristicValue">
select * from super_characteristic_value_info where characteristic_value_name = #{param1} and super_bom_code = #{param2} select * from super_characteristic_value_info
where characteristic_value_name = #{h3cVCode}
and super_bom_code = #{h3cPn}
<!--and political_mining_id = #{param3}
and patern = #{param4}-->
</select> </select>
</mapper> </mapper>
...@@ -2,15 +2,9 @@ ...@@ -2,15 +2,9 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd"> <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="cn.com.uitech.authorization.mapper.CtoBomMapper"> <mapper namespace="cn.com.uitech.authorization.mapper.CtoBomMapper">
<select id="getCtoBoms" parameterType="cn.com.uitech.authorization.pojo.dto.CtoBomRequestParamDto" <select id="getCtoBoms" parameterType="cn.com.uitech.authorization.pojo.dto.CtoBomRequestParamDto"
resultType="cn.com.uitech.authorization.pojo.dto.ConfigurableBomResultDto"> resultType="cn.com.uitech.authorization.pojo.entity.ConfigurableBom">
SELECT SELECT
a.super_Bom_Code as superBomCode *
,a.super_Bom_Name as superBomName
,a.product_Class_Code as productClassCode
,b.product_Class_Name as productClassName
,unis_Sales_Name as unisSalesName
,is_State as isState
,a.brand
,c.name as brandName ,c.name as brandName
FROM super_bom_info a FROM super_bom_info a
left join a_productclasscode b on a.product_class_code = b.product_class_code left join a_productclasscode b on a.product_class_code = b.product_class_code
...@@ -23,7 +17,7 @@ ...@@ -23,7 +17,7 @@
and super_bom_name like CONCAT('%','${superBomName}','%') and super_bom_name like CONCAT('%','${superBomName}','%')
</if> </if>
<if test="productClassCode!=null and productClassCode!=''"> <if test="productClassCode!=null and productClassCode!=''">
and product_class_code like CONCAT('%','${productClassCode}','%') and a.product_class_code like CONCAT('%','${productClassCode}','%')
</if> </if>
<if test="unisSalesName!=null and unisSalesName!=''"> <if test="unisSalesName!=null and unisSalesName!=''">
and unis_sales_name like CONCAT('%','${unisSalesName}','%') and unis_sales_name like CONCAT('%','${unisSalesName}','%')
...@@ -209,10 +203,10 @@ ...@@ -209,10 +203,10 @@
<!--根据bomCode更新configId--> <!--根据bomCode更新configId-->
<select id="updateConfigId" parameterType="cn.com.uitech.authorization.pojo.dto.StandardModelManageDto"> <select id="updateConfigId" parameterType="cn.com.uitech.authorization.pojo.dto.StandardModelManageDto">
UPDATE super_bom_info UPDATE super_bom_info
SET configId = #{configId} SET config_Id = #{configId}
<where> <where>
<if test="bomCode!=null and bomCode!=''"> <if test="superBomCode!=null and superBomCode!=''">
bomcode = #{bomCode} super_bom_code = #{superBomCode}
</if> </if>
</where> </where>
</select> </select>
...@@ -384,11 +378,12 @@ ...@@ -384,11 +378,12 @@
and c.is_state = 1 and c.is_state = 1
</select> </select>
<select id="getSuperBomInfoBySuperBomCode" resultMap="superBomInfo"> <select id="getSuperBomInfoBySuperBomCode" resultType="String">
select * from super_bom_info where super_bom_code = #{superBomCode} select config_id from super_bom_sku_info where sku_code = #{skuCode}
</select> </select>
<select id="getSkuInfo" resultType="cn.com.uitech.authorization.pojo.entity.SuperBomSkuInfo"> <select id="getSkuInfo" resultType="cn.com.uitech.authorization.pojo.entity.SuperBomSkuInfo">
select * from super_bom_sku_info where cpq_config_id = #{cpqConfigId} and super_bom_code = #{superPartNumber} select * from super_bom_sku_info where cpq_config_id = #{cpqConfigId} and super_bom_code = #{superPartNumber}
</select> </select>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,13 +3,12 @@ ...@@ -3,13 +3,12 @@
<mapper namespace="cn.com.uitech.authorization.mapper.StandardModelManageMapper"> <mapper namespace="cn.com.uitech.authorization.mapper.StandardModelManageMapper">
<resultMap id="standardModelManageMap" type="cn.com.uitech.authorization.pojo.entity.Characteristic"> <resultMap id="standardModelManageMap" type="cn.com.uitech.authorization.pojo.entity.Characteristic">
<result property="characteristicCode" column="characteristicCode"></result> <result property="characteristicCode" column="characteristic_code"></result>
<result property="name" column="name"></result> <result property="characteristicName" column="characteristic_name"></result>
<result property="description" column="description"></result> <result property="characteristicType" column="characteristic_type"></result>
<result property="characterType" column="characterType"></result> <collection property="characteristicValueList" ofType="cn.com.uitech.authorization.pojo.dto.CharacteristicValueDto">
<collection property="characteristicValueDtoList" ofType="cn.com.uitech.authorization.pojo.dto.CharacteristicValueDto"> <result property="characteristicValueCode" column="characteristic_Value_Code"></result>
<result property="characteristicValueCode" column="characteristicValueCode"></result> <result property="characteristicValueName" column="characteristic_Value_name"></result>
<result property="name" column="codeName"></result>
</collection> </collection>
</resultMap> </resultMap>
...@@ -17,25 +16,24 @@ ...@@ -17,25 +16,24 @@
<select id="getStandardModel" parameterType="cn.com.uitech.authorization.pojo.dto.StandardModelManageDto" resultMap="standardModelManageMap"> <select id="getStandardModel" parameterType="cn.com.uitech.authorization.pojo.dto.StandardModelManageDto" resultMap="standardModelManageMap">
SELECT SELECT
characteristic.characteristicCode, characteristic.characteristic_code,
characteristic.name, characteristic.characteristic_name,
characteristic.description, characteristic.characteristic_type,
characteristic.characterType, characteristicvalue.characteristic_Value_Code,
characteristicvalue.characteristicValueCode, characteristicvalue.characteristic_Value_name
characteristicvalue.name as "codeName" FROM super_characteristic_info
FROM characteristic LEFT JOIN super_characteristic_value_info
LEFT JOIN characteristicvalue ON characteristicvalue.characteristic_code=characteristic.characteristic_code
ON characteristicvalue.characteristiccode=characteristic.characteristiccode WHERE characteristic.super_bom_code=#{superBomCode}
WHERE characteristic.bomcode=#{bomCode}
</select> </select>
<!--根据特征编码把所有下面的特征值更新为非默认0--> <!--根据特征编码把所有下面的特征值更新为非默认0-->
<update id="updateDefaultValueOne" parameterType="list"> <update id="updateDefaultValueOne" parameterType="list">
UPDATE characteristicvalue UPDATE super_characteristic_value_info
SET isdefault=1 SET is_base = 1
<where> <where>
<if test="list!=null and list.size()>0"> <if test="list!=null and list.size()>0">
and characteristicValueCode in and characteristic_Value_Code in
<foreach collection="list" item="item" open="(" separator="," close=")"> <foreach collection="list" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
...@@ -46,11 +44,11 @@ ...@@ -46,11 +44,11 @@
<!--根据特征值编码把所有特征值更新为默认1--> <!--根据特征值编码把所有特征值更新为默认1-->
<update id="updateDefaultValueZero" parameterType="list"> <update id="updateDefaultValueZero" parameterType="list">
UPDATE characteristicvalue UPDATE super_characteristic_info
SET isdefault=0 SET is_Show=1
<where> <where>
<if test="list!=null and list.size()>0"> <if test="list!=null and list.size()>0">
and characteristicCode in and characteristic_Code in
<foreach collection="list" item="item" open="(" separator="," close=")"> <foreach collection="list" item="item" open="(" separator="," close=")">
#{item} #{item}
</foreach> </foreach>
......
...@@ -26,6 +26,9 @@ ...@@ -26,6 +26,9 @@
<if test="superBomCode!=null and superBomCode!=''.toString()"> <if test="superBomCode!=null and superBomCode!=''.toString()">
a.super_bom_code = #{superBomCode} a.super_bom_code = #{superBomCode}
</if> </if>
<if test="superBomCode==null ">
a.super_bom_code is null
</if>
<if test="productClassCode!=null and productClassCode!=''.toString()"> <if test="productClassCode!=null and productClassCode!=''.toString()">
and a.product_class_code = #{productClassCode} and a.product_class_code = #{productClassCode}
</if> </if>
...@@ -44,7 +47,14 @@ ...@@ -44,7 +47,14 @@
<if test="brand != null and brand !=''.toString()"> <if test="brand != null and brand !=''.toString()">
and brand =#{brand} and brand =#{brand}
</if> </if>
<if test="superBomCode != null and superBomCode !=''.toString()">
<if test="priceType != null ">
and price_type =#{priceType}
</if>
<if test="superBomCode == null ">
and super_bom_code is null
</if>
<if test="superBomCode != '' and superBomCode != null">
and super_bom_code =#{superBomCode} and super_bom_code =#{superBomCode}
</if> </if>
</where> </where>
...@@ -104,4 +114,23 @@ ...@@ -104,4 +114,23 @@
order by a.super_bom_code,b.characteristic_code,c.characteristic_value_code order by a.super_bom_code,b.characteristic_code,c.characteristic_value_code
</select> </select>
<select id="getCharacteristicsPrice" resultType="cn.com.uitech.authorization.pojo.entity.SuperBomPriceInfoEntity">
select c.cv_price_id price_id,actual_price, leve0_price, leve1_price, leve2_price, leve3_price,
leve4_price, agent_price from
basics_price_info a INNER JOIN super_characteristic_info b
on a.super_bom_code = b.super_bom_code
INNER JOIN super_character_price_info c
on a.super_bom_code = c.super_bom_code and b.characteristic_code = c.character_code
<where>
<if test="superBomCode != null and superBomCode != ''.toString()">
a.super_bom_code = #{superBomCode}
</if>
<if test="superBomCode==null ">
and a.super_bom_code is null
</if>
<if test="type !=null">
and a.price_type = #{type}
</if>
</where>
</select>
</mapper> </mapper>
...@@ -82,10 +82,10 @@ ...@@ -82,10 +82,10 @@
</insert> </insert>
<select id="getConfigInfoList" resultType="cn.com.uitech.authorization.pojo.entity.SuperBomSkuConfigInfo"> <select id="getConfigInfoList" resultType="cn.com.uitech.authorization.pojo.entity.SuperBomSkuConfigInfo">
select * from super_bom_sku_config_info where super_bom_code = #{h3cPn} and characteristic_value_code = #{vCode} select * from super_bom_sku_config_info where config_id = #{configId} and characteristic_value_name = #{vCode}
</select> </select>
<select id="querySkuList" resultType="cn.com.uitech.authorization.pojo.entity.SuperBomSkuInfo"> <select id="querySkuList" resultType="cn.com.uitech.authorization.pojo.entity.SuperBomSkuInfo">
select * from super_bom_sku_info a left join super_bom_sku_config_info b on a.config_id = b.config_id select * from super_bom_sku_info a
<where> <where>
<if test="productClassCode!=null and productClassCode!=''.toString()"> <if test="productClassCode!=null and productClassCode!=''.toString()">
a.product_class_code = #{productClassCode} a.product_class_code = #{productClassCode}
...@@ -115,4 +115,54 @@ ...@@ -115,4 +115,54 @@
<update id="updateSkuInfo"> <update id="updateSkuInfo">
update super_bom_sku_info set sncode = #{sncode},product_type = #{productType} ,product_small_type =#{productSmallType},sku_code = #{skuCode} where config_id = #{configId} update super_bom_sku_info set sncode = #{sncode},product_type = #{productType} ,product_small_type =#{productSmallType},sku_code = #{skuCode} where config_id = #{configId}
</update> </update>
<resultMap id="SuperBomSkuMap" type="cn.com.uitech.authorization.pojo.entity.SuperBomSkuInfo">
<id property="id" column="id"/>
<result property="productClassCode" column="product_class_code"/>
<result property="productClassName" column="product_class_name"/>
<result property="superBomCode" column="super_bom_code"/>
<result property="superBomName" column="super_bom_name"/>
<result property="brand" column="brand"/>
<result property="h3cPn" column="h3c_pn"/>
<result property="h3cPayNo" column="h3c_pay_no"/>
<result property="politicalMiningId" column="political_mining_id"/>
<result property="patern" column="patern"/>
<result property="unisConfigCode" column="unis_config_code"/>
<result property="productType" column="product_type"/>
<result property="productSmallType" column="product_small_type"/>
<result property="isConfig" column="is_config"/>
<result property="description" column="description"/>
<result property="configId" column="config_id"/>
<result property="sncode" column="sncode"/>
<result property="revision" column="revision"/>
<result property="modelStatus" column="model_status"/>
<result property="applyStatus" column="apply_status"/>
<result property="skuCode" column="sku_code"/>
<result property="skuName" column="sku_name"/>
<collection property="characteristicList" ofType="cn.com.uitech.authorization.pojo.entity.SuperBomSkuConfigInfo">
<id property="id" column="id"/>
<result property="configId" column="config_id"/>
<result property="skuCode" column="sku_code"/>
<result property="characteristicCode" column="characteristic_code"/>
<result property="characteristicName" column="characteristic_name"/>
<result property="h3cCCode" column="h3c_c_code"/>
<result property="unisSalesCName" column="unis_sales_c_name"/>
<result property="characteristicValueCode" column="characteristic_value_code"/>
<result property="characteristicValueName" column="characteristic_value_name"/>
<result property="h3cVValue" column="h3c_v_value"/>
<result property="unisSalesVName" column="unis_sales_v_name"/>
</collection>
</resultMap>
<select id="querySkuOne" resultMap="SuperBomSkuMap">
select * from super_bom_sku_info a left join super_bom_sku_config_info b on a.config_id = b.config_id
where a.config_id = #{configId}
</select>
<select id="getSkuInfo" resultMap="SuperBomSkuMap">
select *from super_bom_sku_info where super_bom_code = #{superBomCode} and config_id = #{configId}
</select>
<select id="getConfigId" resultType="java.lang.String">
select config_id from super_bom_sku_info where sku_code = #{skuCode}
</select>
</mapper> </mapper>
\ No newline at end of file
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
<mapper namespace="cn.com.uitech.authorization.mapper.SuperTableInfoMapper"> <mapper namespace="cn.com.uitech.authorization.mapper.SuperTableInfoMapper">
<select id="getOne" resultType="cn.com.uitech.authorization.pojo.entity.SuperTableInfo"> <select id="getOne" resultType="cn.com.uitech.authorization.pojo.entity.SuperTableInfo">
select * from super_table_info where table_number = #{tableNumber} select * from super_table_info where table_number = #{tableNumber} and table_name = #{tableName} and super_bom_code = #{superBomCode}
</select> </select>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment