Commit 9580042c by zhaoxiaolei

调用PLM 成功

parent abf6f689
......@@ -98,7 +98,7 @@ public class IntegrateController {
characteristicValue.put("characteristicName", cName);
String characteristicValueCode = itemInfo.getCharacteristicValueCode();
if (!StringUtils.isEmpty(characteristicValueCode)) {
String vName = integrateService.getVNameByCode(characteristicValueCode);
String vName = integrateService.getVNameByCode(characteristicValueCode,characteristicCode);
values.add(vName);
}
featureComponentNames.add(cName);
......@@ -167,7 +167,7 @@ public class IntegrateController {
String characteristicName = (String) item.get("characteristicName");
Characteristic characteristic = integrateService.findByCharacteristicName(characteristicName, selectorEntity.getSuperBomCode());
String characteristicValueName = (String) item.get("characteristicValueName");
CharacteristicValue characteristicValue = integrateService.findByCharacteristicValueName(characteristicValueName, selectorEntity.getSuperBomCode());
CharacteristicValue characteristicValue = integrateService.findByCharacteristicValueName(characteristic.getCharacteristicCode(),characteristicValueName, selectorEntity.getSuperBomCode());
selectedValue.put("characteristicCode", characteristic.getCharacteristicCode());
selectedValue.put("characteristicName", characteristic.getCharacteristicName());
selectedValue.put("characteristicValueCode", characteristicValue.getCharacteristicValueCode());
......@@ -305,5 +305,11 @@ public class IntegrateController {
return ResultGenerator.genSuccessResult(integrateService.querySkuOne(configId));
}
@PostMapping("/getToken")
@ApiOperation(value = "获取token", notes = "getToken", httpMethod = "POST")
public CrmResponseEntity<?> getToken(@RequestBody UserInfo userinfo) {
return ResultGenerator.genSuccessResult(integrateService.getToken(userinfo));
}
}
......@@ -84,4 +84,6 @@ public interface CharacteristicMapper extends IBaseMapper<Characteristic>, Inser
void updateSuperBomSkuInfo(ApplySkuCodeResultDto.data applySkuCodeResultDto);
void updateSuperBomSkuStatus(ApplySkuCodeResultDto.data data);
void updateSuperBomSku(SuperBomSkuInfo superBomSkuInfo);
}
......@@ -94,11 +94,11 @@ public interface CharacteristicValueMapper extends IBaseMapper<CharacteristicVal
void saveBom(CharacteristicValue characteristicValue);
CharacteristicValue findByCharacteristicValueName(String characteristicValueName,String superBomCode);
CharacteristicValue findByCharacteristicValueName(String characteristicName,String characteristicValueName,String superBomCode);
String getName(Object v);
String getVNameByCode(String characteristicValueCode);
String getVNameByCode(String characteristicValueCode,String characteristicCode);
CharacteristicValue getCharacteristicValueInfoByName(String characteristicValueName,String superBomCode,String characteristicName);
......
......@@ -12,4 +12,6 @@ public interface SuperTableInfoItemMapper extends IBaseMapper<SuperTableItemInfo
void saveBom(SuperTableItemInfo item);
SuperTableItemInfo getOne(SuperTableItemInfo item);
void deleteItemBom(String tableNumber,String superBomCode);
}
package cn.com.uitech.authorization.mapper;
import cn.com.uitech.authorization.pojo.entity.UserInfo;
import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface UserInfoMapper extends IBaseMapper<UserInfo> {
UserInfo getUser(UserInfo userinfo);
}
......@@ -46,7 +46,7 @@ public class CtoBomRequestParamDto extends BasePageDto implements Serializable{
@ApiModelProperty(name = "description",value = "描述",dataType ="String")
private String description;
@ApiModelProperty(name = "modelStatus",value = "状态",dataType ="String")
private Integer modelStatus;
private String modelStatus;
@ApiModelProperty(name = "type",value = "类型",dataType ="String")
private String type;
@ApiModelProperty(name = "productClassCode",value = "产品组",dataType ="String")
......
package cn.com.uitech.authorization.pojo.entity;
import io.swagger.annotations.ApiModel;
import lombok.*;
import lombok.experimental.Accessors;
import javax.persistence.Column;
import javax.persistence.Table;
@Accessors(chain = true)
@NoArgsConstructor
@AllArgsConstructor
@Getter
@Setter
@ToString
@Table(name = "user_info")
@Builder
@ApiModel("user_info")
public class UserInfo {
@Column(name = "user_code")
private String userCode;
@Column(name = "pass_word")
private String password;
@Column(name = "user_name")
private String userName;
}
......@@ -21,13 +21,13 @@ public interface IntegrateService {
Characteristic findByCharacteristicName(String characteristicName,String superBomCode);
CharacteristicValue findByCharacteristicValueName(String characteristicValueName,String superBomCode);
CharacteristicValue findByCharacteristicValueName(String characteristicName,String characteristicValueName,String superBomCode);
String getName(Object v);
String getNameByCode(String characteristicCode,Integer isShow);
String getVNameByCode(String characteristicValueCode);
String getVNameByCode(String characteristicValueCode,String characteristicCode);
Object getSuperBomInfoByConfigId(Map<String, Object> map);
......@@ -46,4 +46,6 @@ public interface IntegrateService {
PageInfo<SuperBomSkuInfo> querySkuList(SuperBomSkuInfo superBomSkuInfo);
Object querySkuOne(String configId);
Object getToken(UserInfo userinfo);
}
......@@ -13,6 +13,7 @@ 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.entity.CharacteristicValue;
import cn.com.uitech.authorization.pojo.entity.GetSKUByH3CConfigInfo;
import cn.com.uitech.authorization.pojo.entity.OdRelation;
import cn.com.uitech.authorization.service.CharacteristicValueService;
import cn.com.uitech.authorization.service.CtoBomService;
......@@ -152,7 +153,8 @@ public class CharacteristicValueServiceImpl implements CharacteristicValueServic
*/
@Override
public Integer editCharacteristicValue(CharacteristicValue dto) {
GetSKUByH3CConfigInfo getSKUByH3CConfigInfo = new GetSKUByH3CConfigInfo();
//getSKUByH3CConfigInfo.setH3CPNList()
return characteristicValueMapper.editCharacteristicValue(dto);
}
......
......@@ -8,6 +8,8 @@ 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 com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
......@@ -29,6 +31,7 @@ import org.springframework.util.ObjectUtils;
import org.springframework.util.StringUtils;
import org.springframework.web.client.RestTemplate;
import javax.annotation.Resource;
import java.sql.Timestamp;
import java.util.*;
......@@ -50,6 +53,10 @@ public class IntegrateServiceImpl implements IntegrateService {
@Autowired
private SuperBomSkuInfoMapper superBomSkuInfoMapper;
@Autowired
private UserInfoMapper userInfoMapper;
@Resource
private RedisHelper redisHelper;
@Autowired
private Sequence sequence;
@Value("${plm.url}")
private String plmUrl;
......@@ -67,6 +74,7 @@ public class IntegrateServiceImpl implements IntegrateService {
//TYPE=SuperPart数据插入到SuperBOMInfo
try {
if (!CollectionUtils.isEmpty(saveSuperBomInputDtos)) {
int flag = 0;
for (SaveSuperBomInputDto saveSuperBomInputDto : saveSuperBomInputDtos) {
if (saveSuperBomInputDto.getType().equals("SuperPart")) {
ConfigurableBom configurableBom = new ConfigurableBom();
......@@ -78,6 +86,8 @@ public class IntegrateServiceImpl implements IntegrateService {
configurableBom.setProductClassName(saveSuperBomInputDto.getClassification());
configurableBom.setUnisSalesName(saveSuperBomInputDto.getScuxItemName());
configurableBom.setBrand(saveSuperBomInputDto.getBrand());
configurableBom.setRevision(saveSuperBomInputDto.getRevision());
configurableBom.setType(saveSuperBomInputDto.getType());
ConfigurableBom getOne = ctoBomMapper.getCtoBomsByCode(configurableBom.getSuperBomCode(), configurableBom.getProductClassName());
if (!ObjectUtils.isEmpty(getOne)) {
BeanUtils.copyProperties(configurableBom, getOne);
......@@ -86,6 +96,7 @@ public class IntegrateServiceImpl implements IntegrateService {
log.setUpdateTime(new Timestamp(System.currentTimeMillis()));
ctoBomMapper.saveLog(log);
ctoBomMapper.updateCtoBom(getOne);
flag++;
} else {
configurableBom.setIsState(0);
ConfigurableBomLog log = new ConfigurableBomLog();
......@@ -93,12 +104,17 @@ public class IntegrateServiceImpl implements IntegrateService {
log.setInsertTime(new Timestamp(System.currentTimeMillis()));
ctoBomMapper.saveLog(log);
ctoBomMapper.saveConfigurableBom(configurableBom);
flag++;
}
result.setCode(ApiResult.SUCCESS.getCode());
result.setMsg(ApiResult.SUCCESS.getMsg());
} else {
result.setCode(ApiResult.API_REQ_DATA_IS_FAIL.getCode());
result.setMsg("请检查数据格式");
return result;
}
}
result.setCode(ApiResult.SUCCESS.getCode());
result.setMsg("数据集成完成,成功条数:" + flag);
} else {
result.setCode(ApiResult.API_REQ_DATA_IS_FAIL.getCode());
result.setMsg(ApiResult.API_REQ_DATA_IS_FAIL.getMsg());
......@@ -121,7 +137,9 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristic.setCharacteristicCode(saveSuperCharacterInputDto.getOptionNumber());
characteristic.setCharacteristicName(saveSuperCharacterInputDto.getOptionName());
characteristic.setSuperBomCode(saveSuperCharacterInputDto.getSuperNumber());
characteristic.setIsShow(0);
characteristic.setUnisSalesCName(saveSuperCharacterInputDto.getOptionName());
characteristic.setIsShow(1);
characteristic.setIsHidden(0);
characteristic.setCharacteristicType("否");
Characteristic getOne = characteristicMapper.selectByCode(characteristic);
if (!ObjectUtils.isEmpty(getOne)) {
......@@ -132,7 +150,6 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristicMapper.saveLog(log);
characteristicMapper.updateBom(getOne);
} else {
characteristic.setIsHidden(0);
CharacteristicLog log = new CharacteristicLog();
BeanUtils.copyProperties(characteristic, log);
log.setInsertTime(new Timestamp(System.currentTimeMillis()));
......@@ -152,6 +169,7 @@ public class IntegrateServiceImpl implements IntegrateService {
GetProductOutDto result = new GetProductOutDto();
try {
if (!CollectionUtils.isEmpty(saveSuperCharacterValueInputDtos)) {
int flag = 0;
for (SaveSuperCharacterValueInputDto saveSuperCharacterValueInputDto : saveSuperCharacterValueInputDtos) {
CharacteristicValue characteristicValue = new CharacteristicValue();
characteristicValue.setCharacteristicValueCode(saveSuperCharacterValueInputDto.getChoiceNumber());
......@@ -166,27 +184,37 @@ public class IntegrateServiceImpl implements IntegrateService {
characteristicValue.setZphName(saveSuperCharacterValueInputDto.getZphName());
characteristicValue.setH3cDeliverCode(saveSuperCharacterValueInputDto.getH3cDeliverCode());
characteristicValue.setUnisSalesVName(saveSuperCharacterValueInputDto.getChoiceName());
characteristicValue.setUnisSalesCName(saveSuperCharacterValueInputDto.getOptionNumber());
characteristicValue.setCharacteristicCode(saveSuperCharacterValueInputDto.getOptionNumber());
CharacteristicValue getOne = characteristicValueMapper.selectByCode(characteristicValue);
if (!ObjectUtils.isEmpty(getOne)) {
characteristicValue.setIsBase(0);
characteristicValue.setIsShow(1);
characteristicValue.setIsState(0);
BeanUtils.copyProperties(characteristicValue, getOne);
CharacteristicValueLog log = new CharacteristicValueLog();
BeanUtils.copyProperties(getOne, log);
log.setUpdateTime(new Timestamp(System.currentTimeMillis()));
characteristicValueMapper.saveLog(log);
characteristicValueMapper.updateBom(getOne);
flag++;
} else {
characteristicValue.setIsBase(0);
characteristicValue.setIsShow(1);
characteristicValue.setIsState(0);
CharacteristicValueLog log = new CharacteristicValueLog();
BeanUtils.copyProperties(characteristicValue, log);
log.setInsertTime(new Timestamp(System.currentTimeMillis()));
characteristicValueMapper.saveLog(log);
characteristicValueMapper.saveBom(characteristicValue);
flag++;
}
}
result.setMsg("table数据集成成功,成功条数:" + flag);
result.setCode(ApiResult.SUCCESS.getCode());
return result;
}
} catch (Exception e) {
new BusinessException(ApiResult.INTERNAL_SERVER_ERROR.getMsg());
return result.setMsg(e.getMessage());
}
return result;
}
......@@ -195,11 +223,11 @@ public class IntegrateServiceImpl implements IntegrateService {
public GetProductOutDto SetSuperTableInfo(List<SaveTableInputDto> saveTableInputDtos) {
GetProductOutDto result = new GetProductOutDto();
try {
for (SaveTableInputDto saveTableInputDto : saveTableInputDtos) {
if (!ObjectUtils.isEmpty(saveTableInputDtos)) {
int flag = 0;
for (SaveTableInputDto saveTableInputDto : saveTableInputDtos) {
List<String> superBomCodeList = saveTableInputDto.getSuperBomCode();
for (String superBomCode : superBomCodeList) {
SuperTableInfo superTableInfo = new SuperTableInfo();
superTableInfo.setId(sequence.nextId());
superTableInfo.setSuperBomCode(superBomCode);
......@@ -217,6 +245,7 @@ public class IntegrateServiceImpl implements IntegrateService {
superTableInfoMapper.saveBom(getOne);
if (!CollectionUtils.isEmpty(saveTableInputDto.getTableLists())) {
List<SaveTableInputDto.SuperTableItemDto> tableLists = saveTableInputDto.getTableLists();
superTableInfoItemMapper.deleteItemBom(saveTableInputDto.getTableNumber(), superBomCode);
for (SaveTableInputDto.SuperTableItemDto tableItem : tableLists) {
SuperTableItemInfo item = new SuperTableItemInfo();
item.setId(sequence.nextId());
......@@ -232,28 +261,55 @@ public class IntegrateServiceImpl implements IntegrateService {
superTableInfoItemMapper.saveLog(itemLog);
superTableInfoItemMapper.saveBom(item);
}
} else {
result.setMsg("请检查数据格式是否正确");
result.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
return result;
}
result.setMsg(ApiResult.SUCCESS.getMsg());
result.setCode(ApiResult.SUCCESS.getCode());
flag++;
} else {
SuperTableInfoLog log = new SuperTableInfoLog();
BeanUtils.copyProperties(superTableInfo, log);
log.setCreateTime(new Timestamp(System.currentTimeMillis()));
log.setCreateBy(SecurityService.getPrincipal().getCode());
superTableInfoMapper.saveLog(log);
superTableInfoMapper.deleteBom(getOne);
superTableInfoMapper.saveBom(superTableInfo);
result.setMsg(ApiResult.SUCCESS.getMsg());
result.setCode(ApiResult.SUCCESS.getCode());
if (!CollectionUtils.isEmpty(saveTableInputDto.getTableLists())) {
List<SaveTableInputDto.SuperTableItemDto> tableLists = saveTableInputDto.getTableLists();
superTableInfoItemMapper.deleteItemBom(saveTableInputDto.getTableNumber(), superBomCode);
for (SaveTableInputDto.SuperTableItemDto tableItem : tableLists) {
SuperTableItemInfo item = new SuperTableItemInfo();
item.setId(sequence.nextId());
item.setGroupNumber(tableItem.getLineCode());
item.setSuperBomCode(superBomCode);
item.setTableNumber(saveTableInputDto.getTableNumber());
item.setCharacteristicCode(tableItem.getCharacteristicCode());
item.setCharacteristicValueCode(tableItem.getCharacteristicValueCode());
item.setCreateBy(SecurityService.getPrincipal().getCode());
item.setCreateTime(new Timestamp(System.currentTimeMillis()));
SuperTableItemInfoLog itemLog = new SuperTableItemInfoLog();
BeanUtils.copyProperties(item, itemLog);
superTableInfoItemMapper.saveLog(itemLog);
superTableInfoItemMapper.saveBom(item);
}
} else {
result.setMsg("请检查数据格式是否正确");
result.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
return result;
}
flag++;
}
}
}
result.setMsg("table数据集成成功,成功条数:" + flag);
result.setCode(ApiResult.SUCCESS.getCode());
return result;
}
} catch (Exception e) {
result.setMsg(ApiResult.INTERNAL_SERVER_ERROR.getMsg());
result.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
result.setData(new BusinessException());
return result;
}
return result;
......@@ -271,8 +327,8 @@ public class IntegrateServiceImpl implements IntegrateService {
}
@Override
public CharacteristicValue findByCharacteristicValueName(String characteristicValueName, String superBomCode) {
return characteristicValueMapper.findByCharacteristicValueName(characteristicValueName, superBomCode);
public CharacteristicValue findByCharacteristicValueName(String characteristicName, String characteristicValueName, String superBomCode) {
return characteristicValueMapper.findByCharacteristicValueName(characteristicName, characteristicValueName, superBomCode);
}
@Override
......@@ -320,12 +376,8 @@ public class IntegrateServiceImpl implements IntegrateService {
superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
} else {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("未回号");
characteristicMapper.updateSuperBomSkuStatus(data);
superBomSkuInfo.setSkuCode(data.getSkuCode());
superBomSkuInfo.setSkuName(data.getSkuName());
superBomSkuInfo.setDescription("调用PLM申请回号失败");
characteristicMapper.updateSuperBomSku(superBomSkuInfo);
}
} else {
result.setMsg(applySkuCodeResultDto.getMsg());
......@@ -385,6 +437,22 @@ public class IntegrateServiceImpl implements IntegrateService {
return superBomSkuInfoMapper.querySkuOne(configId);
}
@Override
public Object getToken(UserInfo userinfo) {
GetProductOutDto result = new GetProductOutDto();
UserInfo getOne = userInfoMapper.getUser(userinfo);
if (!ObjectUtils.isEmpty(getOne)) {
String md5Str = MD5Util.getMD5Str(getOne.getPassword()+"_unis_cpq_"+getOne.getUserCode());
String doubleMd5 = MD5Util.getMD5Str(md5Str);
result.setData(doubleMd5);
redisHelper.set("unis_cpq:"+getOne.getUserCode()+"_"+getOne.getPassword(),doubleMd5,86400);
} else {
result.setMsg("用户不存在/密码错误");
result.setCode(500);
}
return result;
}
/**
* @return Configid, SKUCode,SKUCode,产品型号,产品小型好,69码
......@@ -396,12 +464,9 @@ public class IntegrateServiceImpl implements IntegrateService {
public ApplySkuCodeResultDto applySkuCode(SuperBomSkuInfo superBomSkuInfo) {
ApplySkuCodeResultDto dto = new ApplySkuCodeResultDto();
Map<String, Object> map = null;
try {
//调用PLM 申请skuCode
RestTemplate restTemplate = new RestTemplate();
HttpHeaders tokenHeader = getHttpHeaderPlmToken();
HttpEntity<String> tokenRequestEntity = new HttpEntity<>(null, tokenHeader);
......@@ -425,18 +490,18 @@ public class IntegrateServiceImpl implements IntegrateService {
List<SuperBomSkuConfigInfo> characteristicList = superBomSkuInfo.getCharacteristicList();
if (!CollectionUtils.isEmpty(characteristicList)) {
for (SuperBomSkuConfigInfo superBomSkuConfigInfo : characteristicList) {
ToPLMDto.OptionChoiceMap map = new ToPLMDto.OptionChoiceMap();
map.setSpecial(false);
map.setOption(superBomSkuConfigInfo.getCharacteristicName());
map.setChoice(superBomSkuConfigInfo.getCharacteristicValueName());
map.setSpecialDescription(superBomSkuInfo.getDescription());
maps.add(map);
ToPLMDto.OptionChoiceMap map1 = new ToPLMDto.OptionChoiceMap();
map1.setSpecial(false);
map1.setOption(superBomSkuConfigInfo.getCharacteristicName());
map1.setChoice(superBomSkuConfigInfo.getCharacteristicValueName());
map1.setSpecialDescription(superBomSkuInfo.getDescription());
maps.add(map1);
}
}
toPLMDto.setOptionChoiceMaps(maps);
HttpHeaders headers = getHttpHeaderPlm(nonce);
HttpEntity httpEntity = new HttpEntity<>(JSONObject.toJSON(toPLMDto), headers);
Map<String, Object> map = (Map<String, Object>) restTemplate.exchange(plmUrl, HttpMethod.POST, httpEntity, Object.class).getBody();
map = (Map<String, Object>) restTemplate.exchange(plmUrl, HttpMethod.POST, httpEntity, Object.class).getBody();
Integer code = (Integer) map.get("code");
if (!ObjectUtils.isEmpty(code)) {
if (code.equals(200)) {
......@@ -459,7 +524,7 @@ public class IntegrateServiceImpl implements IntegrateService {
}
}
} catch (Exception e) {
dto.setMsg("该配置在CPQ不存在,调用PLM申请回号失败!");
dto.setMsg(e.getMessage());
dto.setCode(500);
return dto;
}
......@@ -467,8 +532,8 @@ public class IntegrateServiceImpl implements IntegrateService {
}
@Override
public String getVNameByCode(String characteristicValueCode) {
return characteristicValueMapper.getVNameByCode(characteristicValueCode);
public String getVNameByCode(String characteristicValueCode, String characteristicCode) {
return characteristicValueMapper.getVNameByCode(characteristicValueCode, characteristicCode);
}
@Override
......@@ -620,12 +685,8 @@ public class IntegrateServiceImpl implements IntegrateService {
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);
superBomSkuInfo.setDescription("调用PLM申请回号失败");
characteristicMapper.updateSuperBomSku(superBomSkuInfo);
}
} else {
result.setMsg(skuInfo.getMsg());
......@@ -672,14 +733,20 @@ public class IntegrateServiceImpl implements IntegrateService {
public Object saveSukInfo(SuperBomSkuInfo superBomSkuInfo) {
GetProductOutDto result = new GetProductOutDto();
try {
List<SuperBomSkuConfigInfo> characteristicList = superBomSkuInfo.getCharacteristicList();
for (SuperBomSkuConfigInfo superBomSkuConfigInfo : characteristicList) {
SuperBomSkuConfigInfo skuConfigInfo = characteristicMapper.checkConfig(superBomSkuConfigInfo.getCharacteristicCode(), superBomSkuConfigInfo.getCharacteristicValueName(), superBomSkuInfo.getSuperBomCode(), superBomSkuInfo.getPatern(), superBomSkuInfo.getPoliticalMiningId(), superBomSkuInfo.getConfigId(), superBomSkuConfigInfo.getCharacteristicValueCode());
if (ObjectUtils.isEmpty(skuConfigInfo)) {
//撞配不通过 保存SKU信息 调用申请SKU接口 applySkuCode
SuperBomSkuConfigInfo config = new SuperBomSkuConfigInfo();
BeanUtils.copyProperties(superBomSkuConfigInfo, config);
config.setId(sequence.nextId());
config.setConfigId(superBomSkuInfo.getConfigId());
superBomSkuInfoMapper.saveSkuConfig(config);
}
}
superBomSkuInfo.setId(sequence.nextId());
superBomSkuInfoMapper.saveSkuInfo(superBomSkuInfo);
List<SuperBomSkuConfigInfo> superBomSkuConfigInfos = superBomSkuInfo.getCharacteristicList();
superBomSkuConfigInfos.forEach(item -> {
item.setId(sequence.nextId());
item.setConfigId(superBomSkuInfo.getConfigId());
superBomSkuInfoMapper.saveSkuConfig(item);
});
//保存完成后申请SKU 调用PLM申请SKU编号
ApplySkuCodeResultDto applySkuCodeResultDto = applySkuCode(superBomSkuInfo);
//根据 ConfigId 修改 产品小型号 产品型号 SkuCode 69码
......@@ -691,18 +758,17 @@ public class IntegrateServiceImpl implements IntegrateService {
result.setCode(applySkuCodeResultDto.getCode());
result.setMsg(applySkuCodeResultDto.getMsg());
} else {
ApplySkuCodeResultDto.data data = applySkuCodeResultDto.getData();
data.setConfigId(superBomSkuInfo.getConfigId());
data.setMsg("未回号");
characteristicMapper.updateSuperBomSkuStatus(data);
result.setCode(applySkuCodeResultDto.getCode());
result.setMsg(applySkuCodeResultDto.getMsg());
result.setMsg("调用PLM申请回号失败");
result.setData(applySkuCodeResultDto);
return result;
}
} catch (Exception e) {
new BusinessException(ApiResult.INTERNAL_SERVER_ERROR.getMsg());
result.setCode(ApiResult.INTERNAL_SERVER_ERROR.getCode());
result.setMsg(ApiResult.INTERNAL_SERVER_ERROR.getMsg());
result.setData(e.getMessage());
return result;
}
return result;
}
......
package cn.com.uitech.authorization.utils;
import java.io.UnsupportedEncodingException;
import java.math.BigInteger;
import java.security.MessageDigest;
import java.security.NoSuchAlgorithmException;
public class MD5Util {
public static String getMD5Str(String str) {
byte[] digest = null;
try {
MessageDigest md5 = MessageDigest.getInstance("md5");
digest = md5.digest(str.getBytes("utf-8"));
} catch (NoSuchAlgorithmException e) {
e.printStackTrace();
} catch (UnsupportedEncodingException e) {
e.printStackTrace();
}
//16是表示转换为16进制数
String md5Str = new BigInteger(1, digest).toString(16);
return md5Str;
}
}
\ No newline at end of file
......@@ -24,28 +24,14 @@
<update id="updateCharacteristic" parameterType="cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto" >
update super_characteristic_info
<set>
<if test="characteristicName!=null and characteristicName!=''">
set
characteristic_name =#{characteristicName},
</if>
<if test="unisSalesCName!=null and unisSalesCName!=''">
unis_Sales_C_Name =#{unisSalesCName},
</if>
<if test="characteristicType!=null and characteristicType!=''">
characteristic_type =#{characteristicType},
</if>
<if test="H3CCCode!=null and H3CCCode!=''">
h3c_c_code =#{H3CCCode},
</if>
<if test="isHidden!=null ">
is_hidden =#{isHidden}
</if>
</set>
<where>
<if test="characteristicCode!=null and characteristicCode!=''">
where
Characteristic_Code=#{characteristicCode}
</if>
</where>
</update>
<update id="updateVisibleType" parameterType="cn.com.uitech.authorization.pojo.dto.CharacteristicRequestParamDto">
......@@ -194,7 +180,7 @@
sku_code = #{skuCode},
sku_name = #{skuName},
apply_status = #{msg},
sn_code = #{snCode},
sncode = #{snCode},
description = #{description},
product_type =#{productType},
product_small_type =#{productSmallType}
......@@ -204,4 +190,8 @@
<update id="updateSuperBomSkuStatus">
update super_bom_sku_info set msg = #{msg} where config_id = #{configId}
</update>
<update id="updateSuperBomSku">
update super_bom_sku_info set apply_status = #{description} where config_id = #{configId}
</update>
</mapper>
......@@ -65,32 +65,15 @@
<update id="editCharacteristicValue" parameterType="cn.com.uitech.authorization.pojo.entity.CharacteristicValue">
UPDATE super_characteristic_value_info
<set>
<if test="characteristicValueName!=null and characteristicValueName!=''">
set
characteristic_Value_name=#{characteristicValueName},
</if>
<if test="isState!=null">
is_state=#{isState},
</if>
<if test="isShow!=null">
is_Show=#{isShow},
</if>
<if test="zphCode!=null and zphCode!=''">
zph_code=#{zphCode},
</if>
<if test="zphName!=null and zphName!=''">
zph_name=#{zphName},
</if>
<if test="qualifyDate!=null">
qualify_date=#{qualifyDate},
</if>
<if test="unisSalesVName!=null and unisSalesVName!=''">
unis_sales_v_name=#{unisSalesVName},
</if>
<if test="h3cCValue!=null and h3cCValue!=''">
h3c_c_value=#{h3cCValue},
</if>
</set>
h3c_c_value=#{h3cCValue}
<where>
<if test="characteristicValueCode!=null and characteristicValueCode.length>0">
Characteristic_Value_Code=#{characteristicValueCode}
......@@ -232,7 +215,7 @@
</select>
<select id="selectByCode" resultType="cn.com.uitech.authorization.pojo.entity.CharacteristicValue">
select * from super_characteristic_value_info where Characteristic_Value_Code=#{characteristicValueCode}
select * from super_characteristic_value_info where Characteristic_Value_Code=#{characteristicValueCode} and Characteristic_Code = #{characteristicCode}
</select>
<insert id="saveLog">
......@@ -246,7 +229,10 @@
unis_sales_v_name,
h3c_c_value,
is_base,
is_show,update_time,insert_time,h3c_deliver_code )
is_show,
update_time,
insert_time,
h3c_deliver_code )
VALUES
(
#{characteristicValueCode},#{characteristicCode},#{characteristicValueName},
......@@ -296,7 +282,7 @@
</insert>
<select id="findByCharacteristicValueName" resultType="cn.com.uitech.authorization.pojo.entity.CharacteristicValue">
select * from super_characteristic_value_info where characteristic_value_name = #{characteristicValueName} and super_bom_code = #{superBomCode}
select * from super_characteristic_value_info where characteristic_code = #{characteristicName} and characteristic_value_name = #{characteristicValueName} and super_bom_code = #{superBomCode}
</select>
<select id="getName" resultType="java.lang.String">
......@@ -309,7 +295,7 @@
</select>
<select id="getVNameByCode" resultType="java.lang.String">
select characteristic_value_name from super_characteristic_value_info where characteristic_value_code = #{characteristicValueCode}
select characteristic_value_name from super_characteristic_value_info where characteristic_value_code = #{characteristicValueCode} and characteristic_code = #{characteristicCode}
</select>
<select id="getCharacteristicValueInfoByName"
......
......@@ -29,39 +29,18 @@
</select>
<update id="updateCtoBomByBomCode" parameterType="cn.com.uitech.authorization.pojo.dto.CtoBomRequestParamDto">
UPDATE super_bom_info
<set>
<if test="superBomName!=null and superBomName!=''">
UPDATE super_bom_info set
super_bom_name=#{superBomName} ,
</if>
<if test="type!=null and type!=''">
type=#{type} ,
</if>
<if test="isState!=null">
is_state=#{isState} ,
</if>
<if test="modelStatus!=null">
model_status=#{modelStatus} ,
</if>
<if test="h3cPn!=null and h3cPn!=''">
h3c_pn=#{h3cPn} ,
</if>
<if test="configId!=null and configId!=''">
config_id=#{configId} ,
</if>
<if test="productClassCode!=null and productClassCode!=''">
product_class_code=#{productClassCode},
</if>
<if test="unisSalesName!=null and unisSalesName!=''">
unis_sales_name=#{unisSalesName},
</if>
</set>
<where>
1=1
<if test="superBomCode!=null">
and super_bom_code=#{superBomCode}
unis_sales_name=#{unisSalesName}
where
<if test="superBomCode!=null and superBomCode!=''">
super_bom_code=#{superBomCode}
</if>
<if test="superBomCodes!=null and superBomCodes.length>0">
and super_bom_code in
......@@ -69,7 +48,6 @@
#{superBomCode}
</foreach>
</if>
</where>
</update>
<select id="getCtoBomsByCode" parameterType="java.lang.String"
......@@ -265,7 +243,9 @@
type = #{type},
model_status = #{modelStatus},
unis_sales_name = #{unisSalesName},
brand = #{brand}
brand = #{brand},
revision = #{revision},
type = #{type}
where super_bom_code = #{superBomCode}
</update>
......
......@@ -5,24 +5,28 @@
<insert id="saveLog">
INSERT INTO super_table_item_info_log (
table_number,group_number,Characteristic_Code,Characteristic_value_Code,
create_time,create_by,id )
create_time,create_by,id,super_bom_code )
VALUES
(
#{tableNumber},#{groupNumber},#{characteristicCode},#{characteristicValueCode},#{createTime},#{createBy},#{id}
#{tableNumber},#{groupNumber},#{characteristicCode},#{characteristicValueCode},#{createTime},#{createBy},#{id},#{superBomCode}
);
</insert>
<insert id="saveBom">
INSERT INTO super_table_item_info (
table_number,group_number,Characteristic_Code,Characteristic_value_Code,
create_time,create_by,id )
create_time,create_by,id,super_bom_code )
VALUES
(
#{tableNumber},#{groupNumber},#{characteristicCode},#{characteristicValueCode},#{createTime},#{createBy},#{id}
#{tableNumber},#{groupNumber},#{characteristicCode},#{characteristicValueCode},#{createTime},#{createBy},#{id},#{superBomCode}
);
</insert>
<select id="getOne" resultType="cn.com.uitech.authorization.pojo.entity.SuperTableItemInfo">
select * from super_table_item_info where super_bom_code = #{superBomCode} and Characteristic_value_Code = #{characteristicValueCode}
</select>
<delete id="deleteItemBom">
delete from super_table_item_info where table_number = #{tableNumber} and super_bom_code = #{superBomCode}
</delete>
</mapper>
......@@ -39,8 +39,7 @@
</insert>
<delete id="deleteBom">
delete from super_table_info where super_bom_code = #{superBomCode};
delete from super_table_item_info where super_bom_code = #{superBomCode};
delete from super_table_info where super_bom_code = #{superBomCode} and table_number = #{tableNumber};
</delete>
<resultMap id="baseResultMap" type="cn.com.uitech.authorization.pojo.dto.SuperTableInfoDto">
......
<?xml version="1.0" encoding="UTF-8"?>
<!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.UserInfoMapper">
<select id="getUser" resultType="cn.com.uitech.authorization.pojo.entity.UserInfo">
select * from user_info where user_code = #{userCode} and pass_word = #{password}
</select>
</mapper>
\ No newline at end of file
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