|
|
@ -70,7 +70,7 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
newMaterial.setCode(material.getCode()); |
|
|
|
newMaterial.setNum(num + material.getNum()); |
|
|
|
} |
|
|
|
newMaterial.setUpdateTime(new Date()); |
|
|
|
newMaterial.setId(oldMaterial.getId()); |
|
|
|
if(materialMapper.updateByPrimaryKeySelective(newMaterial) > 0){ |
|
|
|
log.info("update add material success from {} to {} ", JSON.toJSONString(oldMaterial),JSON.toJSONString(newMaterial)); |
|
|
|
}else{ |
|
|
@ -133,23 +133,12 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
log.error("update sub material failed from {} to {} ", JSON.toJSONString(oldMaterial),JSON.toJSONString(newMaterial)); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
newMaterial.setId(oldMaterial.getId()); |
|
|
|
newMaterial.setCode(material.getCode()); |
|
|
|
newMaterial.setNum(0); |
|
|
|
if(materialMapper.updateByPrimaryKeySelective(newMaterial) > 0){ |
|
|
|
log.info("update add material success from {} to {} for failed ", JSON.toJSONString(oldMaterial),JSON.toJSONString(newMaterial)); |
|
|
|
}else{ |
|
|
|
log.error("update add material failed from {} to {} for failed ", JSON.toJSONString(oldMaterial),JSON.toJSONString(newMaterial)); |
|
|
|
} |
|
|
|
BeanUtils.copyProperties(oldMaterial,errorMaterial); |
|
|
|
errorMaterial.setNum(material.getNum() - num); |
|
|
|
errorMaterial.setId(material.getId()); |
|
|
|
failMaterials.add(errorMaterial); |
|
|
|
} |
|
|
|
}else{ |
|
|
|
errorMaterial.setId(material.getId()); |
|
|
|
errorMaterial.setCode(material.getCode()); |
|
|
|
errorMaterial.setNum(material.getNum()); |
|
|
|
errorMaterial.setNum(-1); |
|
|
|
failMaterials.add(errorMaterial); |
|
|
|
} |
|
|
|
} |
|
|
@ -182,12 +171,12 @@ public class MaterialServiceImpl implements MaterialService { |
|
|
|
} |
|
|
|
|
|
|
|
@Override |
|
|
|
public boolean delete(String code) { |
|
|
|
if(materialMapper.deleteByPrimaryKey(code) > 0){ |
|
|
|
log.info("delete material success {} ", code); |
|
|
|
public boolean delete(Integer id) { |
|
|
|
if(materialMapper.deleteByPrimaryKey(id) > 0){ |
|
|
|
log.info("delete material success {} ", id); |
|
|
|
return true; |
|
|
|
} |
|
|
|
log.error("delete material failed {} ", code); |
|
|
|
log.error("delete material failed {} ", id); |
|
|
|
return false; |
|
|
|
} |
|
|
|
|
|
|
|