优化商品导入模块
This commit is contained in:
@@ -296,4 +296,17 @@ public class MaterialExtendService {
|
|||||||
}
|
}
|
||||||
return list;
|
return list;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional(value = "transactionManager", rollbackFor = Exception.class)
|
||||||
|
public Long selectIdByMaterialIdAndDefaultFlag(Long materialId, String defaultFlag)throws Exception {
|
||||||
|
Long id = 0L;
|
||||||
|
MaterialExtendExample example = new MaterialExtendExample();
|
||||||
|
example.createCriteria().andMaterialIdEqualTo(materialId).andDefaultFlagEqualTo(defaultFlag)
|
||||||
|
.andDeleteFlagNotEqualTo(BusinessConstants.DELETE_FLAG_DELETED);
|
||||||
|
List<MaterialExtend> list = materialExtendMapper.selectByExample(example);
|
||||||
|
if(list!=null && list.size()>0) {
|
||||||
|
id = list.get(0).getId();
|
||||||
|
}
|
||||||
|
return id;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -493,7 +493,13 @@ public class MaterialService {
|
|||||||
basicMaterialExtend.setUpdateTime(System.currentTimeMillis());
|
basicMaterialExtend.setUpdateTime(System.currentTimeMillis());
|
||||||
basicMaterialExtend.setCreateSerial(user.getLoginName());
|
basicMaterialExtend.setCreateSerial(user.getLoginName());
|
||||||
basicMaterialExtend.setUpdateSerial(user.getLoginName());
|
basicMaterialExtend.setUpdateSerial(user.getLoginName());
|
||||||
materialExtendMapper.insertSelective(basicMaterialExtend);
|
Long meId = materialExtendService.selectIdByMaterialIdAndDefaultFlag(mId, "1");
|
||||||
|
if(meId==0L){
|
||||||
|
materialExtendMapper.insertSelective(basicMaterialExtend);
|
||||||
|
} else {
|
||||||
|
basicMaterialExtend.setId(meId);
|
||||||
|
materialExtendMapper.updateByPrimaryKeySelective(basicMaterialExtend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if(StringUtil.isExist(materialExObj.get("other"))) {
|
if(StringUtil.isExist(materialExObj.get("other"))) {
|
||||||
String otherStr = materialExObj.getString("other");
|
String otherStr = materialExObj.getString("other");
|
||||||
@@ -504,7 +510,13 @@ public class MaterialService {
|
|||||||
otherMaterialExtend.setUpdateTime(System.currentTimeMillis());
|
otherMaterialExtend.setUpdateTime(System.currentTimeMillis());
|
||||||
otherMaterialExtend.setCreateSerial(user.getLoginName());
|
otherMaterialExtend.setCreateSerial(user.getLoginName());
|
||||||
otherMaterialExtend.setUpdateSerial(user.getLoginName());
|
otherMaterialExtend.setUpdateSerial(user.getLoginName());
|
||||||
materialExtendMapper.insertSelective(otherMaterialExtend);
|
Long meId = materialExtendService.selectIdByMaterialIdAndDefaultFlag(mId, "0");
|
||||||
|
if(meId==0L){
|
||||||
|
materialExtendMapper.insertSelective(otherMaterialExtend);
|
||||||
|
} else {
|
||||||
|
otherMaterialExtend.setId(meId);
|
||||||
|
materialExtendMapper.updateByPrimaryKeySelective(otherMaterialExtend);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
//给商品初始化库存
|
//给商品初始化库存
|
||||||
Map<Long, BigDecimal> stockMap = m.getStockMap();
|
Map<Long, BigDecimal> stockMap = m.getStockMap();
|
||||||
|
|||||||
Reference in New Issue
Block a user