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